PageSourceSearch

https://cloudmysite.ai/assets/API-DAFHaofH.js

js cloudmysite.ai collected 2026-10-05 15:12:16 UTC 120,576 bytes, 44 lines download raw bytes

vendor: 7,586 bytes, lines 1-3
1import{N as Ie,a4 as ft,d as dt,a5 as pt,a6 as At,a7 as Or,a8 as hn,a9 as it,aa as Ar,ab as kr,A as yn,ac as wr,S as Ir,ad as Cr,ae as _r,s as mn,af as Dr,ag as vn,ah as En,ai as gn,aj as bn,ak as Rr,al as xr,am as Tn,M as Ne,an as Mt,E as Lr,H as Sn,u as Pr,P as Mr,k as Nn,ao as Fr,C as Ur}from"./amplify_outputs-ByhBuvRU.js";const On=e=>e&&e["nonRetryable"],Re=new Ie("retryUtil");async function jr(e,t,n,r){if(typeof e!="function")throw Error("functionToRetry must be a function");return new Promise(async(i,s)=>{let o=0,a=!1,c=()=>{},u;for(;!a;){o++,Re.debug(`${e.name} attempt #${o} with this vars: ${JSON.stringify(t)}`);try{i(await e(...t));return}catch(l){if(u=l,Re.debug(`error on ${e.name}`,l),On(l)){Re.debug(`${e.name} non retryable error`,l),s(l);return}const f=n(o,t,l);if(Re.debug(`${e.name} retrying in ${f} ms`),f===!1||a){s(l);return}else await new Promise(p=>{c=p,setTimeout(c,f)})}}s(u)})}function U(e){return typeof e=="function"}function Kr(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var st=Kr(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
2`+n.map(function(r,i){return i+1+") "+r.toString()}).join(`
3  `):"",this.name="UnsubscriptionError",this.errors=n}});function Ft(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var kt=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=ft(o),c=a.next();!c.done;c=a.next()){var u=c.value;u.remove(this)}}catch(m){t={error:m}}finally{try{c&&!c.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else o.remove(this);var l=this.initialTeardown;if(U(l))try{l()}catch(m){s=m instanceof st?m.errors:[m]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=ft(f),d=p.next();!d.done;d=p.next()){var h=d.value;try{Ut(h)}catch(m){s=s??[],m instanceof st?s=dt(dt([],pt(s)),pt(m.errors)):s.push(m)}}}catch(m){r={error:m}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(s)throw new st(s)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ut(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Ft(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Ft(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();kt.EMPTY;function An(e){return e instanceof kt||e&&"closed"in e&&U(e.remove)&&U(e.add)&&U(e.unsubscribe)}function Ut(e){U(e)?e():e.unsubscribe()}var Br={Promise:void 0},$r={setTimeout:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,dt([e,t],pt(n)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function kn(e){$r.setTimeout(function(){throw e})}function jt(){}function Vr(e){e()}var wt=function(e){At(t,e);function t(n){var r=e.call(this)||this;return r.isStopped=!1,n?(r.destination=n,An(n)&&n.add(r)):r.destination=Hr,r}return t.create=function(n,r,i){return new ht(n,r,i)},t.prototype.next=function(n){this.isStopped||this._next(n)},t.prototype.error=function(n){this.isStopped||(this.isStopped=!0,this._error(n))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(n){this.destination.next(n)},t.prototype._error=function(n){try{this.destination.error(n)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(kt),Gr=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var n=this.partialObserver;if(n.next)try{n.next(t)}catch(r){xe(r)}},e.prototype.error=function(t){var n=this.partialObserver;if(n.error)try{n.error(t)}catch(r){xe(r)}else xe(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(n){xe(n)}},e}(),ht=function(e){At(t,e);function t(n,r,i){var s=e.call(this)||this,o;return U(n)||!n?o={next:n??void 0,error:r??void 0,complete:i??void 0}:o=n,s.destination=new Gr(o),s}return t}(wt);function xe(e){kn(e)}function qr(e){throw e}var Hr={closed:!0,next:jt,error:qr,complete:jt},It=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Qr(e){return e}function Wr(e){return e.length===0?Qr:e.length===1?e[0]:function(n){return e.reduce(function(r,i){return i(r)},n)}}var B=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(t,n,r){var i=this,s=Yr(t)?t:new ht(t,n,r);return Vr(function(){var o=i,a=o.operator,c=o.source;s.add(a?a.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(n){t.error(n)}},e.prototype.forEach=function(t,n){var r=this;return n=Kt(n),new n(function(i,s){var o=new ht({next:function(a){try{t(a)}catch(c){s(c),o.unsubscribe()}},error:s,complete:i});r.subscribe(o)})},e.prototype._subscribe=function(t){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(t)},e.prototype[It]=function(){return this},e.prototype.pipe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return Wr(t)(this)},e.prototype.toPromise=function(t){var n=this;return t=Kt(t),new t(function(r,i){var s;n.subscribe(function(o){return s=o},function(o){return i(o)},function(){return r(s)})})},e.create=function(t){return new e(t)},e}();function Kt(e){var t;return(t=e??Br.Promise)!==null&&t!==void 0?t:Promise}function zr(e){return e&&U(e.next)&&U(e.error)&&U(e.complete)}function Yr(e){return e&&e instanceof wt||zr(e)&&An(e)}function Jr(e){return U(e?.lift)}function Ce(e){return function(t){if(Jr(t))return t.lift(function(n){try{return e(n,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function ze(e,t,n,r,i){return new Xr(e,t,n,r,i)}var Xr=function(e){At(t,e);function t(n,r,i,s,o,a){var c=e.call(this,n)||this;return c.onFinalize=o,c.shouldUnsubscribe=a,c._next=r?function(u){try{r(u)}catch(l){n.error(l)}}:e.prototype._next,c._error=s?function(u){try{s(u)}catch(l){n.error(l)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(u){n.error(u)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var n;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&((n=this.onFinalize)===null||n===void 0||n.call(this))}},t}(wt),wn=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function In(e){return U(e?.then)}function Cn(e){return U(e[It])}function _n(e){return Symbol.asyncIterator&&U(e?.[Symbol.asyncIterator])}function Dn(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invali
3d object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Zr(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Rn=Zr();function xn(e){return U(e?.[Rn])}function Ln(e){return Or(this,arguments,function(){var n,r,i,s;return hn(this,function(o){switch(o.label){case 0:n=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,it(n.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,it(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,it(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return n.releaseLock(),[7];case 10:return[2]}})})}function Pn(e){return U(e?.getReader)}function Ye(e){if(e instanceof B)return e;if(e!=null){if(Cn(e))return ei(e);if(wn(e))return ti(e);if(In(e))return ni(e);if(_n(e))return Mn(e);if(xn(e))return ri(e);if(Pn(e))return ii(e)}throw Dn(e)}function ei(e){return new B(function(t){var n=e[It]();if(U(n.subscribe))return n.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ti(e){return new B(function(t){for(var n=0;n<e.length&&!t.closed;n++)t.next(e[n]);t.complete()})}function ni(e){return new B(function(t){e.then(function(n){t.closed||(t.next(n),t.complete())},function(n){return t.error(n)}).then(null,kn)})}function ri(e){return new B(function(t){var n,r;try{for(var i=ft(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(a){n={error:a}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()})}function Mn(e){return new B(function(t){si(e,t).catch(function(n){return t.error(n)})})}function ii(e){return Mn(Ln(e))}function si(e,t){var n,r,i,s;return Ar(this,void 0,void 0,function(){var o,a;return hn(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=kr(e),c.label=1;case 1:return[4,n.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function ie(e,t,n,r,i){r===void 0&&(r=0),i===void 0&&(i=!1);var s=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(s),!i)return s}function Fn(e,t){return t===void 0&&(t=0),Ce(function(n,r){n.subscribe(ze(r,function(i){return ie(r,e,function(){return r.next(i)},t)},function(){return ie(r,e,function(){return r.complete()},t)},function(i){return ie(r,e,function(){return r.error(i)},t)}))})}function Un(e,t){return t===void 0&&(t=0),Ce(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}function oi(e,t){return Ye(e).pipe(Un(t),Fn(t))}function ai(e,t){return Ye(e).pipe(Un(t),Fn(t))}function ci(e,t){return new B(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})})}function ui(e,t){return new B(function(n){var r;return ie(n,t,function(){r=e[Rn](),ie(n,t,function(){var i,s,o;try{i=r.next(),s=i.value,o=i.done}catch(a){n.error(a);return}o?n.complete():n.next(s)},0,!0)}),function(){return U(r?.return)&&r.return()}})}function jn(e,t){if(!e)throw new Error("Iterable cannot be null");return new B(function(n){ie(n,t,function(){var r=e[Symbol.asyncIterator]();ie(n,t,function(){r.next().then(function(i){i.done?n.complete():n.next(i.value)})},0,!0)})})}function li(e,t){return jn(Ln(e),t)}function fi(e,t){if(e!=null){if(Cn(e))return oi(e,t);if(wn(e))return ci(e,t);if(In(e))return ai(e,t);if(_n(e))return jn(e,t);if(xn(e))return ui(e,t);if(Pn(e))return li(e,t)}throw Dn(e)}function di(e,t){return t?fi(e,t):Ye(e)}function Ct(e,t){return Ce(function(n,r){var i=0;n.subscribe(ze(r,function(s){r.next(e.call(t,s,i++))}))})}function pi(e,t){return Ce(function(n,r){var i=0;n.subscribe(ze(r,function(s){return e.call(t,s,i++)&&r.next(s)}))})}function Kn(e){return Ce(function(t,n){var r=null,i=!1,s;r=t.subscribe(ze(n,void 0,void 0,function(o){s=Ye(e(o,Kn(e)(t))),r?
3(r.unsubscribe(),r=null,s.subscribe(n)):i=!0})),i&&(r.unsubscribe(),r=null,s.subscribe(n))})}const hi=()=>{if(typeof self>"u")return!1;const e=self;return typeof e.WorkerGlobalScope<"u"&&self instanceof e.WorkerGlobalScope};class ue{networkMonitor(t){const n=hi()?self:typeof window<"u"&&window;return n?new B(r=>{r.next({online:n.navigator.onLine});const i=()=>{r.next({online:!0})},s=()=>{r.next({online:!1})};return n.addEventListener("online",i),n.addEventListener("offline",s),ue._observers.push(r),()=>{n.removeEventListener("online",i),n.removeEventListener("offline",s),ue._observers=ue._observers.filter(o=>o!==r)}}):di([{online:!0}])}static _observerOverride(t){for(const n of this._observers){if(n.closed){this._observers=this._observers.filter(r=>r!==n);continue}n?.next&&n.next(t)}}}ue._observers=[];const yi=(e,t)=>e.Auth.fetchAuthSession(t),Bn=e=>yi(yn,e),$n=e=>Object.keys(e).map(t=>t.toLowerCase()).sort().join(";"),mi="X-Amz-Date",vi="X-Amz-Security-Token",Ei="authorization",gi="host",bi=mi.toLowerCase(),Ti=vi.toLowerCase(),Vn="aws4_request",Gn="AWS4-HMAC-SHA256",Si="AWS4",Ni="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",qn="UNSIGNED-PAYLOAD",Oi=(e,t,n)=>`${e}/${t}/${n}/${Vn}`,Ai=e=>{const t=e.toISOString().replace(/[:-]|\.\d{3}/g,"");return{longDate:t,shortDate:t.slice(0,8)}},ki=({credentials:e,signingDate:t=new Date,signingRegion:n,signingService:r,uriEscapePath:i=!0})=>{const{accessKeyId:s,secretAccessKey:o,sessionToken:a}=e,{longDate:c,shortDate:u}=Ai(t),l=Oi(u,n,r);return{accessKeyId:s,credentialScope:l,longDate:c,secretAccessKey:o,sessionToken:a,shortDate:u,signingRegion:n,signingService:r,uriEscapePath:i}},ge=(e,t)=>{const n=new Ir(e??void 0);return n.update(t),n.digestSync()},yt=(e,t)=>{const n=ge(e,t);return wr(n)},wi=e=>Object.entries(e).map(([t,n])=>({key:t.toLowerCase(),value:n?.trim().replace(/\s+/g," ")??""})).sort((t,n)=>t.key<n.key?-1:1).map(t=>`${t.key}:${t.value}
4`).join(""),Ii=e=>Array.from(e).sort(([t,n],[r,i])=>t===r?n<i?-1:1:t<r?-1:1).map(([t,n])=>`${Bt(t)}=${Bt(n)}`).join("&"),Bt=e=>encodeURIComponent(e).replace(/[!'()*]/g,Ci),Ci=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`,_i=(e,t=!0)=>e?t?encodeURIComponent(e).replace(/%2F/g,"/"):e:"/",Di=e=>e==null?Ni:Ri(e)?yt(null,e):qn,Ri=e=>e!==qn&&(typeof e=="string"||ArrayBuffer.isView(e)||xi(e)),xi=e=>typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]",Li=({body:e,headers:t,method:n,url:r},i=!0)=>[n,_i(r.pathname,i),Ii(r.searchParams),wi(t),$n(t),Di(e)].join(`
5`),Pi=(e,t,n,r)=>{const i=`${Si}${e}`,s=ge(i,t),o=ge(s,n),a=ge(o,r);return ge(a,Vn)},Mi=(e,t,n)=>[Gn,e,t,n].join(`
6`),Fi=(e,{credentialScope:t,longDate:n,secretAccessKey:r,shortDate:i,signingRegion:s,signingService:o,uriEscapePath:a})=>{const c=Li(e,a),u=yt(null,c),l=Mi(n,t,u);return yt(Pi(r,i,s,o),l)},Hn=(e,t)=>{const n=ki(t),{accessKeyId:r,credentialScope:i,longDate:s,sessionToken:o}=n,a={...e.headers};a[gi]=e.url.host,a[bi]=s,o&&(a[Ti]=o);const c={...e,headers:a},u=Fi(c,n),l=`Credential=${r}/${i}`,f=`SignedHeaders=${$n(a)}`,p=`Signature=${u}`;return a[Ei]=`${Gn} ${l}, ${f}, ${p}`,c},Qn=e=>new Date(Date.now()+e),Ui=5*60*1e3,ji=(e,t)=>Math.abs(Qn(t).getTime()-e)>=Ui,Ki=(e,t)=>ji(e,t)?e-Date.now():t,Bi=({credentials:e,region:t,service:n,uriEscapePath:r=!0})=>{let i;return(s,o)=>async function(c){i=i??0;const u={credentials:typeof e=="function"?await e({forceRefresh:!!o?.isCredentialsExpired}):e,signingDate:Qn(i),signingRegion:t,signingService:n,uriEscapePath:r},l=await Hn(c,u),f=await s(l),p=$i(f);return p&&(i=Ki(Date.parse(p),i)),f}},$i=({headers:e}={})=>e?.date??e?.Date??e?.["x-amz-date"];class Vi extends Error{constructor(){super(...arguments),this.nonRetryable=!0}}const Gi=(e,t,n=Cr,r)=>jr(e,t,_r(n));class Ge extends mn{get response(){return this._response?qi(this._response):void 0}constructor(t){super(t),this.constructor=Ge,Object.setPrototypeOf(this,Ge.prototype),t.response&&(this._response=t.response)}}const qi=e=>({...e,headers:{...e.headers}});function Pe(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Pe=function(n){return typeof n}:Pe=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Pe(e)}function Hi(e){return Pe(e)=="object"&&e!==null}var Wn=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";
6function mt(e,t){for(var n=/\r\n|[\n\r]/g,r=1,i=t+1,s;(s=n.exec(e.body))&&s.index<t;)r+=1,i=t+1-(s.index+s[0].length);return{line:r,column:i}}function Qi(e){return zn(e.source,mt(e.source,e.start))}function zn(e,t){var n=e.locationOffset.column-1,r=Me(n)+e.body,i=t.line-1,s=e.locationOffset.line-1,o=t.line+s,a=t.line===1?n:0,c=t.column+a,u="".concat(e.name,":").concat(o,":").concat(c,`
7`),l=r.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var p=Math.floor(c/80),d=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return u+$t([["".concat(o),h[0]]].concat(h.slice(1,p+1).map(function(v){return["",v]}),[[" ",Me(d-1)+"^"],["",h[p+1]]]))}return u+$t([["".concat(o-1),l[i-1]],["".concat(o),f],["",Me(c-1)+"^"],["".concat(o+1),l[i+1]]])}function $t(e){var t=e.filter(function(r){r[0];var i=r[1];return i!==void 0}),n=Math.max.apply(Math,t.map(function(r){var i=r[0];return i.length}));return t.map(function(r){var i=r[0],s=r[1];return Wi(n,i)+(s?" | "+s:" |")}).join(`
8`)}function Me(e){return Array(e+1).join(" ")}function Wi(e,t){return Me(e-t.length)+t}function Fe(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fe=function(n){return typeof n}:Fe=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},Fe(e)}function Vt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function zi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Vt(Object(n),!0).forEach(function(r){Yi(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ji(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Xi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Zi(e,t,n){return t&&Xi(e.prototype,t),e}function es(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Oe(e,t)}function ts(e){var t=Jn();return function(){var r=Ae(e),i;if(t){var s=Ae(this).constructor;i=Reflect.construct(r,arguments,s)}else i=r.apply(this,arguments);return Yn(this,i)}}function Yn(e,t){return t&&(Fe(t)==="object"||typeof t=="function")?t:be(e)}function be(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function vt(e){var t=typeof Map=="function"?new Map:void 0;return vt=function(r){if(r===null||!ns(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return Ue(r,arguments,Ae(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Oe(i,r)},vt(e)}function Ue(e,t,n){return Jn()?Ue=Reflect.construct:Ue=function(i,s,o){var a=[null];a.push.apply(a,s);var c=Function.bind.apply(i,a),u=new c;return o&&Oe(u,o.prototype),u},Ue.apply(null,arguments)}function Jn(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function ns(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Oe(e,t){return Oe=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Oe(e,t)}function Ae(e){return Ae=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Ae(e)}var Te=function(e){es(n,e);var t=ts(n);function n(r,i,s,o,a,c,u){var l,f,p,d;Ji(this,n),d=t.call(this,r),d.name="GraphQLError",d.originalError=c??void 0,d.nodes=Gt(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,v=(g=d.nodes)!==null&&g!==void 0?g:[];m<v.length;m++){var g,T=v[m],S=T.loc;S!=null&&h.push(S)}h=Gt(h),d.source=s??((l=h)===null||l===void 0?void 0:l[0].source),d.positions=o??((f=h)===null||f===void 0?void 0:f.map(function(b){return b.start})),d.locations=o&&s?o.map(function(b){return mt(s,b)}
8):(p=h)===null||p===void 0?void 0:p.map(function(b){return mt(b.source,b.start)}),d.path=a??void 0;var A=c?.extensions;return u==null&&Hi(A)?d.extensions=zi({},A):d.extensions=u??{},Object.defineProperties(be(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(be(d),"stack",{value:c.stack,writable:!0,configurable:!0}),Yn(d)):(Error.captureStackTrace?Error.captureStackTrace(be(d),n):Object.defineProperty(be(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Zi(n,[{key:"toString",value:function(){return rs(this)}},{key:Wn,get:function(){return"Object"}}]),n}(vt(Error));function Gt(e){return e===void 0||e.length===0?void 0:e}function rs(e){var t=e.message;if(e.nodes)for(var n=0,r=e.nodes;n<r.length;n++){var i=r[n];i.loc&&(t+=`
9
10`+Qi(i.loc))}else if(e.source&&e.locations)for(var s=0,o=e.locations;s<o.length;s++){var a=o[s];t+=`
11
12`+zn(e.source,a)}return t}function $(e,t,n){return new Te("Syntax Error: ".concat(n),void 0,e,[t])}var N=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function is(e,t){var n=!!e;if(!n)throw new Error("Unexpected invariant triggered.")}var Et=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0;function Xn(e){var t=e.prototype.toJSON;typeof t=="function"||is(0),e.prototype.inspect=t,Et&&(e.prototype[Et]=t)}var Zn=function(){function e(n,r,i){this.start=n.start,this.end=r.end,this.startToken=n,this.endToken=r,this.source=i}var t=e.prototype;return t.toJSON=function(){return{start:this.start,end:this.end}},e}();Xn(Zn);var x=function(){function e(n,r,i,s,o,a,c){this.kind=n,this.start=r,this.end=i,this.line=s,this.column=o,this.value=c,this.prev=a,this.next=null}var t=e.prototype;return t.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},e}();Xn(x);function qt(e){return e!=null&&typeof e.kind=="string"}var y=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function je(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?je=function(n){return typeof n}:je=function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},je(e)}var ss=10,er=2;function tr(e){return Je(e,[])}function Je(e,t){switch(je(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return e===null?"null":os(e,t);default:return String(e)}}function os(e,t){if(t.indexOf(e)!==-1)return"[Circular]";var n=[].concat(t,[e]),r=us(e);if(r!==void 0){var i=r.call(e);
vendor: 5,197 bytes, lines 12-17
12if(i!==e)return typeof i=="string"?i:Je(i,n)}else if(Array.isArray(e))return cs(e,n);return as(e,n)}function as(e,t){var n=Object.keys(e);if(n.length===0)return"{}";if(t.length>er)return"["+ls(e)+"]";var r=n.map(function(i){var s=Je(e[i],t);return i+": "+s});return"{ "+r.join(", ")+" }"}function cs(e,t){if(e.length===0)return"[]";if(t.length>er)return"[Array]";for(var n=Math.min(ss,e.length),r=e.length-n,i=[],s=0;s<n;++s)i.push(Je(e[s],t));return r===1?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items")),"["+i.join(", ")+"]"}function us(e){var t=e[String(Et)];if(typeof t=="function")return t;if(typeof e.inspect=="function")return e.inspect}function ls(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if(t==="Object"&&typeof e.constructor=="function"){var n=e.constructor.name;if(typeof n=="string"&&n!=="")return n}return t}function ot(e,t){var n=!!e;if(!n)throw new Error(t)}const fs=function(t,n){return t instanceof n};function ds(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ps(e,t,n){return t&&ds(e.prototype,t),e}var nr=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof t=="string"||ot(0,"Body must be a string. Received: ".concat(tr(t),".")),this.body=t,this.name=n,this.locationOffset=r,this.locationOffset.line>0||ot(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ot(0,"column in locationOffset is 1-indexed and must be positive.")}return ps(e,[{key:Wn,get:function(){return"Source"}}]),e}();function hs(e){return fs(e,nr)}var ys=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function ms(e){var t=e.split(/\r\n|[\n\r]/g),n=vs(e);if(n!==0)for(var r=1;r<t.length;r++)t[r]=t[r].slice(n);for(var i=0;i<t.length&&Ht(t[i]);)++i;for(var s=t.length;s>i&&Ht(t[s-1]);)--s;return t.slice(i,s).join(`
13`)}function Ht(e){for(var t=0;t<e.length;++t)if(e[t]!==" "&&e[t]!=="	")return!1;return!0}function vs(e){for(var t,n=!0,r=!0,i=0,s=null,o=0;o<e.length;++o)switch(e.charCodeAt(o)){case 13:e.charCodeAt(o+1)===10&&++o;case 10:n=!1,r=!0,i=0;break;case 9:case 32:++i;break;default:r&&!n&&(s===null||i<s)&&(s=i),r=!1}return(t=s)!==null&&t!==void 0?t:0}function Es(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=e.indexOf(`
14`)===-1,i=e[0]===" "||e[0]==="	",s=e[e.length-1]==='"',o=e[e.length-1]==="\\",a=!r||s||o||n,c="";return a&&!(r&&i)&&(c+=`
15`+t),c+=t?e.replace(/\n/g,`
16`+t):e,a&&(c+=`
17`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var gs=function(){function e(n){var r=new x(y.SOF,0,0,0,0,null);this.source=n,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var t=e.prototype;return t.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},t.lookahead=function(){var r=this.token;if(r.kind!==y.EOF)do{var i;r=(i=r.next)!==null&&i!==void 0?i:r.next=Ts(this,r)}while(r.kind===y.COMMENT);return r},e}();function bs(e){return e===y.BANG||e===y.DOLLAR||e===y.AMP||e===y.PAREN_L||e===y.PAREN_R||e===y.SPREAD||e===y.COLON||e===y.EQUALS||e===y.AT||e===y.BRACKET_L||e===y.BRACKET_R||e===y.BRACE_L||e===y.PIPE||e===y.BRACE_R}function se(e){return isNaN(e)?y.EOF:e<127?JSON.stringify(String.fromCharCode(e)):'"\\u'.concat(("00"+e.toString(16).toUpperCase()).slice(-4),'"')}function Ts(e,t){for(var n=e.source,r=n.body,i=r.length,s=t.end;s<i;){var o=r.charCodeAt(s),a=e.line,c=1+s-e.lineStart;switch(o){case 65279:case 9:case 32:case 44:++s;continue;case 10:++s,++e.line,e.lineStart=s;continue;case 13:r.charCodeAt(s+1)===10?s+=2:++s,++e.line,e.lineStart=s;continue;case 33:return new x(y.BANG,s,s+1,a,c,t);case 35:return Ns(n,s,a,c,t);case 36:return new x(y.DOLLAR,s,s+1,a,c,t);case 38:return new x(y.AMP,s,s+1,a,c,t);case 40:return new x(y.PAREN_L,s,s+1,a,c,t);case 41:return new x(y.PAREN_R,s,s+1,a,c,t);case 46:if(r.charCodeAt(s+1)===46&&r.charCodeAt(s+2)===46)return new x(y.SPREAD,s,s+3,a,c,t);break;case 58:return new x(y.COLON,s,s+1,a,c,t);case 61:return new x(y.EQUALS,s,s+1,a,c,t);case 64:return new x(y.AT,s,s+1,a,c,t);case 91:return new x(y.BRACKET_L,s,s+1,a,c,t);case 93:return new x(y.BRACKET_R,s,s+1,a,c,t);case 123:return new x(y.BRACE_L,s,s+1,a,c,t);case 124:return new x(y.PIPE,s,s+1,a,c,t);case 125:return new x(y.BRACE_R,s,s+1,a,c,t);case 34:return r.charCodeAt(s+1)===34&&r.charCodeAt(s+2)===34?ks(n,s,a,c,t,e):As(n,s,a,c,t);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Os(n,s,o,a,c,t);
vendor: 2,623 bytes, lines 17-18
17case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return Is(n,s,a,c,t)}throw $(n,s,Ss(o))}var u=e.line,l=1+s-e.lineStart;return new x(y.EOF,i,i,u,l,t)}function Ss(e){return e<32&&e!==9&&e!==10&&e!==13?"Cannot contain the invalid character ".concat(se(e),"."):e===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(se(e),".")}function Ns(e,t,n,r,i){var s=e.body,o,a=t;do o=s.charCodeAt(++a);while(!isNaN(o)&&(o>31||o===9));return new x(y.COMMENT,t,a,n,r,i,s.slice(t+1,a))}function Os(e,t,n,r,i,s){var o=e.body,a=n,c=t,u=!1;if(a===45&&(a=o.charCodeAt(++c)),a===48){if(a=o.charCodeAt(++c),a>=48&&a<=57)throw $(e,c,"Invalid number, unexpected digit after 0: ".concat(se(a),"."))}else c=at(e,c,a),a=o.charCodeAt(c);if(a===46&&(u=!0,a=o.charCodeAt(++c),c=at(e,c,a),a=o.charCodeAt(c)),(a===69||a===101)&&(u=!0,a=o.charCodeAt(++c),(a===43||a===45)&&(a=o.charCodeAt(++c)),c=at(e,c,a),a=o.charCodeAt(c)),a===46||Cs(a))throw $(e,c,"Invalid number, expected digit but got: ".concat(se(a),"."));return new x(u?y.FLOAT:y.INT,t,c,r,i,s,o.slice(t,c))}function at(e,t,n){var r=e.body,i=t,s=n;if(s>=48&&s<=57){do s=r.charCodeAt(++i);while(s>=48&&s<=57);return i}throw $(e,i,"Invalid number, expected digit but got: ".concat(se(s),"."))}function As(e,t,n,r,i){for(var s=e.body,o=t+1,a=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return u+=s.slice(a,o),new x(y.STRING,t,o+1,n,r,i,u);if(c<32&&c!==9)throw $(e,o,"Invalid character within String: ".concat(se(c),"."));if(++o,c===92){switch(u+=s.slice(a,o-1),c=s.charCodeAt(o),c){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
18`;break;case 114:u+="\r";break;case 116:u+="	";break;case 117:{var l=ws(s.charCodeAt(o+1),s.charCodeAt(o+2),s.charCodeAt(o+3),s.charCodeAt(o+4));if(l<0){var f=s.slice(o+1,o+5);throw $(e,o,"Invalid character escape sequence: \\u".concat(f,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw $(e,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,a=o}}throw $(e,o,"Unterminated string.")}function ks(e,t,n,r,i,s){for(var o=e.body,a=t+3,c=a,u=0,l="";
vendor: 4,098 bytes, line 18
18a<o.length&&!isNaN(u=o.charCodeAt(a));){if(u===34&&o.charCodeAt(a+1)===34&&o.charCodeAt(a+2)===34)return l+=o.slice(c,a),new x(y.BLOCK_STRING,t,a+3,n,r,i,ms(l));if(u<32&&u!==9&&u!==10&&u!==13)throw $(e,a,"Invalid character within String: ".concat(se(u),"."));u===10?(++a,++s.line,s.lineStart=a):u===13?(o.charCodeAt(a+1)===10?a+=2:++a,++s.line,s.lineStart=a):u===92&&o.charCodeAt(a+1)===34&&o.charCodeAt(a+2)===34&&o.charCodeAt(a+3)===34?(l+=o.slice(c,a)+'"""',a+=4,c=a):++a}throw $(e,a,"Unterminated string.")}function ws(e,t,n,r){return Le(e)<<12|Le(t)<<8|Le(n)<<4|Le(r)}function Le(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:-1}function Is(e,t,n,r,i){for(var s=e.body,o=s.length,a=t+1,c=0;a!==o&&!isNaN(c=s.charCodeAt(a))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++a;return new x(y.NAME,t,a,n,r,i,s.slice(t,a))}function Cs(e){return e===95||e>=65&&e<=90||e>=97&&e<=122}function ct(e,t){var n=new _s(e,t);return n.parseDocument()}var _s=function(){function e(n,r){var i=hs(n)?n:new nr(n);this._lexer=new gs(i),this._options=r}var t=e.prototype;return t.parseName=function(){var r=this.expectToken(y.NAME);return{kind:N.NAME,value:r.value,loc:this.loc(r)}},t.parseDocument=function(){var r=this._lexer.token;return{kind:N.DOCUMENT,definitions:this.many(y.SOF,this.parseDefinition,y.EOF),loc:this.loc(r)}},t.parseDefinition=function(){if(this.peek(y.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(y.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},t.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek(y.BRACE_L))return{kind:N.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var i=this.parseOperationType(),s;return this.peek(y.NAME)&&(s=this.parseName()),{kind:N.OPERATION_DEFINITION,operation:i,name:s,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},t.parseOperationType=function(){var r=this.expectToken(y.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},t.parseVariableDefinitions=function(){return this.optionalMany(y.PAREN_L,this.parseVariableDefinition,y.PAREN_R)},t.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:N.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(y.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(y.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},t.parseVariable=function(){var r=this._lexer.token;return this.expectToken(y.DOLLAR),{kind:N.VARIABLE,name:this.parseName(),loc:this.loc(r)}},t.parseSelectionSet=function(){var r=this._lexer.token;return{kind:N.SELECTION_SET,selections:this.many(y.BRACE_L,this.parseSelection,y.BRACE_R),loc:this.loc(r)}},t.parseSelection=function(){return this.peek(y.SPREAD)?this.parseFragment():this.parseField()},t.parseField=function(){var r=this._lexer.token,i=this.parseName(),s,o;return this.expectOptionalToken(y.COLON)?(s=i,o=this.parseName()):o=i,{kind:N.FIELD,alias:s,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(y.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},t.parseArguments=function(r){var i=r?this.parseConstArgument:this.parseArgument;return this.optionalMany(y.PAREN_L,i,y.PAREN_R)},t.parseArgument=function(){var r=this._lexer.token,i=this.parseName();return this.expectToken(y.COLON),{kind:N.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(r)}
vendor: 9,579 bytes, line 18
18},t.parseConstArgument=function(){var r=this._lexer.token;return{kind:N.ARGUMENT,name:this.parseName(),value:(this.expectToken(y.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},t.parseFragment=function(){var r=this._lexer.token;this.expectToken(y.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(y.NAME)?{kind:N.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:N.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},t.parseFragmentDefinition=function(){var r,i=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:N.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:N.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},t.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},t.parseValueLiteral=function(r){var i=this._lexer.token;switch(i.kind){case y.BRACKET_L:return this.parseList(r);case y.BRACE_L:return this.parseObject(r);case y.INT:return this._lexer.advance(),{kind:N.INT,value:i.value,loc:this.loc(i)};case y.FLOAT:return this._lexer.advance(),{kind:N.FLOAT,value:i.value,loc:this.loc(i)};case y.STRING:case y.BLOCK_STRING:return this.parseStringLiteral();case y.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:N.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:N.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:N.NULL,loc:this.loc(i)};default:return{kind:N.ENUM,value:i.value,loc:this.loc(i)}}case y.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},t.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:N.STRING,value:r.value,block:r.kind===y.BLOCK_STRING,loc:this.loc(r)}},t.parseList=function(r){var i=this,s=this._lexer.token,o=function(){return i.parseValueLiteral(r)};return{kind:N.LIST,values:this.any(y.BRACKET_L,o,y.BRACKET_R),loc:this.loc(s)}},t.parseObject=function(r){var i=this,s=this._lexer.token,o=function(){return i.parseObjectField(r)};return{kind:N.OBJECT,fields:this.any(y.BRACE_L,o,y.BRACE_R),loc:this.loc(s)}},t.parseObjectField=function(r){var i=this._lexer.token,s=this.parseName();return this.expectToken(y.COLON),{kind:N.OBJECT_FIELD,name:s,value:this.parseValueLiteral(r),loc:this.loc(i)}},t.parseDirectives=function(r){for(var i=[];this.peek(y.AT);)i.push(this.parseDirective(r));return i},t.parseDirective=function(r){var i=this._lexer.token;return this.expectToken(y.AT),{kind:N.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(i)}},t.parseTypeReference=function(){var r=this._lexer.token,i;return this.expectOptionalToken(y.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(y.BRACKET_R),i={kind:N.LIST_TYPE,type:i,loc:this.loc(r)}):i=this.parseNamedType(),this.expectOptionalToken(y.BANG)?{kind:N.NON_NULL_TYPE,type:i,loc:this.loc(r)}:i},t.parseNamedType=function(){var r=this._lexer.token;return{kind:N.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},t.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===y.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},t.peekDescription=function(){return this.peek(y.STRING)||this.peek(y.BLOCK_STRING)},t.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},t.parseSchemaDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var s=this.parseDirectives(!0),o=this.many(y.BRACE_L,this.parseOperationTypeDefinition,y.BRACE_R);return{kind:N.SCHEMA_DEFINITION,description:i,directives:s,operationTypes:o,loc:this.loc(r)}},t.parseOperationTypeDefinition=function(){var r=this._lexer.token,i=this.parseOperationType();this.expectToken(y.COLON);var s=this.parseNamedType();return{kind:N.OPERATION_TYPE_DEFINITION,operation:i,type:s,loc:this.loc(r)}},t.parseScalarTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var s=this.parseName(),o=this.parseDirectives(!0);return{kind:N.SCALAR_TYPE_DEFINITION,description:i,name:s,directives:o,loc:this.loc(r)}},t.parseObjectTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var s=this.parseName(),o=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:N.OBJECT_TYPE_DEFINITION,description:i,name:s,interfaces:o,directives:a,fields:c,loc:this.loc(r)}},t.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(y.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(y.AMP)||this.peek(y.NAME));return i}return this.delimitedMany(y.AMP,this.parseNamedType)},t.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek(y.BRACE_L)&&this._lexer.lookahead().kind===y.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(y.BRACE_L,this.parseFieldDefinition,y.BRACE_R)},t.parseFieldDefinition=function(){var r=this._lexer.token,i=this.parseDescription(),s=this.parseName(),o=this.parseArgumentDefs();this.expectToken(y.COLON);var a=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:N.FIELD_DEFINITION,description:i,name:s,arguments:o,type:a,directives:c,loc:this.loc(r)}},t.parseArgumentDefs=function(){return this.optionalMany(y.PAREN_L,this.parseInputValueDef,y.PAREN_R)},t.parseInputValueDef=function(){var r=this._lexer.token,i=this.parseDescription(),s=this.parseName();this.expectToken(y.COLON);var o=this.parseTypeReference(),a;this.expectOptionalToken(y.EQUALS)&&(a=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:N.INPUT_VALUE_DEFINITION,description:i,name:s,type:o,defaultValue:a,directives:c,loc:this.loc(r)}},t.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var s=this.parseName(),o=this.parseImplementsInterfaces(),a=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:N.INTERFACE_TYPE_DEFINITION,description:i,name:s,interfaces:o,directives:a,fields:c,loc:this.loc(r)}},t.parseUnionTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var s=this.parseName(),o=this.parseDirectives(!0),a=this.parseUnionMemberTypes();return{kind:N.UNION_TYPE_DEFINITION,description:i,name:s,directives:o,types:a,loc:this.loc(r)}},t.parseUnionMemberTypes=function(){return this.expectOptionalToken(y.EQUALS)?this.delimitedMany(y.PIPE,this.parseNamedType):[]},t.parseEnumTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var s=this.parseName(),o=this.parseDirectives(!0),a=this.parseEnumValuesDefinition();return{kind:N.ENUM_TYPE_DEFINITION,description:i,name:s,directives:o,values:a,loc:this.loc(r)}},t.parseEnumValuesDefinition=function(){return this.optionalMany(y.BRACE_L,this.parseEnumValueDefinition,y.BRACE_R)},t.parseEnumValueDefinition=function(){var r=this._lexer.token,i=this.parseDescription(),s=this.parseName(),o=this.parseDirectives(!0);return{kind:N.ENUM_VALUE_DEFINITION,description:i,name:s,directives:o,loc:this.loc(r)}},t.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var s=this.parseName(),o=this.parseDirectives(!0),a=this.parseInputFieldsDefinition();return{kind:N.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:s,directives:o,fields:a,loc:this.loc(r)}},t.parseInputFieldsDefinition=function(){return this.optionalMany(y.BRACE_L,this.parseInputValueDef,y.BRACE_R)},t.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===y.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},t.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),s=this.optionalMany(y.BRACE_L,this.parseOperationTypeDefinition,y.BRACE_R);if(i.length===0&&s.length===0)throw this.unexpected();return{kind:N.SCHEMA_EXTENSION,directives:i,operationTypes:s,loc:this.loc(r)}
vendor: 9,822 bytes, lines 18-24
18},t.parseScalarTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),s=this.parseDirectives(!0);if(s.length===0)throw this.unexpected();return{kind:N.SCALAR_TYPE_EXTENSION,name:i,directives:s,loc:this.loc(r)}},t.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(s.length===0&&o.length===0&&a.length===0)throw this.unexpected();return{kind:N.OBJECT_TYPE_EXTENSION,name:i,interfaces:s,directives:o,fields:a,loc:this.loc(r)}},t.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),a=this.parseFieldsDefinition();if(s.length===0&&o.length===0&&a.length===0)throw this.unexpected();return{kind:N.INTERFACE_TYPE_EXTENSION,name:i,interfaces:s,directives:o,fields:a,loc:this.loc(r)}},t.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(s.length===0&&o.length===0)throw this.unexpected();return{kind:N.UNION_TYPE_EXTENSION,name:i,directives:s,types:o,loc:this.loc(r)}},t.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(s.length===0&&o.length===0)throw this.unexpected();return{kind:N.ENUM_TYPE_EXTENSION,name:i,directives:s,values:o,loc:this.loc(r)}},t.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(s.length===0&&o.length===0)throw this.unexpected();return{kind:N.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:s,fields:o,loc:this.loc(r)}},t.parseDirectiveDefinition=function(){var r=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(y.AT);var s=this.parseName(),o=this.parseArgumentDefs(),a=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:N.DIRECTIVE_DEFINITION,description:i,name:s,arguments:o,repeatable:a,locations:c,loc:this.loc(r)}},t.parseDirectiveLocations=function(){return this.delimitedMany(y.PIPE,this.parseDirectiveLocation)},t.parseDirectiveLocation=function(){var r=this._lexer.token,i=this.parseName();if(ys[i.value]!==void 0)return i;throw this.unexpected(r)},t.loc=function(r){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Zn(r,this._lexer.lastToken,this._lexer.source)},t.peek=function(r){return this._lexer.token.kind===r},t.expectToken=function(r){var i=this._lexer.token;if(i.kind===r)return this._lexer.advance(),i;throw $(this._lexer.source,i.start,"Expected ".concat(rr(r),", found ").concat(ut(i),"."))},t.expectOptionalToken=function(r){var i=this._lexer.token;if(i.kind===r)return this._lexer.advance(),i},t.expectKeyword=function(r){var i=this._lexer.token;if(i.kind===y.NAME&&i.value===r)this._lexer.advance();else throw $(this._lexer.source,i.start,'Expected "'.concat(r,'", found ').concat(ut(i),"."))},t.expectOptionalKeyword=function(r){var i=this._lexer.token;return i.kind===y.NAME&&i.value===r?(this._lexer.advance(),!0):!1},t.unexpected=function(r){var i=r??this._lexer.token;return $(this._lexer.source,i.start,"Unexpected ".concat(ut(i),"."))},t.any=function(r,i,s){this.expectToken(r);for(var o=[];!this.expectOptionalToken(s);)o.push(i.call(this));return o},t.optionalMany=function(r,i,s){if(this.expectOptionalToken(r)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(s));return o}return[]},t.many=function(r,i,s){this.expectToken(r);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(s));return o},t.delimitedMany=function(r,i){this.expectOptionalToken(r);var s=[];do s.push(i.call(this));while(this.expectOptionalToken(r));return s},e}();function ut(e){var t=e.value;return rr(e.kind)+(t!=null?' "'.concat(t,'"'):"")}function rr(e){return bs(e)?'"'.concat(e,'"'):e}var Ds={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Rs=Object.freeze({});function xs(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ds,r=void 0,i=Array.isArray(e),s=[e],o=-1,a=[],c=void 0,u=void 0,l=void 0,f=[],p=[],d=e;do{o++;var h=o===s.length,m=h&&a.length!==0;if(h){if(u=p.length===0?void 0:f[f.length-1],c=l,l=p.pop(),m){if(i)c=c.slice();else{for(var v={},g=0,T=Object.keys(c);g<T.length;g++){var S=T[g];v[S]=c[S]}c=v}for(var A=0,b=0;b<a.length;b++){var k=a[b][0],w=a[b][1];i&&(k-=A),i&&w===null?(c.splice(k,1),A++):c[k]=w}}o=r.index,s=r.keys,a=r.edits,i=r.inArray,r=r.prev}else{if(u=l?i?o:s[o]:void 0,c=l?l[u]:d,c==null)continue;l&&f.push(u)}var I=void 0;if(!Array.isArray(c)){if(!qt(c))throw new Error("Invalid AST Node: ".concat(tr(c),"."));var C=Ls(t,c.kind,h);if(C){if(I=C.call(t,c,u,l,f,p),I===Rs)break;if(I===!1){if(!h){f.pop();continue}}else if(I!==void 0&&(a.push([u,I]),!h))if(qt(I))c=I;else{f.pop();continue}}}if(I===void 0&&m&&a.push([u,c]),h)f.pop();else{var M;r={inArray:i,index:o,keys:s,edits:a,prev:r},i=Array.isArray(c),s=i?c:(M=n[c.kind])!==null&&M!==void 0?M:[],o=-1,a=[],l&&p.push(l),l=c}}while(r!==void 0);return a.length!==0&&(d=a[a.length-1][1]),d}function Ls(e,t,n){var r=e[t];if(r){if(!n&&typeof r=="function")return r;var i=n?r.leave:r.enter;if(typeof i=="function")return i}else{var s=n?e.leave:e.enter;if(s){if(typeof s=="function")return s;var o=s[t];if(typeof o=="function")return o}}}function ve(e){return xs(e,{leave:Ms})}var Ps=80,Ms={Name:function(t){return t.value},Variable:function(t){return"$"+t.name},Document:function(t){return E(t.definitions,`
19
20`)+`
21`},OperationDefinition:function(t){var n=t.operation,r=t.name,i=D("(",E(t.variableDefinitions,", "),")"),s=E(t.directives," "),o=t.selectionSet;return!r&&!s&&!i&&n==="query"?o:E([n,E([r,i]),s,o]," ")},VariableDefinition:function(t){var n=t.variable,r=t.type,i=t.defaultValue,s=t.directives;return n+": "+r+D(" = ",i)+D(" ",E(s," "))},SelectionSet:function(t){var n=t.selections;return q(n)},Field:function(t){var n=t.alias,r=t.name,i=t.arguments,s=t.directives,o=t.selectionSet,a=D("",n,": ")+r,c=a+D("(",E(i,", "),")");return c.length>Ps&&(c=a+D(`(
22`,Ke(E(i,`
23`)),`
24)`)),E([c,E(s," "),o]," ")},Argument:function(t){var n=t.name,r=t.value;return n+": "+r},FragmentSpread:function(t){var n=t.name,r=t.directives;return"..."+n+D(" ",E(r," "))},InlineFragment:function(t){var n=t.typeCondition,r=t.directives,i=t.selectionSet;return E(["...",D("on ",n),E(r," "),i]," ")},FragmentDefinition:function(t){var n=t.name,r=t.typeCondition,i=t.variableDefinitions,s=t.directives,o=t.selectionSet;return"fragment ".concat(n).concat(D("(",E(i,", "),")")," ")+"on ".concat(r," ").concat(D("",E(s," ")," "))+o},IntValue:function(t){var n=t.value;return n},FloatValue:function(t){var n=t.value;return n},StringValue:function(t,n){var r=t.value,i=t.block;return i?Es(r,n==="description"?"":"  "):JSON.stringify(r)},BooleanValue:function(t){var n=t.value;return n?"true":"false"},NullValue:function(){return"null"},EnumValue:function(t){var n=t.value;return n},ListValue:function(t){var n=t.values;return"["+E(n,", ")+"]"},ObjectValue:function(t){var n=t.fields;return"{"+E(n,", ")+"}"},ObjectField:function(t){var n=t.name,r=t.value;return n+": "+r},Directive:function(t){var n=t.name,r=t.arguments;return"@"+n+D("(",E(r,", "),")")},NamedType:function(t){var n=t.name;return n},ListType:function(t){var n=t.type;return"["+n+"]"},NonNullType:function(t){var n=t.type;return n+"!"},SchemaDefinition:G(function(e){var t=e.directives,n=e.operationTypes;return E(["schema",E(t," "),q(n)]," ")}
24),OperationTypeDefinition:function(t){var n=t.operation,r=t.type;return n+": "+r},ScalarTypeDefinition:G(function(e){var t=e.name,n=e.directives;return E(["scalar",t,E(n," ")]," ")}),ObjectTypeDefinition:G(function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return E(["type",t,D("implements ",E(n," & ")),E(r," "),q(i)]," ")}),FieldDefinition:G(function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(Qt(n)?D(`(
25`,Ke(E(n,`
26`)),`
27)`):D("(",E(n,", "),")"))+": "+r+D(" ",E(i," "))}),InputValueDefinition:G(function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return E([t+": "+n,D("= ",r),E(i," ")]," ")}),InterfaceTypeDefinition:G(function(e){var t=e.name,n=e.interfaces,r=e.directives,i=e.fields;return E(["interface",t,D("implements ",E(n," & ")),E(r," "),q(i)]," ")}),UnionTypeDefinition:G(function(e){var t=e.name,n=e.directives,r=e.types;return E(["union",t,E(n," "),r&&r.length!==0?"= "+E(r," | "):""]," ")}),EnumTypeDefinition:G(function(e){var t=e.name,n=e.directives,r=e.values;return E(["enum",t,E(n," "),q(r)]," ")}),EnumValueDefinition:G(function(e){var t=e.name,n=e.directives;return E([t,E(n," ")]," ")}),InputObjectTypeDefinition:G(function(e){var t=e.name,n=e.directives,r=e.fields;return E(["input",t,E(n," "),q(r)]," ")}),DirectiveDefinition:G(function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(Qt(n)?D(`(
28`,Ke(E(n,`
29`)),`
30)`):D("(",E(n,", "),")"))+(r?" repeatable":"")+" on "+E(i," | ")}),SchemaExtension:function(t){var n=t.directives,r=t.operationTypes;return E(["extend schema",E(n," "),q(r)]," ")},ScalarTypeExtension:function(t){var n=t.name,r=t.directives;return E(["extend scalar",n,E(r," ")]," ")},ObjectTypeExtension:function(t){var n=t.name,r=t.interfaces,i=t.directives,s=t.fields;return E(["extend type",n,D("implements ",E(r," & ")),E(i," "),q(s)]," ")},InterfaceTypeExtension:function(t){var n=t.name,r=t.interfaces,i=t.directives,s=t.fields;return E(["extend interface",n,D("implements ",E(r," & ")),E(i," "),q(s)]," ")},UnionTypeExtension:function(t){var n=t.name,r=t.directives,i=t.types;return E(["extend union",n,E(r," "),i&&i.length!==0?"= "+E(i," | "):""]," ")},EnumTypeExtension:function(t){var n=t.name,r=t.directives,i=t.values;return E(["extend enum",n,E(r," "),q(i)]," ")},InputObjectTypeExtension:function(t){var n=t.name,r=t.directives,i=t.fields;return E(["extend input",n,E(r," "),q(i)]," ")}};function G(e){return function(t){return E([t.description,e(t)],`
31`)}}function E(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(t=e?.filter(function(r){return r}).join(n))!==null&&t!==void 0?t:""}function q(e){return D(`{
32`,Ke(E(e,`
33`)),`
34}`)}function D(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return t!=null&&t!==""?e+t+n:""}function Ke(e){return D("  ",e.replace(/\n/g,`
35  `))}function Fs(e){return e.indexOf(`
36`)!==-1}function Qt(e){return e!=null&&e.some(Fs)}class ke extends Ge{constructor(t){super(t),this.constructor=ke,Object.setPrototypeOf(this,ke.prototype)}}class we extends ke{constructor(t={}){super({name:"CanceledError",message:"Request is canceled by user",...t}),this.constructor=we,Object.setPrototypeOf(this,we.prototype)}}const Us=e=>!!e&&e instanceof we;var gt;(function(e){e.InvalidApiName="InvalidApiName"})(gt||(gt={}));gt.InvalidApiName+"";const ir=async e=>{if(!e)return;const t=await Dr(js(e));if(t){const n=await e.body?.text();return Ks(t,{statusCode:e.statusCode,headers:e.headers,body:n})}},js=e=>{let t;const n=new Proxy(e.body,{get(i,s,o){return s==="json"?async()=>{t||(t=i.text());try{return JSON.parse(await t)}catch{return{}}}:s==="text"?async()=>(t||(t=i.text()),t):Reflect.get(i,s,o)}});return new Proxy(e,{get(i,s,o){return s==="body"?n:Reflect.get(i,s,o)}})},Ks=(e,t)=>{const n=new ke({name:e?.name,message:e.message,underlyingError:e,response:t});return Object.assign(n,{$metadata:e.$metadata})},bt=new Ie("RestApis");function Bs(e,t,n,r){const i=t.signal;return(async()=>{try{const o=await e();if(o.statusCode>=300)throw await ir(o);return o}catch(o){if(o.name==="AbortError"||i?.aborted===!0){const a=i.reason,c=new we({...a&&{message:a},underlyingError:o,recoverySuggestion:"The API request was explicitly canceled. If this is not intended, validate if you called the `cancel()` function on the API request erroneously."});throw bt.debug(c),c}throw bt.debug(o),o}})()}const Wt="execute-api",$s="us-east-1",Vs=/^.+\.([a-z0-9-]+)\.([a-z0-9-]+)\.amazonaws\.com/,Gs=(e,t)=>{const{service:n=Wt,region:r=$s}={},{hostname:i}=e,[,s,o]=Vs.exec(i)??[];return s===Wt?{service:s,region:o??r}:s==="appsync-api"?{service:"appsync",region:o??r}:{service:n,region:r}},qs=({headers:e},t)=>!e.authorization&&!e["x-api-key"]&&!!t,Hs=e=>{const t=e.libraryOptions?.API?.REST?.retryStrategy,n=e.libraryOptions?.API?.REST?.defaultAuthMode;return{retryStrategy:t,defaultAuthMode:n}},Qs=(e,t)=>{const n={};for(const r in e)n[r.toLowerCase()]=e[r];if(t){const r=n["content-type"];r&&(r.startsWith("application/json")||r.startsWith("application/")&&r.includes("+json"))||(n["content-type"]="application/json; charset=UTF-8"),t instanceof FormData&&delete n["content-type"]}return n},Ws=vn(bn,[En,gn,Bi]),zs=vn(bn,[En,gn]),Ys=async(e,t,n,r)=>
36{const{url:i,method:s,headers:o,body:a,withCredentials:c,abortSignal:u,retryStrategy:l}=t,f=a?a instanceof FormData?a:JSON.stringify(a??""):void 0,p=Qs(o,a),d={url:i,headers:p,method:s,body:f},{retryStrategy:h,defaultAuthMode:m}=Hs(e),v={retryDecider:Js(l??h),computeDelay:Rr,withCrossDomainCredentials:c,abortSignal:u},g=t.defaultAuthMode??m;let T=null;g!=="none"&&(T=await Xs(e));let S;if(n(d,r)&&T){const b=Gs(i),k=r?.service??b.service,w=r?.region??b.region;S=await Ws(d,{...v,credentials:T,region:w,service:k})}else S=await zs(d,{...v});return{statusCode:S.statusCode,headers:S.headers,body:S.body}},Js=e=>e?.strategy==="no-retry"?()=>Promise.resolve({retryable:!1}):xr(ir),Xs=async e=>{try{const{credentials:t}=await e.Auth.fetchAuthSession();if(t)return t}catch{bt.debug("No credentials available, the request will be unsigned.")}return null},_t=new WeakMap,Zs=(e,{url:t,options:n,abortController:r})=>{const i=r??new AbortController,o=Bs(async()=>Ys(e,{url:t,method:"POST",...n,abortSignal:i.signal,retryStrategy:{strategy:"jittered-exponential-backoff"}},qs,n?.signingServiceInfo),i).finally(()=>{_t.delete(o)});return o},eo=(e,t)=>{const n=_t.get(e);return n?(n.abort(t),t&&n.signal.reason!==t&&(n.signal.reason=t),!0):!1},to=(e,t)=>{_t.set(e,t)},no=5e3,ro=[400,401,403],io=["BadRequestException","UnauthorizedException"],so="ConnectionStateChange";var K;(function(e){e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_START="start",e.GQL_START_ACK="start_ack",e.DATA="data",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_STOP="stop",e.GQL_COMPLETE="complete",e.GQL_ERROR="error",e.EVENT_SUBSCRIBE="subscribe",e.EVENT_PUBLISH="publish",e.EVENT_SUBSCRIBE_ACK="subscribe_success",e.EVENT_PUBLISH_ACK="publish_success",e.EVENT_STOP="unsubscribe",e.EVENT_COMPLETE="unsubscribe_success",e.EVENT_SUBSCRIBE_ERROR="subscribe_error"})(K||(K={}));var Y;(function(e){e[e.PENDING=0]="PENDING",e[e.CONNECTED=1]="CONNECTED",e[e.FAILED=2]="FAILED"})(Y||(Y={}));var j;(function(e){e[e.CLOSED=0]="CLOSED",e[e.READY=1]="READY",e[e.CONNECTING=2]="CONNECTING"})(j||(j={}));const oo={accept:"application/json, text/javascript","content-encoding":"amz-1.0","content-type":"application/json; charset=UTF-8"},zt=15e3,ao=15e3,co=5*60*1e3,uo=5*1e3,lo=65*1e3,fo=5*1e3,po=60*1e3;var H;(function(e){e.CONNECTION_CLOSED="Connection closed",e.CONNECTION_FAILED="Connection failed",e.REALTIME_SUBSCRIPTION_INIT_ERROR="AppSync Realtime subscription init error",e.SUBSCRIPTION_ACK="Subscription ack",e.TIMEOUT_DISCONNECT="Timeout disconnect"})(H||(H={}));var F;(function(e){e.Connected="Connected",e.ConnectedPendingNetwork="ConnectedPendingNetwork",e.ConnectionDisrupted="ConnectionDisrupted",e.ConnectionDisruptedPendingNetwork="ConnectionDisruptedPendingNetwork",e.Connecting="Connecting",e.ConnectedPendingDisconnect="ConnectedPendingDisconnect",e.Disconnected="Disconnected",e.ConnectedPendingKeepAlive="ConnectedPendingKeepAlive"})(F||(F={}));const Yt=()=>new ue().networkMonitor(),V={KEEP_ALIVE_MISSED:{keepAliveState:"unhealthy"},KEEP_ALIVE:{keepAliveState:"healthy"},CONNECTION_ESTABLISHED:{connectionState:"connected"},CONNECTION_FAILED:{intendedConnectionState:"disconnected",connectionState:"disconnected"},CLOSING_CONNECTION:{intendedConnectionState:"disconnected"},OPENING_CONNECTION:{intendedConnectionState:"connected",connectionState:"connecting"},CLOSED:{connectionState:"disconnected"},ONLINE:{networkState:"connected"},OFFLINE:{networkState:"disconnected"}};class ho{constructor(){this._networkMonitoringSubscription=void 0,this._linkedConnectionState={networkState:"connected",connectionState:"disconnected",intendedConnectionState:"disconnected",keepAliveState:"healthy"},this._initialNetworkStateSubscription=Yt().subscribe(({online:t})=>{this.record(t?V.ONLINE:V.OFFLINE),this._initialNetworkStateSubscription?.unsubscribe()}),this._linkedConnectionStateObservable=new B(t=>{t.next(this._linkedConnectionState),this._linkedConnectionStateObserver=t})}enableNetworkMonitoring(){this._initialNetworkStateSubscription?.unsubscribe(),this._networkMonitoringSubscription===void 0&&(this._networkMonitoringSubscription=Yt().subscribe(({online:t})=>{this.record(t?V.ONLINE:V.OFFLINE)}))}disableNetworkMonitoring(){this._networkMonitoringSubscription?.unsubscribe(),this._networkMonitoringSubscription=void 0}get connectionStateObservable(){let t;return this._linkedConnectionStateObservable.pipe(Ct(n=>this.connectionStatesTranslator(n))).pipe(pi(n=>{const r=n!==t;return t=n,r}))}record(t){t.intendedConnectionState==="connected"?this.enableNetworkMonitoring():t.intendedConnectionState==="disconnected"&&this.disableNetworkMonitoring();const n={...this._linkedConnectionState,...t};this._linkedConnectionState={...n},this._linkedConnectionStateObserver?.next(this._linkedConnectionState)}connectionStatesTranslator({connectionState:t,networkState:n,intendedConnectionState:r,keepAliveState:i}){return t==="connected"&&n==="disconnected"?F.ConnectedPendingNetwork:t==="connected"&&r==="disconnected"?F.ConnectedPendingDisconnect:t==="disconnected"&&r==="connected"&&n==="disconnected"?F.ConnectionDisruptedPendingNetwork:t==="disconnected"&&r==="connected"?F.ConnectionDisrupted:t==="connected"&&i==="unhealthy"?F.ConnectedPendingKeepAlive:t==="connecting"?F.Connecting:t==="disconnected"?F.Disconnected:F.Connected}}var de;(function(e){e.START_RECONNECT="START_RECONNECT",e.HALT_RECONNECT="HALT_RECONNECT"})(de||(de={}));class yo{constructor(){this.reconnectObservers=[]}addObserver(t){this.reconnectObservers.push(t)}record(t){t===de.START_RECONNECT&&this.reconnectSetTimeoutId===void 0&&this.reconnectIntervalId===void 0&&(this.reconnectSetTimeoutId=setTimeout(()=>{this._triggerReconnect(),this.reconnectIntervalId=setInterval(()=>{this._triggerReconnect()},po)},fo)),t===de.HALT_RECONNECT&&(this.reconnectIntervalId&&(clearInterval(this.reconnectIntervalId),this.reconnectIntervalId=void 0),this.reconnectSetTimeoutId&&(clearTimeout(this.reconnectSetTimeoutId),this.reconnectSetTimeoutId=void 0))}
36close(){this.reconnectObservers.forEach(t=>{t.complete?.()})}_triggerReconnect(){this.reconnectObservers.forEach(t=>{t.next?.()})}}const Jt="wss://",mo=/^https:\/\/\w{26}\.appsync-api\.\w{2}(?:(?:-\w{2,})+)-\d\.amazonaws.com(?:\.cn)?\/graphql$/i,vo=/^https:\/\/\w{26}\.\w+-api\.\w{2}(?:(?:-\w{2,})+)-\d\.amazonaws.com(?:\.cn)?\/event$/i,Xt="/realtime",Eo=e=>e.match(mo)===null,go=e=>e.match(vo)!==null,bo=e=>{let t=e??"";return go(t)?t=t.concat(Xt).replace("ddpg-api","grt-gamma").replace("appsync-api","appsync-realtime-api"):Eo(t)?t=t.concat(Xt):t=t.replace("appsync-api","appsync-realtime-api").replace("gogi-beta","grt-beta").replace("ddpg-api","grt-gamma"),t=t.replace("https://",Jt).replace("http://",Jt),new Ne(t)},To=e=>{if(!e)return{};if("Authorization"in e){const{Authorization:t,...n}=e;return n}return e},So=e=>{const t=To(e),n=new Tn;return Object.entries(t).forEach(([r,i])=>{n.append(r,i)}),n},No=(e,t)=>{const n=bo(e),r=new Tn(n.search);for(const[i,s]of t.entries())r.append(i,s);return n.search=r.toString(),n.toString()},lt=async e=>{const{appSyncGraphqlEndpoint:t,query:n,libraryConfigHeaders:r=()=>({}),additionalHeaders:i={},authToken:s}=e;let o={};const a=await r();return typeof i=="function"?o=await i({url:t||"",queryString:n||""}):o=i,s&&(o={...o,Authorization:s}),{additionalCustomHeaders:o,libraryConfigHeaders:a}},Zt=new Ie("AWSAppSyncRealTimeProvider Auth"),en=async({host:e})=>({Authorization:(await Bn())?.tokens?.accessToken?.toString(),host:e}),Oo=async({apiKey:e,host:t})=>{const r=new Date().toISOString().replace(/[:-]|\.\d{3}/g,"");return{host:t,"x-amz-date":r,"x-api-key":e}},Ao=async({payload:e,canonicalUri:t,appSyncGraphqlEndpoint:n,region:r})=>{const i={region:r,service:"appsync"},s=(await Bn()).credentials,o={url:`${n}${t}`,data:e,method:"POST",headers:{...oo}};return Hn({headers:o.headers,method:o.method,url:new Ne(o.url),body:o.data},{credentials:s,signingRegion:i.region,signingService:i.service}).headers},tn=async({host:e,additionalCustomHeaders:t})=>{if(!t?.Authorization)throw new Error("No auth token specified");return{Authorization:t.Authorization,host:e}},sr=async({apiKey:e,authenticationType:t,canonicalUri:n,appSyncGraphqlEndpoint:r,region:i,additionalCustomHeaders:s,payload:o})=>{const a={apiKey:Oo,iam:Ao,oidc:en,userPool:en,lambda:tn,none:tn};if(!t||!a[t]){Zt.debug(`Authentication type ${t} not supported`);return}else{const c=a[t],u=r?new Ne(r).host:void 0,l=t==="apiKey"?e:void 0;return Zt.debug(`Authenticating with ${JSON.stringify(t)}`),await c({payload:o,canonicalUri:n,appSyncGraphqlEndpoint:r,apiKey:l,region:i,host:u,additionalCustomHeaders:s})}},nn=e=>{Sn.dispatch("api",e,"PubSub",Pr)};class ko{constructor(t){this.subscriptionObserverMap=new Map,this.allowNoSubscriptions=!1,this.socketStatus=j.CLOSED,this.keepAliveTimestamp=Date.now(),this.promiseArray=[],this.connectionStateMonitor=new ho,this.reconnectionMonitor=new yo,this._establishConnection=async(n,r)=>{this.logger.debug(`Establishing WebSocket connection to ${n}`);try{await this._openConnection(n,r),await this._initiateHandshake()}catch(i){const{errorType:s,errorCode:o}=i;throw ro.includes(o)||io.includes(s)?new Vi(s):s?new Error(s):i}},this.logger=new Ie(t.providerName),this.wsProtocolName=t.wsProtocolName,this.wsConnectUri=t.connectUri,this.connectionStateMonitorSubscription=this._startConnectionStateMonitoring()}close(){return this.socketStatus=j.CLOSED,this.connectionStateMonitor.record(V.CONNECTION_FAILED),this.connectionStateMonitorSubscription.unsubscribe(),this.reconnectionMonitor.close(),new Promise((t,n)=>{this.awsRealTimeSocket?(this.awsRealTimeSocket.onclose=r=>{this._closeSocket(),this.subscriptionObserverMap=new Map,this.awsRealTimeSocket=void 0,t()},this.awsRealTimeSocket.onerror=r=>{n(r)},this.awsRealTimeSocket.close()):t()})}subscribe(t,n){return new B(r=>{if(!t?.appSyncGraphqlEndpoint){r.error({errors:[{...new Te("Subscribe only available for AWS AppSync endpoint")}]}),r.complete();return}let i=!1;const s=Mt(),o=()=>{i||(i=!0,this._startSubscriptionWithAWSAppSyncRealTime({options:t,observer:r,subscriptionId:s,customUserAgentDetails:n}).catch(c=>{this.logger.debug(`${H.REALTIME_SUBSCRIPTION_INIT_ERROR}: ${c}`),this._closeSocket()}).finally(()=>{i=!1}))},a=new B(c=>{this.reconnectionMonitor.addObserver(c)}).subscribe(()=>{o()});return o(),async()=>{await this._cleanupSubscription(s,a)}})}async connect(t){this.socketStatus!==j.READY&&await this._connectWebSocket(t)}async publish(t,n){if(this.socketStatus!==j.READY)throw new Error("Subscription has not been initialized");return this._publishMessage(t,n)}async _connectWebSocket(t){const{apiKey:n,appSyncGraphqlEndpoint:r,authenticationType:i,region:s}=t,{additionalCustomHeaders:o}=await lt(t);this.connectionStateMonitor.record(V.OPENING_CONNECTION),await this._initializeWebSocketConnection({apiKey:n,appSyncGraphqlEndpoint:r,authenticationType:i,region:s,additionalCustomHeaders:o})}async _publishMessage(t,n){const r=Mt(),{additionalCustomHeaders:i,libraryConfigHeaders:s}=await lt(t),o=await this._prepareSubscriptionPayload({options:t,subscriptionId:r,customUserAgentDetails:n,additionalCustomHeaders:i,libraryConfigHeaders:s,publish:!0});return new Promise((a,c)=>{if(this.awsRealTimeSocket){const u=d=>{const h=JSON.parse(d.data);if(h.id===r&&h.type==="publish_success"&&(this.awsRealTimeSocket&&this.awsRealTimeSocket.removeEventListener("message",u),p(),a()),h.errors&&h.errors.length>0){const m=h.errors.map(v=>v.errorType);p(),c(new Error(`Publish errors: ${m.join(", ")}`))}},l=d=>{p(),c(new Error(`WebSocket error: ${d}`))},f=()=>{p(),c(new Error("WebSocket is closed"))},p=()=>{this.awsRealTimeSocket?.removeEventListener("message",u),this.awsRealTimeSocket?.removeEventListener("error",l),this.awsRealTimeSocket?.removeEventListener("close",f)};this.awsRealTimeSocket.addEventListener("message",u),this.awsRealTimeSocket.addEventListener("error",l),this.awsRealTimeSocket.addEventListener("close",f),this.awsRealTimeSocket.send(o)}else c(new Error("WebSocket is not connected"))})}async _cleanupSubscription(t,n){n?.unsubscribe();try{await this._waitForSubscriptionToBeConnected(t);const{subscriptionState:r}=this.subscriptionObserverMap.get(t)||{};if(!r)return;if(r===Y.CONNECTED)this._sendUnsubscriptionMessage(t);else throw new Error("Subscription never connected")}catch(r){this.logger.debug(`Error while unsubscribing ${r}`)}finally{this._removeSubscriptionObserver(t)}}_startConnectionStateMonitoring(){return this.connectionStateMonitor.connectionStateObservable.subscribe(t=>{nn({event:so,data:{provider:this,connectionState:t},message:`Connection state is ${t}`}),this.connectionState=t,t===F.ConnectionDisrupted&&this.reconnectionMonitor.record(de.START_RECONNECT),[F.Connected,F.ConnectedPendingDisconnect,F.ConnectedPendingKeepAlive,F.ConnectedPendingNetwork,F.ConnectionDisruptedPendingNetwork,F.Disconnected].includes(t)&&this.reconnectionMonitor.record(de.HALT_RECONNECT)})}async _startSubscriptionWithAWSAppSyncRealTime({options:t,observer:n,subscriptionId:r,customUserAgentDetails:i}
36){const{query:s,variables:o}=t;this.subscriptionObserverMap.set(r,{observer:n,query:s??"",variables:o??{},subscriptionState:Y.PENDING,startAckTimeoutId:void 0});const{additionalCustomHeaders:a,libraryConfigHeaders:c}=await lt(t),u=await this._prepareSubscriptionPayload({options:t,subscriptionId:r,customUserAgentDetails:i,additionalCustomHeaders:a,libraryConfigHeaders:c});try{await this._connectWebSocket(t)}catch(p){this._logStartSubscriptionError(r,n,p);return}const{subscriptionFailedCallback:l,subscriptionReadyCallback:f}=this.subscriptionObserverMap.get(r)??{};this.subscriptionObserverMap.set(r,{observer:n,subscriptionState:Y.PENDING,query:s??"",variables:o??{},subscriptionReadyCallback:f,subscriptionFailedCallback:l,startAckTimeoutId:setTimeout(()=>{this._timeoutStartSubscriptionAck(r)},ao)}),this.awsRealTimeSocket&&this.awsRealTimeSocket.send(u)}_logStartSubscriptionError(t,n,r){this.logger.debug({err:r});const i=String(r.message??"");if(this._closeSocket(),this.connectionState!==F.ConnectionDisruptedPendingNetwork){On(r)?n.error({errors:[{...new Te(`${H.CONNECTION_FAILED}: ${i}`)}]}):this.logger.debug(`${H.CONNECTION_FAILED}: ${i}`);const{subscriptionFailedCallback:s}=this.subscriptionObserverMap.get(t)||{};typeof s=="function"&&s()}}async _waitForSubscriptionToBeConnected(t){const n=this.subscriptionObserverMap.get(t);if(n){const{subscriptionState:r}=n;if(r===Y.PENDING)return new Promise((i,s)=>{const{observer:o,subscriptionState:a,variables:c,query:u}=n;this.subscriptionObserverMap.set(t,{observer:o,subscriptionState:a,variables:c,query:u,subscriptionReadyCallback:i,subscriptionFailedCallback:s})})}}_sendUnsubscriptionMessage(t){try{if(this.awsRealTimeSocket&&this.awsRealTimeSocket.readyState===WebSocket.OPEN&&this.socketStatus===j.READY){const n=this._unsubscribeMessage(t),r=JSON.stringify(n);this.awsRealTimeSocket.send(r)}}catch(n){this.logger.debug({err:n})}}_removeSubscriptionObserver(t){this.subscriptionObserverMap.delete(t),this.allowNoSubscriptions||setTimeout(this._closeSocketIfRequired.bind(this),1e3)}_closeSocketIfRequired(){if(!(this.subscriptionObserverMap.size>0)){if(!this.awsRealTimeSocket){this.socketStatus=j.CLOSED;return}if(this.connectionStateMonitor.record(V.CLOSING_CONNECTION),this.awsRealTimeSocket.bufferedAmount>0)setTimeout(this._closeSocketIfRequired.bind(this),1e3);else{this.logger.debug("closing WebSocket...");const t=this.awsRealTimeSocket;t.onclose=null,t.onerror=null,t.close(1e3),this.awsRealTimeSocket=void 0,this.socketStatus=j.CLOSED,this._closeSocket()}}}maintainKeepAlive(){this.keepAliveTimestamp=Date.now()}keepAliveHeartbeat(t){const n=Date.now();n-this.keepAliveTimestamp>lo?this.connectionStateMonitor.record(V.KEEP_ALIVE_MISSED):this.connectionStateMonitor.record(V.KEEP_ALIVE),n-this.keepAliveTimestamp>t&&this._errorDisconnect(H.TIMEOUT_DISCONNECT)}_handleIncomingSubscriptionMessage(t){if(typeof t.data!="string")return;const[n,r]=this._handleSubscriptionData(t);if(n){this.maintainKeepAlive();return}const{type:i,id:s,payload:o}=r,{observer:a=null,query:c="",variables:u={},startAckTimeoutId:l,subscriptionReadyCallback:f,subscriptionFailedCallback:p}=this.subscriptionObserverMap.get(s)||{};if(i===K.GQL_START_ACK||i===K.EVENT_SUBSCRIBE_ACK){this.logger.debug(`subscription ready for ${JSON.stringify({query:c,variables:u})}`),typeof f=="function"&&f(),l&&clearTimeout(l),nn({event:H.SUBSCRIPTION_ACK,data:{query:c,variables:u},message:"Connection established for subscription"});const d=Y.CONNECTED;a&&this.subscriptionObserverMap.set(s,{observer:a,query:c,variables:u,startAckTimeoutId:void 0,subscriptionState:d,subscriptionReadyCallback:f,subscriptionFailedCallback:p}),this.connectionStateMonitor.record(V.CONNECTION_ESTABLISHED);return}if(i===K.GQL_CONNECTION_KEEP_ALIVE){this.maintainKeepAlive();return}if(i===K.GQL_ERROR||i===K.EVENT_SUBSCRIBE_ERROR){const d=Y.FAILED;if(a){this.subscriptionObserverMap.set(s,{observer:a,query:c,variables:u,startAckTimeoutId:l,subscriptionReadyCallback:f,subscriptionFailedCallback:p,subscriptionState:d});let h=JSON.stringify(o??r);if(i===K.EVENT_SUBSCRIBE_ERROR){const{errors:m}=JSON.parse(String(t.data));if(Array.isArray(m)&&m.length>0){const v=m[0];h=`${v.errorType}: ${v.message}`}}this.logger.debug(`${H.CONNECTION_FAILED}: ${h}`),a.error({errors:[{...new Te(`${H.CONNECTION_FAILED}: ${h}`)}]}),l&&clearTimeout(l),typeof p=="function"&&p()}}}_errorDisconnect(t){this.logger.debug(`Disconnect error: ${t}`),this.awsRealTimeSocket&&(this._closeSocket(),this.awsRealTimeSocket.close()),this.socketStatus=j.CLOSED}_closeSocket(){this.keepAliveHeartbeatIntervalId&&(clearInterval(this.keepAliveHeartbeatIntervalId),this.keepAliveHeartbeatIntervalId=void 0),this.connectionStateMonitor.record(V.CLOSED)}_timeoutStartSubscriptionAck(t){const n=this.subscriptionObserverMap.get(t);if(n){const{observer:r,query:i,variables:s}=n;if(!r)return;this.subscriptionObserverMap.set(t,{observer:r,query:i,variables:s,subscriptionState:Y.FAILED}),this._closeSocket(),this.logger.debug("timeoutStartSubscription",JSON.stringify({query:i,variables:s}))}}_initializeWebSocketConnection({appSyncGraphqlEndpoint:t,authenticationType:n,apiKey:r,region:i,additionalCustomHeaders:s}){if(this.socketStatus!==j.READY)return new Promise(async(o,a)=>
36{if(this.promiseArray.push({res:o,rej:a}),this.socketStatus===j.CLOSED)try{this.socketStatus=j.CONNECTING;const u=await sr({authenticationType:n,payload:"{}",canonicalUri:this.wsConnectUri,apiKey:r,appSyncGraphqlEndpoint:t,region:i,additionalCustomHeaders:s}),l=u?JSON.stringify(u):"",p=`header-${Lr.convert(l,{urlSafe:!0,skipPadding:!0})}`,d=So(s),h=No(t,d);await this._establishRetryableConnection(h,p),this.promiseArray.forEach(({res:m})=>{this.logger.debug("Notifying connection successful"),m()}),this.socketStatus=j.READY,this.promiseArray=[]}catch(c){this.logger.debug("Connection exited with",c),this.promiseArray.forEach(({rej:u})=>{u(c)}),this.promiseArray=[],this.awsRealTimeSocket&&this.awsRealTimeSocket.readyState===WebSocket.OPEN&&this.awsRealTimeSocket.close(3001),this.awsRealTimeSocket=void 0,this.socketStatus=j.CLOSED}})}async _establishRetryableConnection(t,n){this.logger.debug("Establishing retryable connection"),await Gi(this._establishConnection.bind(this),[t,n],no)}async _openConnection(t,n){return new Promise((r,i)=>{const s=this._getNewWebSocket(t,[this.wsProtocolName,n]);s.onerror=()=>{this.logger.debug("WebSocket connection error")},s.onclose=()=>{this._closeSocket(),i(new Error("Connection handshake error"))},s.onopen=()=>{this.awsRealTimeSocket=s,r()}})}_getNewWebSocket(t,n){return new WebSocket(t,n)}async _initiateHandshake(){return new Promise((t,n)=>{if(!this.awsRealTimeSocket){n(new Error("awsRealTimeSocket undefined"));return}let r=!1;this.awsRealTimeSocket.onerror=o=>{this.logger.debug(`WebSocket error ${JSON.stringify(o)}`)},this.awsRealTimeSocket.onclose=o=>{this.logger.debug(`WebSocket closed ${o.reason}`),this._closeSocket(),n(new Error(JSON.stringify(o)))},this.awsRealTimeSocket.onmessage=o=>{if(typeof o.data!="string")return;this.logger.debug(`subscription message from AWS AppSyncRealTime: ${o.data} `);const a=JSON.parse(o.data),{type:c}=a,u=this._extractConnectionTimeout(a);if(c===K.GQL_CONNECTION_ACK){r=!0,this._registerWebsocketHandlers(u),t("Connected to AWS AppSyncRealTime");return}if(c===K.GQL_CONNECTION_ERROR){const{errorType:l,errorCode:f}=this._extractErrorCodeAndType(a);n({errorType:l,errorCode:f})}};const i={type:K.GQL_CONNECTION_INIT};this.awsRealTimeSocket.send(JSON.stringify(i));const s=o=>{o||(this.connectionStateMonitor.record(V.CONNECTION_FAILED),n(new Error(`Connection timeout: ack from AWSAppSyncRealTime was not received after ${zt} ms`)))};setTimeout(()=>{s(r)},zt)})}_registerWebsocketHandlers(t){this.awsRealTimeSocket&&(this.keepAliveHeartbeatIntervalId=setInterval(()=>{this.keepAliveHeartbeat(t)},uo),this.awsRealTimeSocket.onmessage=this._handleIncomingSubscriptionMessage.bind(this),this.awsRealTimeSocket.onerror=n=>{this.logger.debug(n),this._errorDisconnect(H.CONNECTION_CLOSED)},this.awsRealTimeSocket.onclose=n=>{this.logger.debug(`WebSocket closed ${n.reason}`),this._closeSocket(),this._errorDisconnect(H.CONNECTION_CLOSED)})}}const rn="AWSAppSyncRealTimeProvider",wo="graphql-ws",Io="/connect";class Co extends ko{constructor(){super({providerName:rn,wsProtocolName:wo,connectUri:Io})}getProviderName(){return rn}subscribe(t,n){return super.subscribe(t,n)}async _prepareSubscriptionPayload({options:t,subscriptionId:n,customUserAgentDetails:r,additionalCustomHeaders:i,libraryConfigHeaders:s}){const{appSyncGraphqlEndpoint:o,authenticationType:a,query:c,variables:u,apiKey:l,region:f}=t,d=JSON.stringify({query:c,variables:u}),h={...await sr({apiKey:l,appSyncGraphqlEndpoint:o,authenticationType:a,payload:d,canonicalUri:"",region:f,additionalCustomHeaders:i}),...s,...i,[Mr]:Nn(r)},m={id:n,payload:{data:d,extensions:{authorization:{...h}}},type:K.GQL_START};return JSON.stringify(m)}_handleSubscriptionData(t){this.logger.debug(`subscription message from AWS AppSync RealTime: ${t.data}`);const{id:n="",payload:r,type:i}=JSON.parse(String(t.data)),{observer:s=null,query:o="",variables:a={}}=this.subscriptionObserverMap.get(n)||{};return this.logger.debug({id:n,observer:s,query:o,variables:a}),i===K.DATA&&r&&r.data?(s?s.next(r):this.logger.debug(`observer not found for id: ${n}`),[!0,{id:n,type:i,payload:r}]):[!1,{id:n,type:i,payload:r}]}_unsubscribeMessage(t){return{id:t,type:K.GQL_STOP}}_extractConnectionTimeout(t){const{payload:{connectionTimeoutMs:n=co}={}}=t;return n}_extractErrorCodeAndType(t){const{payload:{errors:[{errorType:n="",errorCode:r=0}={}]=[]}={}}=t;return{errorCode:r,errorType:n}}}class W extends mn{constructor(t){super(t),this.constructor=W,Object.setPrototypeOf(this,W.prototype)}}var le;
36(function(e){e.NoAuthSession="NoAuthSession",e.NoRegion="NoRegion",e.NoCustomEndpoint="NoCustomEndpoint"})(le||(le={}));const _o={[le.NoAuthSession]:{message:"Auth session should not be empty."},[le.NoRegion]:{message:"Missing region."},[le.NoCustomEndpoint]:{message:"Custom endpoint region is present without custom endpoint."}};function Do(e,t){const{message:n,recoverySuggestion:r}=_o[t];if(!e)throw new W({name:t,message:n,recoverySuggestion:r})}const Ro=new Ie("GraphQLAPI resolveConfig"),sn=e=>{const t=e.getConfig();t.API?.GraphQL||Ro.warn("The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().");const{apiKey:n,customEndpoint:r,customEndpointRegion:i,defaultAuthMode:s,endpoint:o,region:a}=t.API?.GraphQL??{};return Do(!(!r&&i),le.NoCustomEndpoint),{apiKey:n,customEndpoint:r,customEndpointRegion:i,defaultAuthMode:s,endpoint:o,region:a}},on=e=>{const t=e.libraryOptions?.API?.GraphQL?.headers,n=e.libraryOptions?.API?.GraphQL?.withCredentials;return{headers:t,withCredentials:n}};function an(e){return e.errors&&Array.isArray(e.errors)&&e.errors.forEach(t=>{xo(t)&&(t.message="Unauthorized",t.recoverySuggestion=`If you're calling an Amplify-generated API, make sure to set the "authMode" in generateClient({ authMode: '...' }) to the backend authorization rule's auth provider ('apiKey', 'userPool', 'iam', 'oidc', 'lambda')`)}),e}function xo(e){return!!(e?.originalError?.name?.startsWith("UnauthorizedException")||e.message?.startsWith("Connection failed:")&&e.message?.includes("Permission denied"))}var oe;(function(e){e.NO_API_KEY="No api-key configured",e.NO_CURRENT_USER="No current user",e.NO_CREDENTIALS="No credentials",e.NO_FEDERATED_JWT="No federated jwt",e.NO_AUTH_TOKEN="No auth token specified"})(oe||(oe={}));const or=Symbol("amplify"),Be=Symbol("authMode"),ar=Symbol("authToken"),Tt=Symbol("apiKey"),cr=Symbol("headers"),$e=Symbol("endpoint");function Dt(e){const t=e;return{amplify:t[or],apiKey:t[Tt],authMode:t[Be],authToken:t[ar],endpoint:t[$e],headers:t[cr]}}const Lo={name:"NoApiKey",message:oe.NO_API_KEY,recoverySuggestion:'The API request was made with `authMode: "apiKey"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.'},Po={name:"NoCredentials",message:oe.NO_CREDENTIALS,recoverySuggestion:'The API request was made with `authMode: "iam"` but no authentication credentials are available.\n\nIf you intended to make a request using an authenticated role, review if your user is signed in before making the request.\n\nIf you intend to make a request using an unauthenticated role or also known as "guest access", verify if "Auth.Cognito.allowGuestAccess" is set to "true" in the `Amplify.configure()` function.'},Mo={name:"NoValidAuthTokens",message:oe.NO_FEDERATED_JWT,recoverySuggestion:"If you intended to make an authenticated API request, review if the current user is signed in."},Fo={name:"NoSignedUser",message:oe.NO_CURRENT_USER,recoverySuggestion:"Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in."},Uo={name:"NoAuthorizationHeader",message:oe.NO_AUTH_TOKEN,recoverySuggestion:'The API request was made with `authMode: "lambda"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.'},jo={name:"NoEndpoint",message:"No GraphQL endpoint configured in `Amplify.configure()`.",recoverySuggestion:"Review if the GraphQL API endpoint is set in the `Amplify.configure()` function."},cn=e=>({data:{},errors:[new Te(e.message,null,null,null,null,e)]});function Ko(e){if(!e)return!1;const t=e;return Array.isArray(t.errors)&&t.errors.length>0}async function Bo(e,t,n,r={}){let i={};switch(t){case"apiKey":if(!n)throw new W(Lo);i={"X-Api-Key":n};break;case"iam":{if((await e.Auth.fetchAuthSession()).credentials===void 0)throw new W(Po);break}case"oidc":case"userPool":{let s;try{s=(await e.Auth.fetchAuthSession()).tokens?.accessToken.toString()}catch(o){throw new W({...Fo,underlyingError:o})}if(!s)throw new W(Mo);i={Authorization:s};break}case"lambda":if(typeof r=="object"&&!r.Authorization)throw new W(Uo);i={Authorization:r.Authorization};break}return i}const $o="x-amz-user-agent",Vo=e=>typeof e!="function";class Go{constructor(){this.appSyncRealTime=new Map,this._api={post:Zs,cancelREST:eo,isCancelErrorREST:Us,updateRequestToBeCancellable:to}}getModuleName(){return"InternalGraphQLAPI"}getGraphqlOperationType(t){const r=ct(t).definitions,[{operation:i}]=r;return i}graphql(t,{query:n,variables:r={},authMode:i,authToken:s,endpoint:o,apiKey:a},c,u){const l=ct(typeof n=="string"?n:ve(n)),[f={}]=l.definitions.filter(h=>h.kind==="OperationDefinition"),{operation:p}=f,d=c||{};switch(p){case"query":case"mutation":{const h=new AbortController;let m;return Vo(t)?m=this._graphql(t,{query:l,variables:r,authMode:i,apiKey:a,endpoint:o},d,h,u,s):m=t(async g=>await this._graphql(g,{query:l,variables:r,authMode:i,apiKey:a,endpoint:o},d,h,u,s)),this._api.updateRequestToBeCancellable(m,h),m}case"subscription":return this._graphqlSubscribe(t,{query:l,variables:r,authMode:i,apiKey:a,endpoint:o},d,u,s);default:throw new Error(`invalid operation type: ${p}`)}}async _graphql(t,{query:n,variables:r,authMode:i,endpoint:s,apiKey:o},a={},c,u,l){const{apiKey:f,region:p,endpoint:d,customEndpoint:h,customEndpointRegion:m,defaultAuthMode:v}=sn(t),g=i||v||"iam",T=g==="identityPool"?"iam":g,{headers:S,withCredentials:A}=on(t);let b;if(typeof a=="function"){const O={method:"POST",url:new Ne(s||h||d||"").toString(),queryString:ve(n)};b=await a(O)}
36else b=a;l&&(b={...b,Authorization:l});const k=await Bo(t,T,o??f,b),w={...!h&&k,...h&&(m?k:{})||{},...S&&await S({query:ve(n),variables:r}),...b,...!h&&{[$o]:Nn(u)}},I={query:ve(n),variables:r||null};let C;h&&!m||T!=="oidc"&&T!=="userPool"&&T!=="iam"&&T!=="lambda"?C=void 0:C={service:m?"execute-api":"appsync",region:m||p};const M=s||h||d;if(!M)throw cn(new W(jo));let _;try{const{body:O}=await this._api.post(t,{url:new Ne(M),options:{headers:w,body:I,signingServiceInfo:C,withCredentials:A},abortController:c});_=await O.json()}catch(O){if(this.isCancelError(O))throw O;_=cn(O)}if(Ko(_))throw an(_);return _}isCancelError(t){return this._api.isCancelErrorREST(t)}cancel(t,n){return this._api.cancelREST(t,n)}_graphqlSubscribe(t,{query:n,variables:r,authMode:i,apiKey:s,endpoint:o},a={},c,u){const l=sn(t),f=i||l?.defaultAuthMode||"iam",p=f==="identityPool"?"iam":f,{headers:d}=on(t),h=o??l?.endpoint,m=h??"none",v=this.appSyncRealTime.get(m)??new Co;return this.appSyncRealTime.set(m,v),v.subscribe({query:ve(n),variables:r,appSyncGraphqlEndpoint:h,region:l?.region,authenticationType:p,apiKey:s??l?.apiKey,additionalHeaders:a,authToken:u,libraryConfigHeaders:d},c).pipe(Kn(g=>{throw g.errors?an(g):g}))}}function Xe(e){const t=new Set;for(const n of e.attributes||[])if(qo(n))for(const r of n.properties.rules)r.allow==="owner"?t.add(r.ownerField||"owner"):r.allow==="groups"&&r.groupsField!==void 0&&t.add(r.groupsField);return Array.from(t)}function qo(e){return e?.type==="auth"&&typeof e?.properties=="object"&&Array.isArray(e?.properties?.rules)?(e?.properties?.rules).every(t=>!!t.allow):!1}function Ve(e){return`${e[0].toUpperCase()}${e.slice(1)}`}function ee(e){let t,n;const r=new Promise((i,s)=>{t=i,n=s});return e(r).then(i=>{t(i)}).catch(i=>{n(i)}),r}const qe=new WeakMap;function te(e,t){return qe.set(t,e),e.finally(()=>{qe.delete(t)})}function Ho(e){const t=e.cancel.bind(e);e.cancel=function(n,r){const i=new Set;let s=n;for(;s&&qe.has(s);){if(i.has(s))throw new Error("A cycle was detected in the modeled graphql cancellation chain. This is a bug. Please report it!");i.add(s),s=qe.get(s)}return t(s,r)}}const ae={HAS_ONE:"HAS_ONE",HAS_MANY:"HAS_MANY",BELONGS_TO:"BELONGS_TO"},un={ID:"ID",String:"String",AWSDate:"String",AWSTime:"String",AWSDateTime:"String",AWSTimestamp:"Int",AWSEmail:"String",AWSPhone:"String",AWSURL:"String",AWSIPAddress:"String",AWSJSON:"String",Boolean:"Boolean",Int:"Int",Float:"Float"},He=e=>e.length===1?e[0]:e.reduce((t,n,r)=>r===0?n:t+Ve(n),""),J=(e,t,n)=>{if(!n)return null;const r={};for(const[i,s]of Object.entries(n)){const o=t?e.models[t]?.fields[i]:void 0,a={fieldDef:o,value:s};Qo(a)?r[i]=a.value.items.map(c=>J(e,a.fieldDef.type.model,c)):Wo(o)?r[i]=J(e,o.type.model,s):r[i]=s}return r};function Qo(e){return typeof e.fieldDef?.type=="object"&&"model"in e.fieldDef.type&&typeof e.fieldDef.type.model=="string"&&e.fieldDef.isArray&&Array.isArray(e.value?.items)}function Wo(e){return typeof e?.type=="object"&&"model"in e.type&&typeof e.type.model=="string"}function X(e,t,n,r,i,s,o=!1){const a=r.models[t],c=a.fields,u=Object.entries(c).filter(([l,f])=>f?.type?.model!==void 0).map(([l])=>l);return n.map(l=>{if(l==null)return l;const f={};for(const p of u){const d=c[p],m=(d?.type).model,v=r.models[m],g=v.primaryKeyInfo.primaryKeyFieldName,T=v.primaryKeyInfo.sortKeyFieldNames,S=d.association?.connectionType;let A=[];d.association&&"associatedWith"in d.association&&(A=d.association.associatedWith);const b=[];switch(d.association&&"targetNames"in d.association&&b.push(...d.association.targetNames),S){case ae.BELONGS_TO:{const k=T.reduce((w,I)=>(l[I]&&(w[I]=l[I]),w),{});if(e.models[m]?.get===void 0)break;o?f[p]=(w,I)=>l[b[0]]?e.models[m].get(w,{[g]:l[b[0]],...k},{authMode:I?.authMode||i,authToken:I?.authToken||s}):{data:null}:f[p]=w=>l[b[0]]?e.models[m].get({[g]:l[b[0]],...k},{authMode:w?.authMode||i,authToken:w?.authToken||s}):{data:null};break}case ae.HAS_ONE:case ae.HAS_MANY:{const k=S===ae.HAS_ONE?O=>({data:O?.data.shift()||null,errors:O.errors,extensions:O.extensions}):O=>O,w=a.primaryKeyInfo.primaryKeyFieldName,I=a.primaryKeyInfo.sortKeyFieldNames,C=v.fields[A[0]];if(C.type.model){let O=[];C.association&&"targetNames"in C.association&&(O=C.association?.targetNames);const R=O.map((L,P)=>P===0?{[L]:{eq:l[w]}}:{[L]:{eq:l[I[P-1]]}});if(e.models[m]?.list===void 0)break;o?f[p]=(L,P)=>l[w]?ee(async z=>{const re=e.models[m].list(L,{filter:{and:R},limit:P?.limit,nextToken:P?.nextToken,authMode:P?.authMode||i,authToken:P?.authToken||s}),Nr=te(re,z);return k(await Nr)}):[]:f[p]=L=>l[w]?ee(async P=>{const z=e.models[m].list({filter:{and:R},limit:L?.limit,nextToken:L?.nextToken,authMode:L?.authMode||i,authToken:L?.authToken||s}),re=te(z,P);return k(await re)}):[];break}const _=A.map((O,R)=>R===0?{[O]:{eq:l[w]}}:{[O]:{eq:l[I[R-1]]}});if(e.models[m]?.list===void 0)break;o?f[p]=(O,R)=>l[w]?ee(async L=>{const P=e.models[m].list(O,{filter:{and:_},limit:R?.limit,nextToken:R?.nextToken,authMode:R?.authMode||i,authToken:R?.authToken||s}),z=te(P,L);return k(await z)}):[]:f[p]=O=>l[w]?ee(async R=>{const L=e.models[m].list({filter:{and:_},limit:O?.limit,nextToken:O?.nextToken,authMode:O?.authMode||i,authToken:O?.authToken||s}),P=te(L,R);return k(await P)}):[];break}}}return{...l,...f}})}const St={CREATE:{operationPrefix:"create",usePlural:!1},GET:{operationPrefix:"get",usePlural:!1},UPDATE:{operationPrefix:"update",usePlural:!1},DELETE:{operationPrefix:"delete",usePlural:!1}
36,LIST:{operationPrefix:"list",usePlural:!0},INDEX_QUERY:{operationPrefix:"",usePlural:!1},ONCREATE:{operationPrefix:"onCreate",usePlural:!1},ONUPDATE:{operationPrefix:"onUpdate",usePlural:!1},ONDELETE:{operationPrefix:"onDelete",usePlural:!1},OBSERVEQUERY:{operationPrefix:"observeQuery",usePlural:!1}},Nt="*",Ze=(e,t)=>{const{fields:n}=e,r=Object.values(n).map(({type:i,name:s})=>{if(typeof i.enum=="string")return[s,pe];if(typeof i.nonModel=="string")return[s,Ze(t.nonModels[i.nonModel],t)];if(typeof i=="string")return[s,pe]}).filter(i=>i!==void 0);return Object.fromEntries(r)},zo=(e,t)=>{const{fields:n}=e,r=Object.values(n).map(({type:s,name:o})=>{if(typeof s.enum=="string"||typeof s=="string")return[o,pe];if(typeof s.nonModel=="string")return[o,Ze(t.nonModels[s.nonModel],t)]}).filter(s=>s!==void 0),i=Xe(e).map(s=>[s,pe]);return Object.fromEntries(r.concat(i))};function Yo(e){const{fields:t}=e,n=Object.values(t).map(({type:i,name:s})=>{if(typeof i=="string")return s;if(typeof i=="object"){if(typeof i?.enum=="string")return s;if(typeof i?.nonModel=="string")return`${s}.${Nt}`}}).filter(Boolean),r=Xe(e);return Array.from(new Set(n.concat(r)))}const pe="";function Jo(e,t,n){const r=(i,s)=>{const[o,...a]=i.split("."),c=a[0],u=e.models[s]??e.nonModels[s],l=u?.fields,f=l?.[o]?.type?.model,p=e.models[f],d=l?.[o]?.type?.nonModel,h=e.nonModels[d],m=p?"model":h?"nonModel":"field";if(m==="nonModel"){let v={};if(!c)throw Error(`${o} must declare a wildcard (*) or a field of custom type ${d}`);return c===Nt?v={[o]:Ze(h,e)}:v={[o]:r(a.join("."),d)},v}else if(m==="model"){let v={};if(!c)throw Error(`${o} must declare a wildcard (*) or a field of model ${f}`);if(c===Nt){const g=e.models[f];v={[o]:zo(g,e)}}else v={[o]:r(a.join("."),f)};return l[o]?.isArray&&(v={[o]:{items:v[o]}}),v}else{const v=l?.[o],g=e.nonModels[s],T=g?.fields?.[o];if(g){if(!T)throw Error(`${o} is not a field of custom type ${s}`)}else{const S=Xe(u).includes(o);if(!v&&!S)throw Error(`${o} is not a field of model ${s}`)}return{[o]:pe}}};return n.reduce((i,s)=>ur(r(s,t),i),{})}function Qe(e){const t=[];return Object.entries(e).forEach(([n,r])=>{r===pe?t.push(n):typeof r=="object"&&r!==null&&(r?.items?t.push(n,"{","items","{",Qe(r.items),"}","}"):t.push(n,"{",Qe(r),"}"))}),t.join(" ")}function ur(e,t){const n=r=>r&&typeof r=="object";for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(t,r)&&n(t[r])?ur(e[r],t[r]):t[r]=e[r]);return t}function lr(e,t,n){const r=e.models[t],i=Jo(e,t,n??Yo(r));return Qe(i)}function et(e,t,n,r,i){const{name:s,pluralName:o,fields:a,primaryKeyInfo:{isCustomPrimaryKey:c,primaryKeyFieldName:u,sortKeyFieldNames:l},attributes:f}=t,p=s.charAt(0).toUpperCase()+s.slice(1),d=o.charAt(0).toUpperCase()+o.slice(1),{operationPrefix:h,usePlural:m}=St[n],{selectionSet:v}=r||{};let g,T;if(h)g=`${h}${m?d:p}`;else if(i){const{queryField:_,pk:O,sk:R=[]}=i;g=_;let L={};if(R.length===1){const[P]=R,z=typeof a[P].type=="string"?a[P].type:"String",re=un[z];L={[P]:`Model${re}KeyConditionInput`}}else if(R.length>1){const P=He(R),z=f?.find(re=>re?.properties?.queryField===_)?.properties?.name;L={[P]:`Model${Ve(s)}${Ve(z)}CompositeKeyConditionInput`}}T={[O]:`${Object.prototype.hasOwnProperty.call(a[O].type,"enum")?a[O].type.enum:a[O].type}!`,...L}}else throw new Error("Error generating GraphQL Document - invalid operation name");let S,A,b;const k=lr(e,s,v),w={[u]:`${a[u].type}!`},I={},C=_=>{if(l.length===0)return{};if(_==="get")return l.reduce((O,R)=>{const L=a[R].type;return _==="get"&&(O[R]=`${L}!`),O},{});if(l.length===1){const[O]=l,R=typeof a[O].type=="string"?a[O].type:"String",L=un[R];return{[O]:`Model${L}KeyConditionInput`}}else return{[He(l)]:`Model${Ve(s)}PrimaryCompositeKeyConditionInput`}};switch(c&&(Object.assign(w,C("get")),Object.assign(I,{[u]:`${a[u].type}`,sortDirection:"ModelSortDirection"},C("list"))),n){case"CREATE":case"UPDATE":case"DELETE":b??(b={input:`${h.charAt(0).toLocaleUpperCase()+h.slice(1)}${p}Input!`}),S??(S="mutation");case"GET":b??(b=w),A??(A=k);case"LIST":b??(b={...I,filter:`Model${p}FilterInput`,limit:"Int",nextToken:"String"}),S??(S="query"),A??(A=`items { ${k} } nextToken __typename`);case"INDEX_QUERY":b??(b={...T,filter:`Model${p}FilterInput`,sortDirection:"ModelSortDirection",limit:"Int",nextToken:"String"}),S??(S="query"),A??(A=`items { ${k} } nextToken __typename`);case"ONCREATE":case"ONUPDATE":case"ONDELETE":b??(b={filter:`ModelSubscription${p}FilterInput`}),S??(S="subscription"),A??(A=k);break;case"OBSERVEQUERY":default:throw new Error("Internal error: Attempted to generate graphql document for observeQuery. Please report this error.")}return`${S}${b?`(${Object.entries(b).map(([_,O])=>`$${_}: ${O}`)})`:""} { ${g}${b?`(${Object.keys(b).map(_=>`${_}: $${_}`)})`:""} { ${A} } }`}function tt(e,t,n,r,i){const{fields:s,primaryKeyInfo:{isCustomPrimaryKey:o,primaryKeyFieldName:a,sortKeyFieldNames:c}}=e,u=c?.length&&He(c);let l={};switch(t){case"CREATE":l={input:n?ln(n,e,r):{}};break;case"UPDATE":l={input:n?Object.fromEntries(Object.entries(ln(n,e,r)).filter(([f])=>s[f]?!s[f].isReadOnly:!Xe(e).includes(f))):{}};break;case"GET":case"DELETE":n&&(l=o?[a,...c].reduce((f,p)=>(f[p]=n[p],f),{}):{[a]:n[a]}),t==="DELETE"&&(l={input:l});break;case"LIST":n?.filter&&(l.filter=n.filter),n?.sortDirection&&(l.sortDirection=n.sortDirection),n&&n[a]&&(l[a]=n[a]),u&&n&&n[u]&&(l[u]=n[u]),n?.nextToken&&
36(l.nextToken=n.nextToken),n?.limit&&(l.limit=n.limit);break;case"INDEX_QUERY":{const{pk:f,sk:p=[]}=i,d=p?.length&&He(p);l[f]=n[f],d&&n&&n[d]&&(l[d]=n[d]),n?.filter&&(l.filter=n.filter),n?.sortDirection&&(l.sortDirection=n.sortDirection),n?.nextToken&&(l.nextToken=n.nextToken),n?.limit&&(l.limit=n.limit);break}case"ONCREATE":case"ONUPDATE":case"ONDELETE":n?.filter&&(l={filter:n.filter});break;case"OBSERVEQUERY":throw new Error("Internal error: Attempted to build variables for observeQuery. Please report this error.");default:{const f=t;throw new Error(`Unhandled operation case: ${f}`)}}return l}function ln(e,t,n){const{fields:r}=t,i={};return Object.entries(e).forEach(([s,o])=>{const c=r[s]?.type?.model;if(c){const u=r[s]?.association,f=n.models[c].primaryKeyInfo;if(u?.connectionType===ae.HAS_ONE){const p=u;p.targetNames.forEach((d,h)=>{const m=p.associatedWith[h];i[d]=o[m]})}u?.connectionType===ae.BELONGS_TO&&u.targetNames.forEach((d,h)=>{if(h===0){const m=f.primaryKeyFieldName;i[d]=o[m]}else{const m=f.sortKeyFieldNames[h-1];i[d]=o[m]}})}else i[s]=o}),i}function he(e,t,n={}){const r=t(e);return{authMode:n.authMode||r.authMode,authToken:n.authToken||r.authToken}}function ye(e,t,n){let r=t(e).headers||{};return n&&(r=n),r}function Ot(e){if(e?.errors)return{...e,data:[]};throw e}function We(e){if(e.errors)return{...e,data:null};throw e}const Rt=Symbol("INTERNAL_USER_AGENT_OVERRIDE");var Q;(function(e){e.CreateConversation="1",e.GetConversation="2",e.ListConversations="3",e.DeleteConversation="4",e.SendMessage="5",e.ListMessages="6",e.OnStreamEvent="7",e.Generation="8",e.UpdateConversation="9"})(Q||(Q={}));const Z=e=>({category:"ai",action:e});function nt(e){return e?{[Rt]:e}:void 0}const Xo=e=>typeof e?.token?.value=="symbol";function rt(e,t,n,r,i,s,o){const a=r.arguments!==void 0;return(...u)=>{const l=u[u.length-1];let f,p;if(i)if(Xo(u[0]))f=u[0];else throw new Error(`Invalid first argument passed to ${r.name}. Expected contextSpec`);return a&&(i?p=u[1]:p=u[0]),n==="subscription"?ra(e,t,r,s,p,l,o):na(e,t,n,r,s,p,l,f,o)}}function ce(e,t){return typeof e[t]=="string"}function Zo(e){return e instanceof Object&&"enum"in e}function ea(e){return e instanceof Object&&"input"in e}function ta({type:e,isRequired:t}){const n=t?"!":"";return Zo(e)?`${e.enum}${n}`:ea(e)?`${e.input}${n}`:`${e}${n}`}function fr(e){if(e.arguments===void 0)return"";const t=Object.entries(e.arguments).map(([n,r])=>{const i=ta(r),s=r.isArray?`[${i}]${r.isArrayNullable?"":"!"}`:i;return`$${n}: ${s}`}).join(", ");return t.length>0?`(${t})`:""}function dr(e){if(e.arguments===void 0)return"";const t=Object.keys(e.arguments).map(n=>`${n}: $${n}`).join(", ");return t.length>0?`(${t})`:""}function pr(e,t){if(ce(t,"type")||ce(t.type,"enum"))return"";if(ce(t.type,"nonModel")){const n=e.nonModels[t.type.nonModel];return`{${Qe(Ze(n,e))}}`}else return ce(t.type,"model")?`{${lr(e,t.type.model)}}`:""}function hr(e,t={}){const n={};if(e.arguments===void 0)return n;for(const r of Object.values(e.arguments))if(typeof t[r.name]<"u")n[r.name]=t[r.name];else if(r.isRequired)throw new Error(`${e.name} requires arguments '${r.name}'`);return n}function na(e,t,n,r,i,s,o,a,c){return ee(async u=>{const{name:l}=r,f=he(e,i,o),p=ye(e,i,o?.headers),d=fr(r),h=dr(r),m=pr(t,r),v=ce(r.type,"model")?r.type.model:void 0,g=`
37    ${n.toLocaleLowerCase()}${d} {
38      ${l}${h} ${m}
39    }
40  `,T=hr(r,s),S=nt(c);try{const A=a?e.graphql(a,{...f,query:g,variables:T},p):e.graphql({...f,query:g,variables:T,...S},p),b=te(A,u),{data:k,extensions:w}=await b;if(k){const[I]=Object.keys(k),C=Array.isArray(k[I]),M=C?k[I].filter(O=>O):k[I],_=v?X(e,v,C?M:[M],t,f.authMode,f.authToken,!!a):M;return{data:!C&&Array.isArray(_)?_.shift():_,extensions:w}}else return{data:null,extensions:w}}catch(A){const{data:b,errors:k}=A;if(b&&Object.keys(b).length!==0&&k){const[w]=Object.keys(b),I=Array.isArray(b[w]),C=I?b[w].filter(M=>M):b[w];if(C){const M=v?X(e,v,I?C:[C],t,f.authMode,f.authToken,!!a):C;return{data:!I&&Array.isArray(M)?M.shift():M,errors:k}}else return We(A)}else return We(A)}})}function ra(e,t,n,r,i,s,o){const a="subscription",{name:c}=n,u=he(e,r,s),l=ye(e,r,s?.headers),f=fr(n),p=dr(n),d=pr(t,n),h=ce(n.type,"model")?n.type.model:void 0,m=`
41    ${a.toLocaleLowerCase()}${f} {
42      ${c}${p} ${d}
43    }
44  `,v=hr(n,i),g=nt(o);return e.graphql({...u,query:m,variables:v,...g},l).pipe(Ct(S=>{const[A]=Object.keys(S.data),b=S.data[A],[k]=h?X(e,h,[b],t,u.authMode,u.authToken):[b];return k}))}const ia={queries:"query",mutations:"mutation",subscriptions:"subscription"};function xt(e,t,n,r){if(!t)return{};const i=t.modelIntrospection;if(!i)return{};const s=i[n];if(!s)return{};const o={},a=r(e).amplify===null;for(const c of Object.values(s))o[c.name]=rt(e,i,ia[n],c,a,r);return o}function sa(e,t,n){return xt(e,t,"mutations",n)}
44function oa(e,t,n){return xt(e,t,"queries",n)}function aa(e,t,n){return xt(e,t,"subscriptions",n)}function _e(e,t,n,r,i,s=!1,o){return s?(u,l,f)=>fn(e,t,n,l,f,r,i,u,o):(u,l)=>fn(e,t,n,u,l,r,i,void 0,o)}function fn(e,t,n,r,i,s,o,a,c){return ee(async u=>{const{name:l}=n,f=et(t,n,s,i),p=tt(n,s,r,t),d=he(e,o,i),h=ye(e,o,i?.headers),m=nt(c);try{const v=a?e.graphql(a,{...d,query:f,variables:p},h):e.graphql({...d,query:f,variables:p,...m},h),g=te(v,u),{data:T,extensions:S}=await g;if(T){const[A]=Object.keys(T),b=J(t,l,T[A]);if(b===null)return{data:null,extensions:S};if(i?.selectionSet)return{data:b,extensions:S};{const[k]=X(e,l,[b],t,d.authMode,d.authToken,!!a);return{data:k,extensions:S}}}else return{data:null,extensions:S}}catch(v){const{data:g,errors:T}=v;if(g&&Object.keys(g).length!==0&&T){const[S]=Object.keys(g),A=J(t,l,g[S]);if(A){if(i?.selectionSet)return{data:A,errors:T};{const[b]=X(e,l,[A],t,d.authMode,d.authToken,!!a);return{data:b,errors:T}}}else return We(v)}else return We(v)}})}function Lt(e,t,n,r,i=!1,s){return i?(c,u)=>dn(e,t,n,r,u,c,s):c=>dn(e,t,n,r,c,void 0,s)}function dn(e,t,n,r,i,s,o){return ee(async a=>{const{name:c}=n,u=et(t,n,"LIST",i),l=tt(n,"LIST",i,t),f=he(e,r,i),p=ye(e,r,i?.headers),d=nt(o);try{const h=s?e.graphql(s,{...f,query:u,variables:l},p):e.graphql({...f,query:u,variables:l,...d},p),m=te(h,a),{data:v,extensions:g}=await m;if(v!==void 0){const[T]=Object.keys(v);if(v[T].items){const S=v[T].items.map(A=>J(t,c,A));return i?.selectionSet?{data:S,nextToken:v[T].nextToken,extensions:g}:{data:X(e,c,S,t,f.authMode,f.authToken,!!s),nextToken:v[T].nextToken,extensions:g}}return{data:v[T],nextToken:v[T].nextToken,extensions:g}}}catch(h){const{data:m,errors:v}=h;if(m!=null&&Object.keys(m).length!==0&&v){const[g]=Object.keys(m);if(m[g]?.items){const T=m[g].items.map(S=>J(t,c,S));return T?i?.selectionSet?{data:T,nextToken:m[g]?.nextToken,errors:v}:{data:X(e,c,T,t,f.authMode,f.authToken,!!s),nextToken:m[g]?.nextToken,errors:v}:{data:m[g],nextToken:m[g]?.nextToken,errors:v}}else return Ot(h)}else return Ot(h)}})}const ne={},me=new Array(64);for(let e=0,t=65,n=90;e+t<=n;e++){const r=String.fromCharCode(e+t);ne[r]=e,me[e]=r}for(let e=0,t=97,n=122;e+t<=n;e++){const r=String.fromCharCode(e+t),i=e+26;ne[r]=i,me[i]=r}for(let e=0;e<10;e++){ne[e.toString(10)]=e+52;const t=e.toString(10),n=e+52;ne[t]=n,me[n]=t}ne["+"]=62;me[62]="+";ne["/"]=63;me[63]="/";const fe=6,Se=8,ca=63,yr=e=>{let t=e.length/4*3;e.slice(-2)==="=="?t-=2:e.slice(-1)==="="&&t--;const n=new ArrayBuffer(t),r=new DataView(n);for(let i=0;i<e.length;i+=4){let s=0,o=0;for(let u=i,l=i+3;u<=l;u++)if(e[u]!=="="){if(!(e[u]in ne))throw new TypeError(`Invalid character ${e[u]} in base64 string.`);s|=ne[e[u]]<<(l-u)*fe,o+=fe}else s>>=fe;const a=i/4*3;s>>=o%Se;const c=Math.floor(o/Se);for(let u=0;u<c;u++){const l=(c-u-1)*Se;r.setUint8(a+u,(s&255<<l)>>l)}}return new Uint8Array(n)},ua=e=>new TextEncoder().encode(e);function mr(e){let t;typeof e=="string"?t=ua(e):t=e;const n=typeof t=="object"&&typeof t.length=="number",r=typeof t=="object"&&typeof t.byteOffset=="number"&&typeof t.byteLength=="number";if(!n&&!r)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let s=0;s<t.length;s+=3){let o=0,a=0;for(let u=s,l=Math.min(s+3,t.length);u<l;u++)o|=t[u]<<(l-u-1)*Se,a+=Se;const c=Math.ceil(a/fe);o<<=c*fe-a;for(let u=1;u<=c;u++){const l=(c-u)*fe;i+=me[(o&ca<<l)>>l]}i+="==".slice(0,4-c)}return i}const la=e=>e.map(t=>t.image?vr(t):t.document?fa(t):t.toolUse?pa(t):t.toolResult?ha(t):Er(t)),vr=({image:e})=>({image:{...e,source:{...e.source,bytes:yr(e.source.bytes)}}}),fa=({document:e})=>({document:{...e,source:{...e.source,bytes:yr(e.source.bytes)}}}),da=({json:e})=>({json:JSON.parse(e)}),pa=({toolUse:e})=>({toolUse:{...e,input:JSON.parse(e.input)}}),ha=({toolResult:e})=>({toolResult:{toolUseId:e.toolUseId,content:e.content.map(t=>t.image?vr(t):t.json?da(t):Er(t))}}),Er=e=>Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==null)),gr=({content:e,createdAt:t,id:n,conversationId:r,role:i})=>({content:la(e??[]),conversationId:r,createdAt:t,id:n,role:i}),ya=(e,t,n,r,i)=>async s=>{const o=Lt(e,t,r,i,!1,Z(Q.ListMessages)),{data:a,nextToken:c,errors:u}=await o({...s,filter:{conversationId:{eq:n}}});
44return{data:a.map(l=>gr(l)),nextToken:c,errors:u}},ma=({id:e,conversationId:t,associatedUserMessageId:n,contentBlockIndex:r,contentBlockDoneAtIndex:i,contentBlockDeltaIndex:s,contentBlockText:o,contentBlockToolUse:a,stopReason:c,errors:u})=>u?{error:{id:e,conversationId:t,associatedUserMessageId:n,errors:u}}:{next:Ea({id:e,conversationId:t,associatedUserMessageId:n,contentBlockIndex:r,contentBlockDoneAtIndex:i,contentBlockDeltaIndex:s,text:o,toolUse:va(a),stopReason:c})},va=e=>{if(e)return{...e,input:JSON.parse(e.input)}},Ea=e=>Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==null)),ga=(e,t,n,r,i)=>s=>{const{conversations:o}=t;if(!o)return{};const a=o[r].message.subscribe;return rt(e,t,"subscription",a,!1,i,Z(Q.OnStreamEvent))({conversationId:n}).subscribe(u=>{const{next:l,error:f}=ma(u);f&&s.error(f),l&&s.next(l)})},ba=e=>JSON.stringify(e),Ta=e=>e.map(t=>t.image?br(t):t.document?Na(t):t.toolResult?Aa(t):t),Sa=({tools:e})=>({tools:Object.entries(e).map(([t,n])=>({toolSpec:{name:t,description:n.description,inputSchema:{json:JSON.stringify(n.inputSchema.json)}}}))}),br=({image:e})=>({image:{...e,source:{...e.source,bytes:mr(e.source.bytes)}}}),Na=({document:e})=>({document:{...e,source:{...e.source,bytes:mr(e.source.bytes)}}}),Oa=({json:e})=>({json:JSON.stringify(e)}),Aa=({toolResult:e})=>({toolResult:{...e,content:e.content.map(t=>t.image?br(t):t.json?Oa(t):t)}}),ka=(e,t,n,r,i)=>async s=>{const{conversations:o}=t;if(!o)return{};const a=typeof s=="string"?{content:[{text:s}]}:s,{content:c,aiContext:u,toolConfiguration:l}=a,f=o[r].message.send,p=rt(e,t,"mutation",f,!1,i,Z(Q.SendMessage)),{data:d,errors:h}=await p({conversationId:n,content:Ta(c),...u&&{aiContext:ba(u)},...l&&{toolConfiguration:Sa(l)}});return{data:d&&gr(d),errors:h}},De=(e,t,n,r,i,s,o,a,c,u)=>{if(!n)throw new Error(`An error occurred converting a ${s} conversation: Missing ID`);return{id:n,createdAt:r,updatedAt:i,metadata:c,name:u,onStreamEvent:ga(e,t,n,s,a),sendMessage:ka(e,t,n,s,a),listMessages:ya(e,t,n,o,a)}},wa=(e,t,n,r,i,s)=>async o=>{const{name:a,metadata:c}=o??{},u=JSON.stringify(c),l=_e(e,t,r,"CREATE",s,!1,Z(Q.CreateConversation)),{data:f,errors:p}=await l({name:a,metadata:u});return{data:De(e,t,f?.id,f?.createdAt,f?.updatedAt,n,i,s,f?.metadata,f?.name),errors:p}},Ia=(e,t,n,r,i,s)=>async({id:o})=>{const a=_e(e,t,r,"GET",s,!1,Z(Q.GetConversation)),{data:c,errors:u}=await a({id:o});return{data:c&&De(e,t,c.id,c.createdAt,c.updatedAt,n,i,s,c?.metadata,c?.name),errors:u}},Ca=(e,t,n,r,i,s)=>async o=>{const a=Lt(e,t,r,s,!1,Z(Q.ListConversations)),{data:c,nextToken:u,errors:l}=await a(o);return{data:c.map(f=>De(e,t,f.id,f.createdAt,f.updatedAt,n,i,s,f?.metadata,f?.name)),nextToken:u,errors:l}},_a=(e,t,n,r,i,s)=>async({id:o})=>{const a=_e(e,t,r,"DELETE",s,!1,Z(Q.DeleteConversation)),{data:c,errors:u}=await a({id:o});return{data:c&&De(e,t,c?.id,c?.createdAt,c?.updatedAt,n,i,s,c?.metadata,c?.name),errors:u}},Da=(e,t,n,r,i,s)=>async({id:o,metadata:a,name:c})=>{const u=JSON.stringify(a),l=_e(e,t,r,"UPDATE",s,!1,Z(Q.UpdateConversation)),{data:f,errors:p}=await l({id:o,metadata:u,name:c});return{data:f&&De(e,t,f?.id,f?.createdAt,f?.updatedAt,n,i,s,f?.metadata,f?.name),errors:p}};function Ra(e,t,n){const r=t?.modelIntrospection;if(!r?.conversations)return{};const i={};for(const{name:s,conversation:o,message:a,models:c,nonModels:u,enums:l}of Object.values(r.conversations)){const f=c[o.modelName],p=c[a.modelName];if(!f||!p)return{};const d={...r,models:{...r.models,...c},nonModels:{...r.nonModels,...u},enums:{...r.enums,...l}};i[s]={update:Da(e,d,s,f,p,n),create:wa(e,d,s,f,p,n),get:Ia(e,d,s,f,p,n),delete:_a(e,d,s,f,p,n),list:Ca(e,d,s,f,p,n)}}return i}function xa(e,t,n){const r=t?.modelIntrospection;if(!r?.generations)return{};const i={};for(const s of Object.values(r.generations))i[s.name]=rt(e,r,"query",s,!1,n,Z(Q.Generation));return i}const La=e=>{const t=e.modelIntrospection;if(!t)return{};const n={};for(const[r,i]of Object.entries(t.enums))n[i.name]={values:()=>i.values};return n};function Pa(e,t,n,r,i,s=!1){return s?(c,u,l)=>pn(e,t,n,r,i,{...u,...l},c):(c,u)=>pn(e,t,n,r,i,{...c,...u})}function Ma(e,t,n,r,i){const{data:s,extensions:o}=n,[a]=Object.keys(s);if(s[a].items){const c=s[a].items.map(u=>J(e,t,u));return{data:r?c:i(c),nextToken:s[a].nextToken,extensions:o}}return{data:s[a],nextToken:s[a].nextToken,extensions:o}}function pn(e,t,n,r,i,s,o){return ee(async a=>{const{name:c}=n,u=et(t,n,"INDEX_QUERY",s,r),l=tt(n,"INDEX_QUERY",s,t,r),f=he(e,i,s),p=d=>X(e,c,d,t,f.authMode,f.authToken,!!o);try{const d=ye(e,i,s?.headers),m=[{...f,query:u,variables:l},d];o!==void 0&&m.unshift(o);const v=e.graphql(...m),T=await te(v,a);
44if(T.data!==void 0)return Ma(t,c,T,s?.selectionSet,p)}catch(d){const{data:h,errors:m}=d;if(h!=null&&Object.keys(h).length!==0&&m){const[v]=Object.keys(h);if(h[v]?.items){const g=h[v]?.items.map(T=>J(t,c,T));if(g)return{data:s?.selectionSet?g:p(g),nextToken:h[v]?.nextToken}}return{data:h[v],nextToken:h[v]?.nextToken}}else return Ot(d)}})}function Fa(e,t,n,r,i){const{name:s}=n;return a=>{const c=et(t,n,r,a),u=tt(n,r,a,t),l=he(e,i,a),f=ye(e,i,a?.headers);return e.graphql({...l,query:c,variables:u},f).pipe(Ct(d=>{const[h]=Object.keys(d.data),m=d.data[h],v=J(t,s,m);if(v===null)return null;if(a?.selectionSet)return v;{const[g]=X(e,s,[v],t,l.authMode,l.authToken);return g}}))}}function Ua(e){const{primaryKeyFieldName:t,sortKeyFieldNames:n}=e.primaryKeyInfo;return[t,...n]}function ja(e,t,n){const r=Object.fromEntries(n.map(i=>[i,e[i]]));for(let i=0;i<t.length;i++)if(Object.keys(r).every(s=>r[s]===t[i][s]))return i;return-1}function Ka(e,t){const{name:n}=t;return i=>new B(s=>{const o=[],a=[];let c=(...h)=>a.push(...h);const u=e[n].onCreate(i).subscribe({next(h){c({item:h,type:"create"})},error(h){s.error({type:"onCreate",error:h})}}),l=e[n].onUpdate(i).subscribe({next(h){c({item:h,type:"update"})},error(h){s.error({type:"onUpdate",error:h})}}),f=e[n].onDelete(i).subscribe({next(h){c({item:h,type:"delete"})},error(h){s.error({type:"onDelete",error:h})}});function p(h){for(const m of h){const v=ja(m.item,o,d);switch(m.type){case"create":v<0&&o.push(m.item);break;case"update":v>=0&&(o[v]=m.item);break;case"delete":v>=0&&o.splice(v,1);break;default:console.error("Unrecognized message in observeQuery.",m)}}s.next({items:o,isSynced:!0})}const d=Ua(t);return(async()=>{let h=!0,m=null;for(;!s.closed&&(h||m);){h=!1;const{data:v,errors:g,nextToken:T}=await e[n].list({...i,nextToken:m});m=T,o.push(...v);const S=a.length===0&&m==null;if(s.next({items:o,isSynced:S}),Array.isArray(g))for(const A of g)s.error(A)}a.length>0&&p(a),c=(...v)=>(p(v),o.length)})(),()=>{u.unsubscribe(),l.unsubscribe(),f.unsubscribe()}})}const Ba=e=>e.type==="key"&&e.properties?.name&&e.properties?.queryField&&e.properties?.fields.length>0,$a=e=>e.attributes?.filter(Ba).map(n=>{const r=n.properties.queryField,[i,...s]=n.properties.fields;return{queryField:r,pk:i,sk:s}})||[],Va=(e,t)=>{const n=e.models[t].attributes?.find(a=>a.type==="model"),r={queries:["list","get","observeQuery"],mutations:["create","update","delete"],subscriptions:["onCreate","onUpdate","onDelete"]},i=[];if(!n)return St;if(n.properties)for(const[a,c]of Object.entries(n.properties))a in r&&(c===null?i.push(...r[a]):c instanceof Object&&i.push(...Object.keys(c)));i.includes("list")&&i.push("observeQuery");const s=i.map(a=>a.toUpperCase());return Object.fromEntries(Object.entries(St).filter(([a])=>!s.includes(a)))};function Ga(e,t,n){const r={},i=t.modelIntrospection;if(!i)return{};const s=["ONCREATE","ONUPDATE","ONDELETE"];for(const o of Object.values(i.models)){const{name:a}=o;r[a]={};const c=Va(i,a);Object.entries(c).forEach(([l,{operationPrefix:f}])=>{const p=l;p==="LIST"?r[a][f]=Lt(e,i,o,n):s.includes(p)?r[a][f]=Fa(e,i,o,p,n):p==="OBSERVEQUERY"?r[a][f]=Ka(r,o):r[a][f]=_e(e,i,o,p,n)});const u=$a(o);for(const l of u)r[a][l.queryField]=Pa(e,i,o,l,n)}return r}function Tr(e,t,n){return Ho(e),e.models=Ga(e,t,n),e.enums=La(t),e.queries=oa(e,t,n),e.mutations=sa(e,t,n),e.subscriptions=aa(e,t,n),e.conversations=Ra(e,t,n),e.generations=xa(e,t,n),e}function qa(e){return Rt in e}class Ha extends Go{getModuleName(){return"GraphQLAPI"}graphql(t,n,r){const i={category:Ur.API,action:Fr.GraphQl};if(qa(n)){const{[Rt]:s,...o}=n;return super.graphql(t,o,r,{...i,...s})}return super.graphql(t,n,r,{...i})}isCancelError(t){return super.isCancelError(t)}cancel(t,n){return super.cancel(t,n)}}const Pt=new Ha;function Qa(e,t){const n=Dt(this),r=n.endpoint,i=n.authMode,s=n.apiKey;if(e.authMode=e.authMode||i,e.apiKey=e.apiKey??s,e.authToken=e.authToken||n.authToken,r&&e.authMode==="apiKey"&&!e.apiKey)throw new Error("graphql() requires an explicit `apiKey` for a custom `endpoint` when `authMode = 'apiKey'`.");const o=t||n.headers;return Pt.graphql(n.amplify,{...e,endpoint:r},o)}function Wa(e,t){return Pt.cancel(e,t)}function za(e){return Pt.isCancelError(e)}function Sr(e){return e!==void 0}function Ya(e){return e.event==="configure"}function Ja(e){const t={[or]:e.amplify,[Be]:e.authMode,[ar]:e.authToken,[Tt]:"apiKey"in e?e.apiKey:void 0,[$e]:"endpoint"in e?e.endpoint:void 0,[cr]:e.headers,graphql:Qa,cancel:Wa,isCancelError:za,models:Ee,enums:Ee,queries:Ee,mutations:Ee,subscriptions:Ee},n=e.amplify.getConfig().API?.GraphQL;if(t[$e]){if(!t[Be])throw new Error("generateClient() requires an explicit `authMode` when `endpoint` is provided.");if(t[Be]==="apiKey"&&!t[Tt])throw new Error("generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.")}return t[$e]||(Sr(n)?Tr(t,n,Dt):Xa(t)),t}const Xa=e=>{Sn.listen("core",t=>{if(!Ya(t.payload))return;const n=t.payload.data.API?.GraphQL;Sr(n)&&Tr(e,n,Dt)})},Ee=new Proxy({},{get(){throw new Error("Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.")}});function ec(e){return Ja({amplify:yn})}export{yi as a,Bn as f,ec as g};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.