@coasys/ad4m-connect 0.11.2-dev-multi-user-email-2 → 0.11.2-dev-sdna-only-prolog
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +272 -267
- package/dist/utils.js +1 -1
- package/dist/web.js +391 -386
- package/package.json +2 -2
package/dist/web.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var fm=Object.defineProperty;var dm=Object.getOwnPropertyDescriptor;var te=(t,e,r,i)=>{for(var n=i>1?void 0:i?dm(e,r):e,a=t.length-1,o;a>=0;a--)(o=t[a])&&(n=(i?o(e,r,n):o(n))||n);return i&&n&&fm(e,r,n),n};var re=(t,e,r)=>new Promise((i,n)=>{var a=u=>{try{s(r.next(u))}catch(c){n(c)}},o=u=>{try{s(r.throw(u))}catch(c){n(c)}},s=u=>u.done?i(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});import{ZBarSymbolType as me,ZBarConfigType as Ip,scanRGBABuffer as hm,getDefaultScanner as mm}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function gm(t,e,r,i){return new(r||(r=Promise))(function(n,a){function o(c){try{u(i.next(c))}catch(l){a(l)}}function s(c){try{u(i.throw(c))}catch(l){a(l)}}function u(c){var l;c.done?n(c.value):(l=c.value,l instanceof r?l:new r(function(d){d(l)})).then(o,s)}u((i=i.apply(t,e||[])).next())})}var M=class{constructor(e,r=Ip.ZBAR_CFG_ENABLE,i=1){this.symbolType=e,this.configType=r,this.number=i,this.configSteps=[this]}static register(e,r,i=r.symbolType){return M.formatsToConfigs[e]=r,M.typesToFormats[i]=M.typesToFormats[i]||e,r}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,r){var i;(i=M.formatsToConfigs[r])===null||i===void 0||i.configSteps.forEach(n=>e.setConfig(n.symbolType,n.configType,n.number))}add(e){return this.configSteps.push(e),this}},Tp;M.formatsToConfigs={},M.typesToFormats={},M.register("codabar",new M(me.ZBAR_CODABAR)),M.register("code_39",new M(me.ZBAR_CODE39)),M.register("code_93",new M(me.ZBAR_CODE93)),M.register("code_128",new M(me.ZBAR_CODE128)),M.register("databar",new M(me.ZBAR_DATABAR)),M.register("databar_exp",new M(me.ZBAR_DATABAR_EXP)),M.register("ean_2",new M(me.ZBAR_EAN2)),M.register("ean_5",new M(me.ZBAR_EAN5)),M.register("ean_8",new M(me.ZBAR_EAN8)),M.register("ean_13",new M(me.ZBAR_EAN13)),M.register("ean_13+2",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("ean_13+5",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("isbn_10",new M(me.ZBAR_ISBN10)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13+2",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("isbn_13+5",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("itf",new M(me.ZBAR_I25)),M.register("qr_code",new M(me.ZBAR_QRCODE)),M.register("sq_code",new M(me.ZBAR_SQCODE)),M.register("upc_a",new M(me.ZBAR_UPCA)).add(new M(me.ZBAR_EAN13)),M.register("upc_e",new M(me.ZBAR_UPCE)).add(new M(me.ZBAR_EAN13)),function(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.UPRIGHT=0]="UPRIGHT",t[t.ROTATED_RIGHT=1]="ROTATED_RIGHT",t[t.UPSIDE_DOWN=2]="UPSIDE_DOWN",t[t.ROTATED_LEFT=3]="ROTATED_LEFT"}(Tp||(Tp={}));var xc=class{},ym=(()=>{try{return new OffscreenCanvas(1,1).getContext("2d")instanceof OffscreenCanvasRenderingContext2D}catch{return!1}})(),Nr=class{constructor(e={}){if(e.formats!==void 0){if(!Array.isArray(e.formats)||!e.formats.length)throw new TypeError(`Barcode formats should be a non-empty array of strings but are: ${JSON.stringify(e)}`);let r=e.formats.filter(i=>!M.formats().includes(i));if(r.length)throw new TypeError(`Unsupported barcode format(s): ${r.join(", ")}`)}this.formats=e.formats||M.formats(),this.zbarConfig=e.zbar||new xc}static getSupportedFormats(){return Promise.resolve(M.formats())}detect(e){if(!Nr.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let r=Nr.intrinsicDimensions(e);if(r.width===0||r.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(i=>{let n=i[0],a=i[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),hm(n.data,n.width,n.height,a)}).then(i=>i.map(n=>this.toBarcodeDetectorResult(n)))}catch(i){return Promise.reject(i)}}getScanner(){return new Promise((e,r)=>gm(this,void 0,void 0,function*(){if(!this.scanner){let i=yield mm();this.formats.length>0&&(i.setConfig(me.ZBAR_NONE,Ip.ZBAR_CFG_ENABLE,0),this.formats.forEach(n=>M.configure(i,n))),this.scanner=i}e(this.scanner)}))}toImageData(e){let r=i=>{let n=Nr.intrinsicDimensions(i);this.canvas&&this.canvas.width===n.width&&this.canvas.height===n.height||(this.canvas=function(s,u){if(ym)return new OffscreenCanvas(s,u);{let c=document.createElement("canvas");return c.width=s,c.height=u,c}}(n.width,n.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(i,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let i=document.createElement("img");return i.src=URL.createObjectURL(e),i.decode().then(()=>r(i)).finally(()=>URL.revokeObjectURL(i.src))}return e instanceof CanvasRenderingContext2D?Promise.resolve(e.getImageData(0,0,e.canvas.width,e.canvas.height)):Promise.resolve(r(e))}toBarcodeDetectorResult(e){let r={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0};return e.points.forEach(i=>{r.minX=Math.min(r.minX,i.x),r.maxX=Math.max(r.maxX,i.x),r.minY=Math.min(r.minY,i.y),r.maxY=Math.max(r.maxY,i.y)}),{format:M.toFormat(e.type),rawValue:e.decode(this.zbarConfig.encoding),orientation:e.orientation,quality:e.quality,boundingBox:DOMRectReadOnly.fromRect({x:r.minX,y:r.minY,width:r.maxX-r.minX,height:r.maxY-r.minY}),cornerPoints:[{x:r.minX,y:r.minY},{x:r.maxX,y:r.minY},{x:r.maxX,y:r.maxY},{x:r.minX,y:r.maxY}]}}static isImageBitmapSource(e){return e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof Blob||e instanceof ImageData||e instanceof CanvasRenderingContext2D||e instanceof ImageBitmap||e&&e.width==0||e&&e.height==0}static intrinsicDimensions(e){return{width:Number(e.naturalWidth||e.videoWidth||e.width),height:Number(e.naturalHeight||e.videoHeight||e.height)}}};var ko=window,To=ko.ShadowRoot&&(ko.ShadyCSS===void 0||ko.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ac=Symbol(),Op=new WeakMap,ia=class{constructor(e,r,i){if(this._$cssResult$=!0,i!==Ac)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o,r=this.t;if(To&&e===void 0){let i=r!==void 0&&r.length===1;i&&(e=Op.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Op.set(r,e))}return e}toString(){return this.cssText}},Dp=t=>new ia(typeof t=="string"?t:t+"",void 0,Ac),kc=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[a+1],t[0]);return new ia(r,t,Ac)},Tc=(t,e)=>{To?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{let i=document.createElement("style"),n=ko.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=r.cssText,t.appendChild(i)})},Io=To?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let i of e.cssRules)r+=i.cssText;return Dp(r)})(t):t;var Ic,Oo=window,Np=Oo.trustedTypes,vm=Np?Np.emptyScript:"",Rp=Oo.reactiveElementPolyfillSupport,Dc={toAttribute(t,e){switch(e){case Boolean:t=t?vm:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Pp=(t,e)=>e!==t&&(e==e||t==t),Oc={attribute:!0,type:String,converter:Dc,reflect:!1,hasChanged:Pp},Nc="finalized",gr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((r,i)=>{let n=this._$Ep(i,r);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,r=Oc){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,r);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,r,i){return{get(){return this[r]},set(n){let a=this[e];this[r]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Oc}static finalize(){if(this.hasOwnProperty(Nc))return!1;this[Nc]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let r=this.properties,i=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(let n of i)this.createProperty(n,r[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)r.unshift(Io(n))}else e!==void 0&&r.push(Io(e));return r}static _$Ep(e,r){let i=r.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,i;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;let r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Tc(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostConnected)===null||i===void 0?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostDisconnected)===null||i===void 0?void 0:i.call(r)})}attributeChangedCallback(e,r,i){this._$AK(e,i)}_$EO(e,r,i=Oc){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Dc).toAttribute(r,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,r){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Dc;this._$El=a,this[a]=s.fromAttribute(r,o.type),this._$El=null}}requestUpdate(e,r,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Pp)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(r){Promise.reject(r)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let r=!1,i=this._$AL;try{r=this.shouldUpdate(i),r?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw r=!1,this._$Ek(),n}r&&this._$AE(i)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((r,i)=>this._$EO(i,this[i],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};gr[Nc]=!0,gr.elementProperties=new Map,gr.elementStyles=[],gr.shadowRootOptions={mode:"open"},Rp?.({ReactiveElement:gr}),((Ic=Oo.reactiveElementVersions)!==null&&Ic!==void 0?Ic:Oo.reactiveElementVersions=[]).push("1.6.3");var Rc,Do=window,dn=Do.trustedTypes,$p=dn?dn.createPolicy("lit-html",{createHTML:t=>t}):void 0,$c="$lit$",Rr=`lit$${(Math.random()+"").slice(9)}$`,Bp="?"+Rr,bm=`<${Bp}>`,mi=document,aa=()=>mi.createComment(""),oa=t=>t===null||typeof t!="object"&&typeof t!="function",Vp=Array.isArray,_m=t=>Vp(t)||typeof t?.[Symbol.iterator]=="function",Pc=`[
|
|
2
|
-
\f\r]`,na=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Mp=/'/g,Up=/"/g,Qp=/^(?:script|style|textarea|title)$/i,zp=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),L=zp(1),J3=zp(2),gi=Symbol.for("lit-noChange"),We=Symbol.for("lit-nothing"),jp=new WeakMap,hi=mi.createTreeWalker(mi,129,null,!1);function Wp(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return $p!==void 0?$p.createHTML(e):e}var Sm=(t,e)=>{let r=t.length-1,i=[],n,a=e===2?"<svg>":"",o=na;for(let s=0;s<r;s++){let u=t[s],c,l,d=-1,f=0;for(;f<u.length&&(o.lastIndex=f,l=o.exec(u),l!==null);)f=o.lastIndex,o===na?l[1]==="!--"?o=Lp:l[1]!==void 0?o=Fp:l[2]!==void 0?(Qp.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=di):l[3]!==void 0&&(o=di):o===di?l[0]===">"?(o=n??na,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,c=l[1],o=l[3]===void 0?di:l[3]==='"'?Up:Mp):o===Up||o===Mp?o=di:o===Lp||o===Fp?o=na:(o=di,n=void 0);let p=o===di&&t[s+1].startsWith("/>")?" ":"";a+=o===na?u+bm:d>=0?(i.push(c),u.slice(0,d)+$c+u.slice(d)+Rr+p):u+Rr+(d===-2?(i.push(void 0),s):p)}return[Wp(t,a+(t[r]||"<?>")+(e===2?"</svg>":"")),i]},yi=class{constructor({strings:e,_$litType$:r},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,u=this.parts,[c,l]=Sm(e,r);if(this.el=yi.createElement(c,i),hi.currentNode=this.el.content,r===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=hi.nextNode())!==null&&u.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith($c)||f.startsWith(Rr)){let p=l[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+$c).split(Rr),m=/([.?@])?(.*)/.exec(p);u.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Fc:m[1]==="?"?Mc:m[1]==="@"?Uc:mn})}else u.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(Qp.test(n.tagName)){let d=n.textContent.split(Rr),f=d.length-1;if(f>0){n.textContent=dn?dn.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],aa()),hi.nextNode(),u.push({type:2,index:++a});n.append(d[f],aa())}}}else if(n.nodeType===8)if(n.data===Bp)u.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(Rr,d+1))!==-1;)u.push({type:7,index:a}),d+=Rr.length-1}a++}}static createElement(e,r){let i=mi.createElement("template");return i.innerHTML=e,i}};function hn(t,e,r=t,i){var n,a,o,s;if(e===gi)return e;let u=i!==void 0?(n=r._$Co)===null||n===void 0?void 0:n[i]:r._$Cl,c=oa(e)?void 0:e._$litDirective$;return u?.constructor!==c&&((a=u?._$AO)===null||a===void 0||a.call(u,!1),c===void 0?u=void 0:(u=new c(t),u._$AT(t,r,i)),i!==void 0?((o=(s=r)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=u:r._$Cl=u),u!==void 0&&(e=hn(t,u._$AS(t,e.values),u,i)),e}var Lc=class{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;let{el:{content:i},parts:n}=this._$AD,a=((r=e?.creationScope)!==null&&r!==void 0?r:mi).importNode(i,!0);hi.currentNode=a;let o=hi.nextNode(),s=0,u=0,c=n[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new vi(o,o.nextSibling,this,e):c.type===1?l=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(l=new jc(o,this,e)),this._$AV.push(l),c=n[++u]}s!==c?.index&&(o=hi.nextNode(),s++)}return hi.currentNode=mi,a}v(e){let r=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,r),r+=i.strings.length-2):i._$AI(e[r])),r++}},vi=class{constructor(e,r,i,n){var a;this.type=2,this._$AH=We,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=i,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode,r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=hn(this,e,r),oa(e)?e===We||e==null||e===""?(this._$AH!==We&&this._$AR(),this._$AH=We):e!==this._$AH&&e!==gi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):_m(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==We&&oa(this._$AH)?this._$AA.nextSibling.data=e:this.$(mi.createTextNode(e)),this._$AH=e}g(e){var r;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=yi.createElement(Wp(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===a)this._$AH.v(i);else{let o=new Lc(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let r=jp.get(e.strings);return r===void 0&&jp.set(e.strings,r=new yi(e)),r}T(e){Vp(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,i,n=0;for(let a of e)n===r.length?r.push(i=new vi(this.k(aa()),this.k(aa()),this,this.options)):i=r[n],i._$AI(a),n++;n<r.length&&(this._$AR(i&&i._$AB.nextSibling,n),r.length=n)}_$AR(e=this._$AA.nextSibling,r){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,r);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}},mn=class{constructor(e,r,i,n,a){this.type=1,this._$AH=We,this._$AN=void 0,this.element=e,this.name=r,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=We}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=hn(this,e,r,0),o=!oa(e)||e!==this._$AH&&e!==gi,o&&(this._$AH=e);else{let s=e,u,c;for(e=a[0],u=0;u<a.length-1;u++)c=hn(this,s[i+u],r,u),c===gi&&(c=this._$AH[u]),o||(o=!oa(c)||c!==this._$AH[u]),c===We?e=We:e!==We&&(e+=(c??"")+a[u+1]),this._$AH[u]=c}o&&!n&&this.j(e)}j(e){e===We?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fc=class extends mn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===We?void 0:e}},wm=dn?dn.emptyScript:"",Mc=class extends mn{constructor(){super(...arguments),this.type=4}j(e){e&&e!==We?this.element.setAttribute(this.name,wm):this.element.removeAttribute(this.name)}},Uc=class extends mn{constructor(e,r,i,n,a){super(e,r,i,n,a),this.type=5}_$AI(e,r=this){var i;if((e=(i=hn(this,e,r,0))!==null&&i!==void 0?i:We)===gi)return;let n=this._$AH,a=e===We&&n!==We||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==We&&(n===We||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,i;typeof this._$AH=="function"?this._$AH.call((i=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},jc=class{constructor(e,r,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){hn(this,e)}};var qp=Do.litHtmlPolyfillSupport;qp?.(yi,vi),((Rc=Do.litHtmlVersions)!==null&&Rc!==void 0?Rc:Do.litHtmlVersions=[]).push("2.8.0");var Hp=(t,e,r)=>{var i,n;let a=(i=r?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=r?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new vi(e.insertBefore(aa(),s),s,void 0,r??{})}return o._$AI(t),o};var qc,Bc;var Pr=class extends gr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let i=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=i.firstChild),i}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Hp(r,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return gi}};Pr.finalized=!0,Pr._$litElement$=!0,(qc=globalThis.litElementHydrateSupport)===null||qc===void 0||qc.call(globalThis,{LitElement:Pr});var Gp=globalThis.litElementPolyfillSupport;Gp?.({LitElement:Pr});((Bc=globalThis.litElementVersions)!==null&&Bc!==void 0?Bc:globalThis.litElementVersions=[]).push("3.3.3");var Kp=t=>e=>typeof e=="function"?((r,i)=>(customElements.define(r,i),i))(t,e):((r,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(r,o)}}})(t,e);var Cm=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},Em=(t,e,r)=>{e.constructor.createProperty(r,t)};function st(t){return(e,r)=>r!==void 0?Em(t,e,r):Cm(t,e)}function Ee(t){return st({...t,state:!0})}var Vc,Eb=((Vc=window.HTMLSlotElement)===null||Vc===void 0?void 0:Vc.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(r=>r.nodeType===Node.ELEMENT_NODE);var Qc=function(t,e){return Qc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},Qc(t,e)};function Re(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qc(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var C=function(){return C=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},C.apply(this,arguments)};function Yt(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function Bt(t,e,r,i){function n(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?a(l.value):n(l.value).then(s,u)}c((i=i.apply(t,e||[])).next())})}function Vt(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(l){return u([c,l])}}function u(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(i=1,n&&(a=c[0]&2?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],n=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $r(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return t.concat(a||Array.prototype.slice.call(e))}var zc="Invariant Violation",Zp=Object.setPrototypeOf,xm=Zp===void 0?function(t,e){return t.__proto__=e,t}:Zp,Z=function(t){Re(e,t);function e(r){r===void 0&&(r=zc);var i=t.call(this,typeof r=="number"?zc+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return i.framesToPop=1,i.name=zc,xm(i,e.prototype),i}return e}(Error);function $(t,e){if(!t)throw new Z(e)}var Ro=["debug","log","warn","error","silent"],Wc=Ro.indexOf("log");function No(t){return function(){if(Ro.indexOf(t)>=Wc){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=No("debug"),t.log=No("log"),t.warn=No("warn"),t.error=No("error")})($||($={}));function Jp(t){var e=Ro[Wc];return Wc=Math.max(0,Ro.indexOf(t)),e}function He(t){try{return t()}catch{}}var Po=He(function(){return globalThis})||He(function(){return window})||He(function(){return self})||He(function(){return global})||He(function(){return He.constructor("return this")()});var Yp="__",Xp=[Yp,Yp].join("DEV");function Am(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Po,Xp,{value:He(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Po[Xp]}}var bi=Am();function Lr(t){try{return t()}catch{}}var Hc=Lr(function(){return globalThis})||Lr(function(){return window})||Lr(function(){return self})||Lr(function(){return global})||Lr(function(){return Lr.constructor("return this")()}),Gc=!1;function km(){Hc&&!Lr(function(){return"production"})&&!Lr(function(){return process})&&(Object.defineProperty(Hc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Gc=!0)}km();function Kc(){Gc&&(delete Hc.process,Gc=!1)}var Zb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Jb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",ef=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Me=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 Zc(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Tm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ca=Tm;function $o(t){var e=t.prototype.toJSON;typeof e=="function"||Zc(0),t.prototype.inspect=e,ca&&(t.prototype[ca]=e)}var tf=function(){function t(r,i,n){this.start=r.start,this.end=i.end,this.startToken=r,this.endToken=i,this.source=n}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();$o(tf);var rf=function(){function t(r,i,n,a,o,s,u){this.kind=r,this.start=i,this.end=n,this.line=a,this.column=o,this.value=u,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();$o(rf);function Jc(t){return t!=null&&typeof t.kind=="string"}function Lo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Lo=function(r){return typeof r}:Lo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Lo(t)}var Im=10,nf=2;function ua(t){return Fo(t,[])}function Fo(t,e){switch(Lo(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Om(t,e);default:return String(t)}}function Om(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),i=Rm(t);if(i!==void 0){var n=i.call(t);if(n!==t)return typeof n=="string"?n:Fo(n,r)}else if(Array.isArray(t))return Nm(t,r);return Dm(t,r)}function Dm(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>nf)return"["+Pm(t)+"]";var i=r.map(function(n){var a=Fo(t[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Nm(t,e){if(t.length===0)return"[]";if(e.length>nf)return"[Array]";for(var r=Math.min(Im,t.length),i=t.length-r,n=[],a=0;a<r;++a)n.push(Fo(t[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Rm(t){var e=t[String(ca)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Pm(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function la(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function af(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function $m(t,e,r){return e&&af(t.prototype,e),r&&af(t,r),t}var Mo=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||la(0,"Body must be a string. Received: ".concat(ua(e),".")),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||la(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||la(0,"column in locationOffset is 1-indexed and must be positive.")}return $m(t,[{key:ef,get:function(){return"Source"}}]),t}();function of(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=t.indexOf(`
|
|
4
|
-
`)===-1,n=
|
|
5
|
-
`+e),
|
|
6
|
-
`+e):
|
|
7
|
-
`),'"""'+
|
|
1
|
+
var dm=Object.defineProperty;var hm=Object.getOwnPropertyDescriptor;var te=(r,e,t,i)=>{for(var n=i>1?void 0:i?hm(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&dm(e,t,n),n};var re=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(l){n(l)}},o=c=>{try{s(t.throw(c))}catch(l){n(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});import{ZBarSymbolType as me,ZBarConfigType as Op,scanRGBABuffer as mm,getDefaultScanner as gm}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function ym(r,e,t,i){return new(t||(t=Promise))(function(n,a){function o(l){try{c(i.next(l))}catch(u){a(u)}}function s(l){try{c(i.throw(l))}catch(u){a(u)}}function c(l){var u;l.done?n(l.value):(u=l.value,u instanceof t?u:new t(function(d){d(u)})).then(o,s)}c((i=i.apply(r,e||[])).next())})}var M=class{constructor(e,t=Op.ZBAR_CFG_ENABLE,i=1){this.symbolType=e,this.configType=t,this.number=i,this.configSteps=[this]}static register(e,t,i=t.symbolType){return M.formatsToConfigs[e]=t,M.typesToFormats[i]=M.typesToFormats[i]||e,t}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,t){var i;(i=M.formatsToConfigs[t])===null||i===void 0||i.configSteps.forEach(n=>e.setConfig(n.symbolType,n.configType,n.number))}add(e){return this.configSteps.push(e),this}},Ip;M.formatsToConfigs={},M.typesToFormats={},M.register("codabar",new M(me.ZBAR_CODABAR)),M.register("code_39",new M(me.ZBAR_CODE39)),M.register("code_93",new M(me.ZBAR_CODE93)),M.register("code_128",new M(me.ZBAR_CODE128)),M.register("databar",new M(me.ZBAR_DATABAR)),M.register("databar_exp",new M(me.ZBAR_DATABAR_EXP)),M.register("ean_2",new M(me.ZBAR_EAN2)),M.register("ean_5",new M(me.ZBAR_EAN5)),M.register("ean_8",new M(me.ZBAR_EAN8)),M.register("ean_13",new M(me.ZBAR_EAN13)),M.register("ean_13+2",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("ean_13+5",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("isbn_10",new M(me.ZBAR_ISBN10)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13+2",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("isbn_13+5",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("itf",new M(me.ZBAR_I25)),M.register("qr_code",new M(me.ZBAR_QRCODE)),M.register("sq_code",new M(me.ZBAR_SQCODE)),M.register("upc_a",new M(me.ZBAR_UPCA)).add(new M(me.ZBAR_EAN13)),M.register("upc_e",new M(me.ZBAR_UPCE)).add(new M(me.ZBAR_EAN13)),function(r){r[r.UNKNOWN=-1]="UNKNOWN",r[r.UPRIGHT=0]="UPRIGHT",r[r.ROTATED_RIGHT=1]="ROTATED_RIGHT",r[r.UPSIDE_DOWN=2]="UPSIDE_DOWN",r[r.ROTATED_LEFT=3]="ROTATED_LEFT"}(Ip||(Ip={}));var Ac=class{},vm=(()=>{try{return new OffscreenCanvas(1,1).getContext("2d")instanceof OffscreenCanvasRenderingContext2D}catch{return!1}})(),Or=class{constructor(e={}){if(e.formats!==void 0){if(!Array.isArray(e.formats)||!e.formats.length)throw new TypeError(`Barcode formats should be a non-empty array of strings but are: ${JSON.stringify(e)}`);let t=e.formats.filter(i=>!M.formats().includes(i));if(t.length)throw new TypeError(`Unsupported barcode format(s): ${t.join(", ")}`)}this.formats=e.formats||M.formats(),this.zbarConfig=e.zbar||new Ac}static getSupportedFormats(){return Promise.resolve(M.formats())}detect(e){if(!Or.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let t=Or.intrinsicDimensions(e);if(t.width===0||t.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(i=>{let n=i[0],a=i[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),mm(n.data,n.width,n.height,a)}).then(i=>i.map(n=>this.toBarcodeDetectorResult(n)))}catch(i){return Promise.reject(i)}}getScanner(){return new Promise((e,t)=>ym(this,void 0,void 0,function*(){if(!this.scanner){let i=yield gm();this.formats.length>0&&(i.setConfig(me.ZBAR_NONE,Op.ZBAR_CFG_ENABLE,0),this.formats.forEach(n=>M.configure(i,n))),this.scanner=i}e(this.scanner)}))}toImageData(e){let t=i=>{let n=Or.intrinsicDimensions(i);this.canvas&&this.canvas.width===n.width&&this.canvas.height===n.height||(this.canvas=function(s,c){if(vm)return new OffscreenCanvas(s,c);{let l=document.createElement("canvas");return l.width=s,l.height=c,l}}(n.width,n.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(i,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let i=document.createElement("img");return i.src=URL.createObjectURL(e),i.decode().then(()=>t(i)).finally(()=>URL.revokeObjectURL(i.src))}return e instanceof CanvasRenderingContext2D?Promise.resolve(e.getImageData(0,0,e.canvas.width,e.canvas.height)):Promise.resolve(t(e))}toBarcodeDetectorResult(e){let t={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0};return e.points.forEach(i=>{t.minX=Math.min(t.minX,i.x),t.maxX=Math.max(t.maxX,i.x),t.minY=Math.min(t.minY,i.y),t.maxY=Math.max(t.maxY,i.y)}),{format:M.toFormat(e.type),rawValue:e.decode(this.zbarConfig.encoding),orientation:e.orientation,quality:e.quality,boundingBox:DOMRectReadOnly.fromRect({x:t.minX,y:t.minY,width:t.maxX-t.minX,height:t.maxY-t.minY}),cornerPoints:[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]}}static isImageBitmapSource(e){return e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof Blob||e instanceof ImageData||e instanceof CanvasRenderingContext2D||e instanceof ImageBitmap||e&&e.width==0||e&&e.height==0}static intrinsicDimensions(e){return{width:Number(e.naturalWidth||e.videoWidth||e.width),height:Number(e.naturalHeight||e.videoHeight||e.height)}}};var Io=window,Oo=Io.ShadowRoot&&(Io.ShadyCSS===void 0||Io.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kc=Symbol(),Dp=new WeakMap,ia=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==kc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Oo&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Dp.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Dp.set(t,e))}return e}toString(){return this.cssText}},Np=r=>new ia(typeof r=="string"?r:r+"",void 0,kc),Tc=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new ia(t,r,kc)},Ic=(r,e)=>{Oo?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Io.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},Do=Oo?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Np(t)})(r):r;var Oc,No=window,Rp=No.trustedTypes,bm=Rp?Rp.emptyScript:"",$p=No.reactiveElementPolyfillSupport,Nc={toAttribute(r,e){switch(e){case Boolean:r=r?bm:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Pp=(r,e)=>e!==r&&(e==e||r==r),Dc={attribute:!0,type:String,converter:Nc,reflect:!1,hasChanged:Pp},Rc="finalized",mr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=Dc){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Dc}static finalize(){if(this.hasOwnProperty(Rc))return!1;this[Rc]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(Do(n))}else e!==void 0&&t.push(Do(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Ic(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=Dc){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Nc).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Nc;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Pp)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};mr[Rc]=!0,mr.elementProperties=new Map,mr.elementStyles=[],mr.shadowRootOptions={mode:"open"},$p?.({ReactiveElement:mr}),((Oc=No.reactiveElementVersions)!==null&&Oc!==void 0?Oc:No.reactiveElementVersions=[]).push("1.6.3");var $c,Ro=window,fn=Ro.trustedTypes,Lp=fn?fn.createPolicy("lit-html",{createHTML:r=>r}):void 0,Lc="$lit$",Dr=`lit$${(Math.random()+"").slice(9)}$`,Vp="?"+Dr,_m=`<${Vp}>`,hi=document,aa=()=>hi.createComment(""),oa=r=>r===null||typeof r!="object"&&typeof r!="function",Qp=Array.isArray,Sm=r=>Qp(r)||typeof r?.[Symbol.iterator]=="function",Pc=`[
|
|
2
|
+
\f\r]`,na=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fp=/-->/g,Mp=/>/g,fi=RegExp(`>|${Pc}(?:([^\\s"'>=/]+)(${Pc}*=${Pc}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Up=/'/g,jp=/"/g,zp=/^(?:script|style|textarea|title)$/i,Wp=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),F=Wp(1),Y3=Wp(2),mi=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),qp=new WeakMap,di=hi.createTreeWalker(hi,129,null,!1);function Hp(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lp!==void 0?Lp.createHTML(e):e}var wm=(r,e)=>{let t=r.length-1,i=[],n,a=e===2?"<svg>":"",o=na;for(let s=0;s<t;s++){let c=r[s],l,u,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,u=o.exec(c),u!==null);)f=o.lastIndex,o===na?u[1]==="!--"?o=Fp:u[1]!==void 0?o=Mp:u[2]!==void 0?(zp.test(u[2])&&(n=RegExp("</"+u[2],"g")),o=fi):u[3]!==void 0&&(o=fi):o===fi?u[0]===">"?(o=n??na,d=-1):u[1]===void 0?d=-2:(d=o.lastIndex-u[2].length,l=u[1],o=u[3]===void 0?fi:u[3]==='"'?jp:Up):o===jp||o===Up?o=fi:o===Fp||o===Mp?o=na:(o=fi,n=void 0);let p=o===fi&&r[s+1].startsWith("/>")?" ":"";a+=o===na?c+_m:d>=0?(i.push(l),c.slice(0,d)+Lc+c.slice(d)+Dr+p):c+Dr+(d===-2?(i.push(void 0),s):p)}return[Hp(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),i]},gi=class{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[l,u]=wm(e,t);if(this.el=gi.createElement(l,i),di.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=di.nextNode())!==null&&c.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith(Lc)||f.startsWith(Dr)){let p=u[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+Lc).split(Dr),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Mc:m[1]==="?"?Uc:m[1]==="@"?jc:hn})}else c.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(zp.test(n.tagName)){let d=n.textContent.split(Dr),f=d.length-1;if(f>0){n.textContent=fn?fn.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],aa()),di.nextNode(),c.push({type:2,index:++a});n.append(d[f],aa())}}}else if(n.nodeType===8)if(n.data===Vp)c.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(Dr,d+1))!==-1;)c.push({type:7,index:a}),d+=Dr.length-1}a++}}static createElement(e,t){let i=hi.createElement("template");return i.innerHTML=e,i}};function dn(r,e,t=r,i){var n,a,o,s;if(e===mi)return e;let c=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl,l=oa(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(r),c._$AT(r,t,i)),i!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=c:t._$Cl=c),c!==void 0&&(e=dn(r,c._$AS(r,e.values),c,i)),e}var Fc=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:i},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:hi).importNode(i,!0);di.currentNode=a;let o=di.nextNode(),s=0,c=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new yi(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new qc(o,this,e)),this._$AV.push(u),l=n[++c]}s!==l?.index&&(o=di.nextNode(),s++)}return di.currentNode=hi,a}v(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},yi=class{constructor(e,t,i,n){var a;this.type=2,this._$AH=He,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=dn(this,e,t),oa(e)?e===He||e==null||e===""?(this._$AH!==He&&this._$AR(),this._$AH=He):e!==this._$AH&&e!==mi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Sm(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==He&&oa(this._$AH)?this._$AA.nextSibling.data=e:this.$(hi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=gi.createElement(Hp(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(i);else{let o=new Fc(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let t=qp.get(e.strings);return t===void 0&&qp.set(e.strings,t=new gi(e)),t}T(e){Qp(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let a of e)n===t.length?t.push(i=new yi(this.k(aa()),this.k(aa()),this,this.options)):i=t[n],i._$AI(a),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},hn=class{constructor(e,t,i,n,a){this.type=1,this._$AH=He,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=He}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=dn(this,e,t,0),o=!oa(e)||e!==this._$AH&&e!==mi,o&&(this._$AH=e);else{let s=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=dn(this,s[i+c],t,c),l===mi&&(l=this._$AH[c]),o||(o=!oa(l)||l!==this._$AH[c]),l===He?e=He:e!==He&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}o&&!n&&this.j(e)}j(e){e===He?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Mc=class extends hn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===He?void 0:e}},Cm=fn?fn.emptyScript:"",Uc=class extends hn{constructor(){super(...arguments),this.type=4}j(e){e&&e!==He?this.element.setAttribute(this.name,Cm):this.element.removeAttribute(this.name)}},jc=class extends hn{constructor(e,t,i,n,a){super(e,t,i,n,a),this.type=5}_$AI(e,t=this){var i;if((e=(i=dn(this,e,t,0))!==null&&i!==void 0?i:He)===mi)return;let n=this._$AH,a=e===He&&n!==He||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==He&&(n===He||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},qc=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){dn(this,e)}};var Bp=Ro.litHtmlPolyfillSupport;Bp?.(gi,yi),(($c=Ro.litHtmlVersions)!==null&&$c!==void 0?$c:Ro.litHtmlVersions=[]).push("2.8.0");var Gp=(r,e,t)=>{var i,n;let a=(i=t?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new yi(e.insertBefore(aa(),s),s,void 0,t??{})}return o._$AI(r),o};var Bc,Vc;var Nr=class extends mr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gp(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return mi}};Nr.finalized=!0,Nr._$litElement$=!0,(Bc=globalThis.litElementHydrateSupport)===null||Bc===void 0||Bc.call(globalThis,{LitElement:Nr});var Kp=globalThis.litElementPolyfillSupport;Kp?.({LitElement:Nr});((Vc=globalThis.litElementVersions)!==null&&Vc!==void 0?Vc:globalThis.litElementVersions=[]).push("3.3.3");var Zp=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var Em=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},xm=(r,e,t)=>{e.constructor.createProperty(t,r)};function pt(r){return(e,t)=>t!==void 0?xm(r,e,t):Em(r,e)}function xe(r){return pt({...r,state:!0})}var Qc,xb=((Qc=window.HTMLSlotElement)===null||Qc===void 0?void 0:Qc.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var zc=function(r,e){return zc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},zc(r,e)};function Re(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var C=function(){return C=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},C.apply(this,arguments)};function Yt(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Bt(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?a(u.value):n(u.value).then(s,c)}l((i=i.apply(r,e||[])).next())})}function Vt(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(t=0)),t;)try{if(i=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(u){l=[6,u],n=0}finally{i=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Rr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var Wc="Invariant Violation",Jp=Object.setPrototypeOf,Am=Jp===void 0?function(r,e){return r.__proto__=e,r}:Jp,J=function(r){Re(e,r);function e(t){t===void 0&&(t=Wc);var i=r.call(this,typeof t=="number"?Wc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=Wc,Am(i,e.prototype),i}return e}(Error);function $(r,e){if(!r)throw new J(e)}var Po=["debug","log","warn","error","silent"],Hc=Po.indexOf("log");function $o(r){return function(){if(Po.indexOf(r)>=Hc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=$o("debug"),r.log=$o("log"),r.warn=$o("warn"),r.error=$o("error")})($||($={}));function Yp(r){var e=Po[Hc];return Hc=Math.max(0,Po.indexOf(r)),e}function Ge(r){try{return r()}catch{}}var Lo=Ge(function(){return globalThis})||Ge(function(){return window})||Ge(function(){return self})||Ge(function(){return global})||Ge(function(){return Ge.constructor("return this")()});var Xp="__",ef=[Xp,Xp].join("DEV");function km(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Lo,ef,{value:Ge(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Lo[ef]}}var vi=km();function $r(r){try{return r()}catch{}}var Gc=$r(function(){return globalThis})||$r(function(){return window})||$r(function(){return self})||$r(function(){return global})||$r(function(){return $r.constructor("return this")()}),Kc=!1;function Tm(){Gc&&!$r(function(){return"production"})&&!$r(function(){return process})&&(Object.defineProperty(Gc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Kc=!0)}Tm();function Zc(){Kc&&(delete Gc.process,Kc=!1)}var Jb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Yb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",tf=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Me=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 Jc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Im=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ca=Im;function Fo(r){var e=r.prototype.toJSON;typeof e=="function"||Jc(0),r.prototype.inspect=e,ca&&(r.prototype[ca]=e)}var rf=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Fo(rf);var nf=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Fo(nf);function Yc(r){return r!=null&&typeof r.kind=="string"}function Mo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mo=function(t){return typeof t}:Mo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo(r)}var Om=10,af=2;function la(r){return Uo(r,[])}function Uo(r,e){switch(Mo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Dm(r,e);default:return String(r)}}function Dm(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=$m(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:Uo(n,t)}else if(Array.isArray(r))return Rm(r,t);return Nm(r,t)}function Nm(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>af)return"["+Pm(r)+"]";var i=t.map(function(n){var a=Uo(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Rm(r,e){if(r.length===0)return"[]";if(e.length>af)return"[Array]";for(var t=Math.min(Om,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(Uo(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function $m(r){var e=r[String(ca)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Pm(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ua(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function of(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Lm(r,e,t){return e&&of(r.prototype,e),t&&of(r,t),r}var jo=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ua(0,"Body must be a string. Received: ".concat(la(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||ua(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ua(0,"column in locationOffset is 1-indexed and must be positive.")}return Lm(r,[{key:tf,get:function(){return"Source"}}]),r}();function sf(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
|
|
4
|
+
`)===-1,n=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!i||a||o||t,c="";return s&&!(i&&n)&&(c+=`
|
|
5
|
+
`+e),c+=e?r.replace(/\n/g,`
|
|
6
|
+
`+e):r,s&&(c+=`
|
|
7
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Fm={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"]},bi=Object.freeze({});function ct(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fm,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,l=void 0,u=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(l=f.length===0?void 0:d[d.length-1],c=u,u=f.pop(),m){if(n)c=c.slice();else{for(var v={},w=0,b=Object.keys(c);w<b.length;w++){var S=b[w];v[S]=c[S]}c=v}for(var _=0,T=0;T<s.length;T++){var R=s[T][0],A=s[T][1];n&&(R-=_),n&&A===null?(c.splice(R,1),_++):c[R]=A}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(l=u?n?o:a[o]:void 0,c=u?u[l]:p,c==null)continue;u&&d.push(l)}var N=void 0;if(!Array.isArray(c)){if(!Yc(c))throw new Error("Invalid AST Node: ".concat(la(c),"."));var L=Xc(e,c.kind,h);if(L){if(N=L.call(e,c,l,u,d,f),N===bi)break;if(N===!1){if(!h){d.pop();continue}}else if(N!==void 0&&(s.push([l,N]),!h))if(Yc(N))c=N;else{d.pop();continue}}}if(N===void 0&&m&&s.push([l,c]),h)d.pop();else{var P;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(c),a=n?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],u&&f.push(u),u=c}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Xc(r,e,t){var i=r[e];if(i){if(!t&&typeof i=="function")return i;var n=t?i.leave:i.enter;if(typeof n=="function")return n}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function mn(r){return ct(r,{leave:Um})}var Mm=80,Um={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return U(e.definitions,`
|
|
8
8
|
|
|
9
9
|
`)+`
|
|
10
|
-
`},OperationDefinition:function(e){var
|
|
11
|
-
`,
|
|
10
|
+
`},OperationDefinition:function(e){var t=e.operation,i=e.name,n=Ne("(",U(e.variableDefinitions,", "),")"),a=U(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&t==="query"?o:U([t,U([i,n]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return t+": "+i+Ne(" = ",n)+Ne(" ",U(a," "))},SelectionSet:function(e){var t=e.selections;return zt(t)},Field:function(e){var t=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Ne("",t,": ")+i,c=s+Ne("(",U(n,", "),")");return c.length>Mm&&(c=s+Ne(`(
|
|
11
|
+
`,qo(U(n,`
|
|
12
12
|
`)),`
|
|
13
|
-
)`)),U([
|
|
14
|
-
`,
|
|
13
|
+
)`)),U([c,U(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+Ne(" ",U(i," "))},InlineFragment:function(e){var t=e.typeCondition,i=e.directives,n=e.selectionSet;return U(["...",Ne("on ",t),U(i," "),n]," ")},FragmentDefinition:function(e){var t=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Ne("(",U(n,", "),")")," ")+"on ".concat(i," ").concat(Ne("",U(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var i=e.value,n=e.block;return n?sf(i,t==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+U(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+U(t,", ")+"}"},ObjectField:function(e){var t=e.name,i=e.value;return t+": "+i},Directive:function(e){var t=e.name,i=e.arguments;return"@"+t+Ne("(",U(i,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:Qt(function(r){var e=r.directives,t=r.operationTypes;return U(["schema",U(e," "),zt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,i=e.type;return t+": "+i},ScalarTypeDefinition:Qt(function(r){var e=r.name,t=r.directives;return U(["scalar",e,U(t," ")]," ")}),ObjectTypeDefinition:Qt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["type",e,Ne("implements ",U(t," & ")),U(i," "),zt(n)]," ")}),FieldDefinition:Qt(function(r){var e=r.name,t=r.arguments,i=r.type,n=r.directives;return e+(cf(t)?Ne(`(
|
|
14
|
+
`,qo(U(t,`
|
|
15
15
|
`)),`
|
|
16
|
-
)`):
|
|
17
|
-
`,
|
|
16
|
+
)`):Ne("(",U(t,", "),")"))+": "+i+Ne(" ",U(n," "))}),InputValueDefinition:Qt(function(r){var e=r.name,t=r.type,i=r.defaultValue,n=r.directives;return U([e+": "+t,Ne("= ",i),U(n," ")]," ")}),InterfaceTypeDefinition:Qt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["interface",e,Ne("implements ",U(t," & ")),U(i," "),zt(n)]," ")}),UnionTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.types;return U(["union",e,U(t," "),i&&i.length!==0?"= "+U(i," | "):""]," ")}),EnumTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.values;return U(["enum",e,U(t," "),zt(i)]," ")}),EnumValueDefinition:Qt(function(r){var e=r.name,t=r.directives;return U([e,U(t," ")]," ")}),InputObjectTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.fields;return U(["input",e,U(t," "),zt(i)]," ")}),DirectiveDefinition:Qt(function(r){var e=r.name,t=r.arguments,i=r.repeatable,n=r.locations;return"directive @"+e+(cf(t)?Ne(`(
|
|
17
|
+
`,qo(U(t,`
|
|
18
18
|
`)),`
|
|
19
|
-
)`):
|
|
20
|
-
`)}}function U(
|
|
21
|
-
`,
|
|
19
|
+
)`):Ne("(",U(t,", "),")"))+(i?" repeatable":"")+" on "+U(n," | ")}),SchemaExtension:function(e){var t=e.directives,i=e.operationTypes;return U(["extend schema",U(t," "),zt(i)]," ")},ScalarTypeExtension:function(e){var t=e.name,i=e.directives;return U(["extend scalar",t,U(i," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend type",t,Ne("implements ",U(i," & ")),U(n," "),zt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend interface",t,Ne("implements ",U(i," & ")),U(n," "),zt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,i=e.directives,n=e.types;return U(["extend union",t,U(i," "),n&&n.length!==0?"= "+U(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,i=e.directives,n=e.values;return U(["extend enum",t,U(i," "),zt(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,i=e.directives,n=e.fields;return U(["extend input",t,U(i," "),zt(n)]," ")}};function Qt(r){return function(e){return U([e.description,r(e)],`
|
|
20
|
+
`)}}function U(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function zt(r){return Ne(`{
|
|
21
|
+
`,qo(U(r,`
|
|
22
22
|
`)),`
|
|
23
|
-
}`)}function
|
|
24
|
-
`))}function
|
|
25
|
-
`)!==-1}function sf(t){return t!=null&&t.some(Um)}function pa(t){return t.kind===Me.FIELD||t.kind===Me.FRAGMENT_SPREAD||t.kind===Me.INLINE_FRAGMENT}function cf(){return typeof Mo=="function"?Kc():Kc()}function Km(){__DEV__?$(typeof bi=="boolean",bi):$(typeof bi=="boolean",39)}cf();Km();function yr(t,e){var r=t.directives;return!r||!r.length?!0:uf(r).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?$(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):$(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function yn(t,e,r){var i=new Set(t),n=i.size;return nt(e,{Directive:function(a){if(i.delete(a.name.value)&&(!r||!i.size))return _i}}),r?!i.size:i.size<n}function Xc(t){return t&&yn(["client","export"],t,!0)}function Zm(t){var e=t.name.value;return e==="skip"||e==="include"}function uf(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!Zm(r)){var i=r.arguments,n=r.name.value;__DEV__?$(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):$(i&&i.length===1,41);var a=i[0];__DEV__?$(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):$(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:r,ifArgument:a})}}),e}function eu(t,e){var r=e,i=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Z("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new Z(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof r>"u"&&(__DEV__?$(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):$(i.length===1,45),r=i[0].name.value);var n=C(C({},t),{definitions:$r([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return n}function Si(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function wi(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var i=e&&e[r];return __DEV__?$(i,"No fragment named ".concat(r)):$(i,46),i||null}default:return null}}function fe(t){return t!==null&&typeof t=="object"}function Xt(t){return{__ref:String(t)}}function se(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function tu(t){return fe(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function Jm(t){return t.kind==="StringValue"}function Ym(t){return t.kind==="BooleanValue"}function Xm(t){return t.kind==="IntValue"}function eg(t){return t.kind==="FloatValue"}function tg(t){return t.kind==="Variable"}function rg(t){return t.kind==="ObjectValue"}function ig(t){return t.kind==="ListValue"}function ng(t){return t.kind==="EnumValue"}function ag(t){return t.kind==="NullValue"}function Fr(t,e,r,i){if(Xm(r)||eg(r))t[e.value]=Number(r.value);else if(Ym(r)||Jm(r))t[e.value]=r.value;else if(rg(r)){var n={};r.fields.map(function(o){return Fr(n,o.name,o.value,i)}),t[e.value]=n}else if(tg(r)){var a=(i||{})[r.name.value];t[e.value]=a}else if(ig(r))t[e.value]=r.values.map(function(o){var s={};return Fr(s,e,o,i),s[e.value]});else if(ng(r))t[e.value]=r.value;else if(ag(r))t[e.value]=null;else throw __DEV__?new Z('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new Z(55)}function ru(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(n){r[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Fr(r[n.name.value],o,s,e)})}));var i=null;return t.arguments&&t.arguments.length&&(i={},t.arguments.forEach(function(n){var a=n.name,o=n.value;return Fr(i,a,o,e)})),da(t.name.value,i,r)}var og=["connection","include","skip","client","rest","export"],da=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var i=r.connection.filter?r.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(r.connection.key,"(").concat(fa(n),")")}else return r.connection.key;var a=t;if(e){var o=fa(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){og.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(fa(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=fa;return fa=t,e}}),fa=function(e){return JSON.stringify(e,sg)};function sg(t,e){return fe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,i){return r[i]=e[i],r},{})),e}function vr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(i){var n=i.name,a=i.value;return Fr(r,n,a,e)}),r}return null}function Rt(t){return t.alias?t.alias.value:t.name.value}function ha(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(Et(a)){if(a.name.value==="__typename")return t[Rt(a)]}else{var o=ha(t,wi(a,r).selectionSet,r);if(typeof o=="string")return o}}}function Et(t){return t.kind==="Field"}function iu(t){return t.kind==="InlineFragment"}function vn(t){__DEV__?$(t&&t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new Z('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new Z(48);return r});return __DEV__?$(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):$(e.length<=1,49),t}function er(t){return vn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function bn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Ci(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function ma(t){var e=er(t);return __DEV__?$(e&&e.operation==="query","Must contain a query definition."):$(e&&e.operation==="query",50),e}function nu(t){__DEV__?$(t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(t.kind==="Document",51),__DEV__?$(t.definitions.length<=1,"Fragment must have exactly one definition."):$(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?$(e.kind==="FragmentDefinition","Must be a fragment definition."):$(e.kind==="FragmentDefinition",53),e}function Ei(t){vn(t);for(var e,r=0,i=t.definitions;r<i.length;r++){var n=i[r];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new Z("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Z(54)}function xi(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(i){i.defaultValue&&Fr(e,i.variable.name,i.defaultValue)}),e}var Se=Array.isArray;function qe(t){return Array.isArray(t)&&t.length>0}var lf={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function ff(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Me.FRAGMENT_SPREAD&&ff(e[r.name.value],e)})}function cg(t){return ff(er(t)||nu(t),Si(Ci(t)))?null:t}function ug(t){var e=new Set,r=[];return t.forEach(function(i){i.name?e.add(i.name):i.test&&r.push(i.test)}),function(i){return e.has(i.name.value)||r.some(function(n){return n(i)})}}function pf(t){var e=new Map;return function(i){i===void 0&&(i=t);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function au(t,e){for(var r=pf(""),i=pf(""),n=function(S){for(var w=0,v=void 0;w<S.length&&(v=S[w]);++w)if(!Se(v)){if(v.kind===Me.OPERATION_DEFINITION)return r(v.name&&v.name.value);if(v.kind===Me.FRAGMENT_DEFINITION)return i(v.name.value)}return __DEV__&&$.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Me.OPERATION_DEFINITION&&++a;var s=ug(t),u=t.some(function(S){return S.remove}),c=function(S){return u&&S&&S.some(s)},l=new Map,d=!1,f={enter:function(S){if(c(S.directives))return d=!0,null}},p=nt(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,w,v,D,N){var A=n(N);A&&A.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,w,v,D,N){if(c(S.directives))return d=!0,null;var A=n(N);A&&A.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,w,v,D){l.set(JSON.stringify(D),S)},leave:function(S,w,v,D){var N=l.get(JSON.stringify(D));if(S===N)return S;if(a>0&&S.selectionSet.selections.every(function(A){return A.kind===Me.FIELD&&A.name.value==="__typename"}))return i(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(s(S))return d=!0,null}}});if(!d)return e;var h=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(w){h(i(w)).transitiveVars.forEach(function(v){S.transitiveVars.add(v)})})),S},m=new Set;p.definitions.forEach(function(S){S.kind===Me.OPERATION_DEFINITION?h(r(S.name&&S.name.value)).fragmentSpreads.forEach(function(w){m.add(w)}):S.kind===Me.FRAGMENT_DEFINITION&&a===0&&!i(S.name.value).removed&&m.add(S.name.value)}),m.forEach(function(S){h(i(S)).fragmentSpreads.forEach(function(w){m.add(w)})});var b=function(S){return!!(!m.has(S)||i(S).removed)},_={enter:function(S){if(b(S.name.value))return null}};return cg(nt(p,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var w=h(r(S.name&&S.name.value)).transitiveVars;if(w.size<S.variableDefinitions.length)return C(C({},S),{variableDefinitions:S.variableDefinitions.filter(function(v){return w.has(v.variable.name.value)})})}}}}))}var Ai=Object.assign(function(t){return nt(t,{SelectionSet:{enter:function(e,r,i){if(!(i&&i.kind===Me.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return Et(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(Et(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return C(C({},e),{selections:$r($r([],n,!0),[lf],!1)})}}}}}})},{added:function(t){return t===lf}}),lg={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&$.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function ou(t){return au([lg],vn(t))}function su(t){var e=Ei(t),r=e.operation;if(r==="query")return t;var i=nt(t,{OperationDefinition:{enter:function(n){return C(C({},n),{operation:"query"})}}});return i}function cu(t){vn(t);var e=au([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var pg=Object.prototype.hasOwnProperty;function uu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ga(t)}function ga(t){var e=t[0]||{},r=t.length;if(r>1)for(var i=new mt,n=1;n<r;++n)e=i.merge(e,t[n]);return e}var fg=function(t,e,r){return this.merge(t[r],e[r])},mt=function(){function t(e){e===void 0&&(e=fg),this.reconciler=e,this.isObject=fe,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return fe(r)&&fe(e)?(Object.keys(r).forEach(function(o){if(pg.call(e,o)){var s=e[o];if(r[o]!==s){var u=i.reconciler.apply(i,$r([e,r,o],n,!1));u!==s&&(e=i.shallowCopyForMerge(e),e[o]=u)}}else e=i.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return fe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=C({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function dg(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=hg(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
26
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hg(t,e){if(!!t){if(typeof t=="string")return df(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return df(t,e)}}function df(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function hf(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function du(t,e,r){return e&&hf(t.prototype,e),r&&hf(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var hu=function(){return typeof Symbol=="function"},mu=function(t){return hu()&&Boolean(Symbol[t])},gu=function(t){return mu(t)?Symbol[t]:"@@"+t};hu()&&!mu("observable")&&(Symbol.observable=Symbol("observable"));var mg=gu("iterator"),pu=gu("observable"),mf=gu("species");function qo(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function ya(t){var e=t.constructor;return e!==void 0&&(e=e[mf],e===null&&(e=void 0)),e!==void 0?e:oe}function gg(t){return t instanceof oe}function _n(t){_n.log?_n.log(t):setTimeout(function(){throw t})}function jo(t){Promise.resolve().then(function(){try{t()}catch(e){_n(e)}})}function gf(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=qo(e,"unsubscribe");r&&r.call(e)}}catch(i){_n(i)}}function fu(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function yg(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(yf(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function yf(t,e,r){t._state="running";var i=t._observer;try{var n=qo(i,e);switch(e){case"next":n&&n.call(i,r);break;case"error":if(fu(t),n)n.call(i,r);else throw r;break;case"complete":fu(t),n&&n.call(i);break}}catch(a){_n(a)}t._state==="closed"?gf(t):t._state==="running"&&(t._state="ready")}function lu(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],jo(function(){return yg(t)});return}yf(t,e,r)}}var vg=function(){function t(r,i){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var n=new bg(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(fu(this),gf(this))},du(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),bg=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(i){lu(this._subscription,"next",i)},e.error=function(i){lu(this._subscription,"error",i)},e.complete=function(){lu(this._subscription,"complete")},du(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),oe=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new vg(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){u.unsubscribe(),a()}var u=n.subscribe({next:function(c){try{i(c,s)}catch(l){o(l),u.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this),o=arguments.length>1,s=!1,u=arguments[1],c=u;return new a(function(l){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{c=i(c,d)}catch(p){return l.error(p)}else c=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(c),l.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=ya(this);return new s(function(u){var c,l=0;function d(f){c=f.subscribe({next:function(p){u.next(p)},error:function(p){u.error(p)},complete:function(){l===a.length?(c=void 0,u.complete()):d(s.from(a[l++]))}})}return d(i),function(){c&&(c.unsubscribe(),c=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){var s=[],u=n.subscribe({next:function(l){if(i)try{l=i(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),c()}});s.push(d)},error:function(l){o.error(l)},complete:function(){c()}});function c(){u.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),u.unsubscribe()}})},e[pu]=function(){return this},t.from=function(i){var n=typeof this=="function"?this:t;if(i==null)throw new TypeError(i+" is not an object");var a=qo(i,pu);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return gg(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(mu("iterator")&&(a=qo(i,mg),a))return new n(function(s){jo(function(){if(!s.closed){for(var u=dg(a.call(i)),c;!(c=u()).done;){var l=c.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){jo(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},t.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:t;return new o(function(s){jo(function(){if(!s.closed){for(var u=0;u<n.length;++u)if(s.next(n[u]),s.closed)return;s.complete()}})})},du(t,null,[{key:mf,get:function(){return this}}]),t}();hu()&&Object.defineProperty(oe,Symbol("extensions"),{value:{symbol:pu,hostReportError:_n},configurable:!0});function yu(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var Sn;typeof self<"u"?Sn=self:typeof window<"u"?Sn=window:typeof global<"u"?Sn=global:typeof module<"u"?Sn=module:Sn=Function("return this")();var E4=yu(Sn);var vf=oe.prototype,bf="@@observable";vf[bf]||(vf[bf]=function(){return this});var _g=Object.prototype.toString;function Bo(t){return vu(t)}function vu(t,e){switch(_g.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(n,a){r[a]=vu(n,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var i=Object.create(Object.getPrototypeOf(t));return e.set(t,i),Object.keys(t).forEach(function(n){i[n]=vu(t[n],e)}),i}default:return t}}function Sg(t){var e=new Set([t]);return e.forEach(function(r){fe(r)&&wg(r)===r&&Object.getOwnPropertyNames(r).forEach(function(i){fe(r[i])&&e.add(r[i])})}),t}function wg(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function va(t){return __DEV__&&Sg(t),t}function ki(t,e,r){var i=[];t.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](r)})}function Vo(t,e,r){return new oe(function(i){var n=i.next,a=i.error,o=i.complete,s=0,u=!1,c={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var b=function(){return p(m)};c=c.then(b,b).then(function(_){--s,n&&n.call(i,_),u&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(i,_)})}:function(m){return h&&h.call(i,m)}}var d={next:l(e,n),error:l(r,a),complete:function(){u=!0,s||o&&o.call(i)}},f=t.subscribe(d);return function(){return f.unsubscribe()}})}var Pt=typeof WeakMap=="function"&&He(function(){return navigator.product})!=="ReactNative",_f=typeof WeakSet=="function",bu=typeof Symbol=="function"&&typeof Symbol.for=="function",Mr=bu&&Symbol.asyncIterator,F4=typeof He(function(){return window.document.createElement})=="function",M4=He(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Qo(t){function e(r){Object.defineProperty(t,r,{value:oe})}return bu&&Symbol.species&&e(Symbol.species),e("@@species"),t}function Sf(t){return t&&typeof t.then=="function"}var wn=function(t){Re(e,t);function e(r){var i=t.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),ki(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),ki(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var u=s.shift();u?Sf(u)?u.then(function(c){return i.sub=c.subscribe(i.handlers)}):i.sub=u.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),ki(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof r=="function"&&(r=[new oe(r)]),Sf(r)?r.then(function(n){return i.start(n)},i.handlers.error):i.start(r),i}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var i=this.latest[0],n=r[i];n&&n.call(r,this.latest[1]),this.sub===null&&i==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(r,i)}))},e.prototype.beforeNext=function(r){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,r(n,a))})},e}(oe);Qo(wn);function Ur(t){return"incremental"in t}function Cg(t){return"hasNext"in t&&"data"in t}function wf(t){return Ur(t)||Cg(t)}function zo(t,e){var r=t,i=new mt;return Ur(e)&&qe(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var u=o[s],c=!isNaN(+u),l=c?[]:{};l[u]=a,a=l}r=i.merge(r,a)}),r}function Cn(t){var e=Wo(t);return qe(e)}function Wo(t){var e=qe(t.errors)?t.errors.slice(0):[];return Ur(t)&&qe(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function jr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(r[n]=a)})}),r}var Cf=new Map;function ba(t){var e=Cf.get(t)||1;return Cf.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ef(t){var e=ba("stringifyForDisplay");return JSON.stringify(t,function(r,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function _a(t,e){return jr(t,e,e.variables&&{variables:C(C({},t&&t.variables),e.variables)})}function Ho(t){return new oe(function(e){e.error(t)})}var Sa=function(t,e,r){var i=new Error(r);throw i.name="ServerError",i.response=t,i.statusCode=t.status,i.result=e,i};function _u(t){for(var e=["query","operationName","variables","extensions","context"],r=0,i=Object.keys(t);r<i.length;r++){var n=i[r];if(e.indexOf(n)<0)throw __DEV__?new Z("illegal argument: ".concat(n)):new Z(27)}return t}function Su(t,e){var r=C({},t),i=function(a){typeof a=="function"?r=C(C({},r),a(r)):r=C(C({},r),a)},n=function(){return C({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function wu(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?bn(e.query)||void 0:""),e}function xf(t,e){return e?e(t):oe.of()}function wa(t){return typeof t=="function"?new $t(t):t}function Go(t){return t.request.length<=1}var Eg=function(t){Re(e,t);function e(r,i){var n=t.call(this,r)||this;return n.link=i,n}return e}(Error),$t=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return oe.of()})},t.from=function(e){return e.length===0?t.empty():e.map(wa).reduce(function(r,i){return r.concat(i)})},t.split=function(e,r,i){var n=wa(r),a=wa(i||new t(xf));return Go(n)&&Go(a)?new t(function(o){return e(o)?n.request(o)||oe.of():a.request(o)||oe.of()}):new t(function(o,s){return e(o)?n.request(o,s)||oe.of():a.request(o,s)||oe.of()})},t.execute=function(e,r){return e.request(Su(r.context,wu(_u(r))))||oe.of()},t.concat=function(e,r){var i=wa(e);if(Go(i))return __DEV__&&$.warn(new Eg("You are calling concat on a terminating link, which will have no effect",i)),i;var n=wa(r);return Go(n)?new t(function(a){return i.request(a,function(o){return n.request(o)||oe.of()})||oe.of()}):new t(function(a,o){return i.request(a,function(s){return n.request(s,o)||oe.of()})||oe.of()})},t.prototype.split=function(e,r,i){return this.concat(t.split(e,r,i||new t(xf)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new Z("request is not implemented"):new Z(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var En=$t.execute;var Af="3.7.10";function kf(t){return!!t.body}function Tf(t){return!!t.getReader}function If(t){return!!(Mr&&t[Symbol.asyncIterator])}function Of(t){return!!t.stream}function Df(t){return!!t.arrayBuffer}function Nf(t){return!!t.pipe}function Cu(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Eu(t){var e=null,r=null,i=!1,n=[],a=[];function o(d){if(!r){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){r=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function u(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,t.removeListener("data",o),t.removeListener("error",s),t.removeListener("end",u),t.removeListener("finish",u),t.removeListener("close",u)},t.on("data",o),t.on("error",s),t.on("end",u),t.on("finish",u),t.on("close",u);function c(){return new Promise(function(d,f){if(r)return f(r);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return c()}};return Mr&&(l[Symbol.asyncIterator]=function(){return this}),l}function xu(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){t.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Mr&&(r[Symbol.asyncIterator]=function(){return this}),r}function Ko(t){var e={next:function(){return t.read()}};return Mr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Rf(t){var e=t;if(kf(t)&&(e=t.body),If(e))return Cu(e);if(Tf(e))return Ko(e.getReader());if(Of(e))return Ko(e.stream().getReader());if(Df(e))return xu(e.arrayBuffer());if(Nf(e))return Eu(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Pf=Object.prototype.hasOwnProperty;function $f(t,e){var r,i,n;return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h,m,b,_,S,w,v,D,N,A,R;return Vt(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",u=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="--".concat(u),l="",d=Rf(t),f=!0,F.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=F.sent(),h=p.value,m=p.done,b=typeof h=="string"?h:a.decode(h),f=!m,l+=b,_=l.indexOf(c);_>-1;){if(S=void 0,R=[l.slice(0,_),l.slice(_+c.length)],S=R[0],l=R[1],S.trim()){if(w=S.indexOf(`\r
|
|
23
|
+
}`)}function Ne(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function qo(r){return Ne(" ",r.replace(/\n/g,`
|
|
24
|
+
`))}function jm(r){return r.indexOf(`
|
|
25
|
+
`)!==-1}function cf(r){return r!=null&&r.some(jm)}function pa(r){return r.kind===Me.FIELD||r.kind===Me.FRAGMENT_SPREAD||r.kind===Me.INLINE_FRAGMENT}function lf(){return typeof jo=="function"?Zc():Zc()}function Zm(){__DEV__?$(typeof vi=="boolean",vi):$(typeof vi=="boolean",39)}lf();Zm();function gr(r,e){var t=r.directives;return!t||!t.length?!0:uf(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?$(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):$(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function gn(r,e,t){var i=new Set(r),n=i.size;return ct(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return bi}}),t?!i.size:i.size<n}function el(r){return r&&gn(["client","export"],r,!0)}function Jm(r){var e=r.name.value;return e==="skip"||e==="include"}function uf(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Jm(t)){var i=t.arguments,n=t.name.value;__DEV__?$(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):$(i&&i.length===1,41);var a=i[0];__DEV__?$(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):$(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function tl(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new J("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new J(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?$(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):$(i.length===1,45),t=i[0].name.value);var n=C(C({},r),{definitions:Rr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function _i(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Si(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?$(i,"No fragment named ".concat(t)):$(i,46),i||null}default:return null}}function pe(r){return r!==null&&typeof r=="object"}function Xt(r){return{__ref:String(r)}}function oe(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function rl(r){return pe(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Ym(r){return r.kind==="StringValue"}function Xm(r){return r.kind==="BooleanValue"}function eg(r){return r.kind==="IntValue"}function tg(r){return r.kind==="FloatValue"}function rg(r){return r.kind==="Variable"}function ig(r){return r.kind==="ObjectValue"}function ng(r){return r.kind==="ListValue"}function ag(r){return r.kind==="EnumValue"}function og(r){return r.kind==="NullValue"}function Pr(r,e,t,i){if(eg(t)||tg(t))r[e.value]=Number(t.value);else if(Xm(t)||Ym(t))r[e.value]=t.value;else if(ig(t)){var n={};t.fields.map(function(o){return Pr(n,o.name,o.value,i)}),r[e.value]=n}else if(rg(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(ng(t))r[e.value]=t.values.map(function(o){var s={};return Pr(s,e,o,i),s[e.value]});else if(ag(t))r[e.value]=t.value;else if(og(t))r[e.value]=null;else throw __DEV__?new J('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new J(55)}function il(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Pr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Pr(i,a,o,e)})),da(r.name.value,i,t)}var sg=["connection","include","skip","client","rest","export"],da=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(fa(n),")")}else return t.connection.key;var a=r;if(e){var o=fa(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){sg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(fa(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=fa;return fa=r,e}}),fa=function(e){return JSON.stringify(e,cg)};function cg(r,e){return pe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function yr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Pr(t,n,a,e)}),t}return null}function Rt(r){return r.alias?r.alias.value:r.name.value}function ha(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(Et(a)){if(a.name.value==="__typename")return r[Rt(a)]}else{var o=ha(r,Si(a,t).selectionSet,t);if(typeof o=="string")return o}}}function Et(r){return r.kind==="Field"}function nl(r){return r.kind==="InlineFragment"}function yn(r){__DEV__?$(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new J('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new J(48);return t});return __DEV__?$(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):$(e.length<=1,49),r}function er(r){return yn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function vn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function wi(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function ma(r){var e=er(r);return __DEV__?$(e&&e.operation==="query","Must contain a query definition."):$(e&&e.operation==="query",50),e}function al(r){__DEV__?$(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(r.kind==="Document",51),__DEV__?$(r.definitions.length<=1,"Fragment must have exactly one definition."):$(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?$(e.kind==="FragmentDefinition","Must be a fragment definition."):$(e.kind==="FragmentDefinition",53),e}function Ci(r){yn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new J("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new J(54)}function Ei(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Pr(e,i.variable.name,i.defaultValue)}),e}var we=Array.isArray;function qe(r){return Array.isArray(r)&&r.length>0}var pf={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function df(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Me.FRAGMENT_SPREAD&&df(e[t.name.value],e)})}function lg(r){return df(er(r)||al(r),_i(wi(r)))?null:r}function ug(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function ff(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function ol(r,e){for(var t=ff(""),i=ff(""),n=function(b){for(var S=0,_=void 0;S<b.length&&(_=b[S]);++S)if(!we(_)){if(_.kind===Me.OPERATION_DEFINITION)return t(_.name&&_.name.value);if(_.kind===Me.FRAGMENT_DEFINITION)return i(_.name.value)}return __DEV__&&$.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Me.OPERATION_DEFINITION&&++a;var s=ug(r),c=r.some(function(b){return b.remove}),l=function(b){return c&&b&&b.some(s)},u=new Map,d=!1,f={enter:function(b){if(l(b.directives))return d=!0,null}},p=ct(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,S,_,T,R){var A=n(R);A&&A.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,S,_,T,R){if(l(b.directives))return d=!0,null;var A=n(R);A&&A.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,S,_,T){u.set(JSON.stringify(T),b)},leave:function(b,S,_,T){var R=u.get(JSON.stringify(T));if(b===R)return b;if(a>0&&b.selectionSet.selections.every(function(A){return A.kind===Me.FIELD&&A.name.value==="__typename"}))return i(b.name.value).removed=!0,d=!0,null}},Directive:{leave:function(b){if(s(b))return d=!0,null}}});if(!d)return e;var h=function(b){return b.transitiveVars||(b.transitiveVars=new Set(b.variables),b.removed||b.fragmentSpreads.forEach(function(S){h(i(S)).transitiveVars.forEach(function(_){b.transitiveVars.add(_)})})),b},m=new Set;p.definitions.forEach(function(b){b.kind===Me.OPERATION_DEFINITION?h(t(b.name&&b.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):b.kind===Me.FRAGMENT_DEFINITION&&a===0&&!i(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(i(b)).fragmentSpreads.forEach(function(S){m.add(S)})});var v=function(b){return!!(!m.has(b)||i(b).removed)},w={enter:function(b){if(v(b.name.value))return null}};return lg(ct(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var S=h(t(b.name&&b.name.value)).transitiveVars;if(S.size<b.variableDefinitions.length)return C(C({},b),{variableDefinitions:b.variableDefinitions.filter(function(_){return S.has(_.variable.name.value)})})}}}}))}var xi=Object.assign(function(r){return ct(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===Me.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return Et(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(Et(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return C(C({},e),{selections:Rr(Rr([],n,!0),[pf],!1)})}}}}}})},{added:function(r){return r===pf}}),pg={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&$.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function sl(r){return ol([pg],yn(r))}function cl(r){var e=Ci(r),t=e.operation;if(t==="query")return r;var i=ct(r,{OperationDefinition:{enter:function(n){return C(C({},n),{operation:"query"})}}});return i}function ll(r){yn(r);var e=ol([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var fg=Object.prototype.hasOwnProperty;function ul(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ga(r)}function ga(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new yt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var dg=function(r,e,t){return this.merge(r[t],e[t])},yt=function(){function r(e){e===void 0&&(e=dg),this.reconciler=e,this.isObject=pe,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return pe(t)&&pe(e)?(Object.keys(t).forEach(function(o){if(fg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Rr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return pe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=C({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function hg(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=mg(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
26
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mg(r,e){if(!!r){if(typeof r=="string")return hf(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hf(r,e)}}function hf(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function mf(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function hl(r,e,t){return e&&mf(r.prototype,e),t&&mf(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var ml=function(){return typeof Symbol=="function"},gl=function(r){return ml()&&Boolean(Symbol[r])},yl=function(r){return gl(r)?Symbol[r]:"@@"+r};ml()&&!gl("observable")&&(Symbol.observable=Symbol("observable"));var gg=yl("iterator"),fl=yl("observable"),gf=yl("species");function Vo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ya(r){var e=r.constructor;return e!==void 0&&(e=e[gf],e===null&&(e=void 0)),e!==void 0?e:ae}function yg(r){return r instanceof ae}function bn(r){bn.log?bn.log(r):setTimeout(function(){throw r})}function Bo(r){Promise.resolve().then(function(){try{r()}catch(e){bn(e)}})}function yf(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Vo(e,"unsubscribe");t&&t.call(e)}}catch(i){bn(i)}}function dl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function vg(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(vf(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function vf(r,e,t){r._state="running";var i=r._observer;try{var n=Vo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(dl(r),n)n.call(i,t);else throw t;break;case"complete":dl(r),n&&n.call(i);break}}catch(a){bn(a)}r._state==="closed"?yf(r):r._state==="running"&&(r._state="ready")}function pl(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Bo(function(){return vg(r)});return}vf(r,e,t)}}var bg=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new _g(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(dl(this),yf(this))},hl(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),_g=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){pl(this._subscription,"next",i)},e.error=function(i){pl(this._subscription,"error",i)},e.complete=function(){pl(this._subscription,"complete")},hl(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ae=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new bg(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(l){try{i(l,s)}catch(u){o(u),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this),o=arguments.length>1,s=!1,c=arguments[1],l=c;return new a(function(u){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{l=i(l,d)}catch(p){return u.error(p)}else l=d},error:function(d){u.error(d)},complete:function(){if(!s&&!o)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(l),u.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=ya(this);return new s(function(c){var l,u=0;function d(f){l=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){u===a.length?(l=void 0,c.complete()):d(s.from(a[u++]))}})}return d(i),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){var s=[],c=n.subscribe({next:function(u){if(i)try{u=i(u)}catch(f){return o.error(f)}var d=a.from(u).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),l()}});s.push(d)},error:function(u){o.error(u)},complete:function(){l()}});function l(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(u){return u.unsubscribe()}),c.unsubscribe()}})},e[fl]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Vo(i,fl);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return yg(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(gl("iterator")&&(a=Vo(i,gg),a))return new n(function(s){Bo(function(){if(!s.closed){for(var c=hg(a.call(i)),l;!(l=c()).done;){var u=l.value;if(s.next(u),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){Bo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){Bo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},hl(r,null,[{key:gf,get:function(){return this}}]),r}();ml()&&Object.defineProperty(ae,Symbol("extensions"),{value:{symbol:fl,hostReportError:bn},configurable:!0});function vl(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var _n;typeof self<"u"?_n=self:typeof window<"u"?_n=window:typeof global<"u"?_n=global:typeof module<"u"?_n=module:_n=Function("return this")();var x4=vl(_n);var bf=ae.prototype,_f="@@observable";bf[_f]||(bf[_f]=function(){return this});var Sg=Object.prototype.toString;function Qo(r){return bl(r)}function bl(r,e){switch(Sg.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=bl(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=bl(r[n],e)}),i}default:return r}}function wg(r){var e=new Set([r]);return e.forEach(function(t){pe(t)&&Cg(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){pe(t[i])&&e.add(t[i])})}),r}function Cg(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function va(r){return __DEV__&&wg(r),r}function Ai(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function zo(r,e,t){return new ae(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,l={then:function(p){return new Promise(function(h){return h(p())})}};function u(p,h){return p?function(m){++s;var v=function(){return p(m)};l=l.then(v,v).then(function(w){--s,n&&n.call(i,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(i,w)})}:function(m){return h&&h.call(i,m)}}var d={next:u(e,n),error:u(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var $t=typeof WeakMap=="function"&&Ge(function(){return navigator.product})!=="ReactNative",Sf=typeof WeakSet=="function",_l=typeof Symbol=="function"&&typeof Symbol.for=="function",Lr=_l&&Symbol.asyncIterator,M4=typeof Ge(function(){return window.document.createElement})=="function",U4=Ge(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Wo(r){function e(t){Object.defineProperty(r,t,{value:ae})}return _l&&Symbol.species&&e(Symbol.species),e("@@species"),r}function wf(r){return r&&typeof r.then=="function"}var Sn=function(r){Re(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),Ai(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),Ai(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?wf(c)?c.then(function(l){return i.sub=l.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Ai(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new ae(t)]),wf(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(ae);Wo(Sn);function Fr(r){return"incremental"in r}function Eg(r){return"hasNext"in r&&"data"in r}function Cf(r){return Fr(r)||Eg(r)}function Ho(r,e){var t=r,i=new yt;return Fr(e)&&qe(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],l=!isNaN(+c),u=l?[]:{};u[c]=a,a=u}t=i.merge(t,a)}),t}function wn(r){var e=Go(r);return qe(e)}function Go(r){var e=qe(r.errors)?r.errors.slice(0):[];return Fr(r)&&qe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Mr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Ef=new Map;function ba(r){var e=Ef.get(r)||1;return Ef.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function xf(r){var e=ba("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function _a(r,e){return Mr(r,e,e.variables&&{variables:C(C({},r&&r.variables),e.variables)})}function Ko(r){return new ae(function(e){e.error(r)})}var Sa=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function Sl(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new J("illegal argument: ".concat(n)):new J(27)}return r}function wl(r,e){var t=C({},r),i=function(a){typeof a=="function"?t=C(C({},t),a(t)):t=C(C({},t),a)},n=function(){return C({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function Cl(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?vn(e.query)||void 0:""),e}function Af(r,e){return e?e(r):ae.of()}function wa(r){return typeof r=="function"?new Pt(r):r}function Zo(r){return r.request.length<=1}var xg=function(r){Re(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Pt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ae.of()})},r.from=function(e){return e.length===0?r.empty():e.map(wa).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=wa(t),a=wa(i||new r(Af));return Zo(n)&&Zo(a)?new r(function(o){return e(o)?n.request(o)||ae.of():a.request(o)||ae.of()}):new r(function(o,s){return e(o)?n.request(o,s)||ae.of():a.request(o,s)||ae.of()})},r.execute=function(e,t){return e.request(wl(t.context,Cl(Sl(t))))||ae.of()},r.concat=function(e,t){var i=wa(e);if(Zo(i))return __DEV__&&$.warn(new xg("You are calling concat on a terminating link, which will have no effect",i)),i;var n=wa(t);return Zo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||ae.of()})||ae.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||ae.of()})||ae.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Af)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new J("request is not implemented"):new J(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var Cn=Pt.execute;var kf="3.7.10";function Tf(r){return!!r.body}function If(r){return!!r.getReader}function Of(r){return!!(Lr&&r[Symbol.asyncIterator])}function Df(r){return!!r.stream}function Nf(r){return!!r.arrayBuffer}function Rf(r){return!!r.pipe}function El(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function xl(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function l(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var u={next:function(){return l()}};return Lr&&(u[Symbol.asyncIterator]=function(){return this}),u}function Al(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Lr&&(t[Symbol.asyncIterator]=function(){return this}),t}function Jo(r){var e={next:function(){return r.read()}};return Lr&&(e[Symbol.asyncIterator]=function(){return this}),e}function $f(r){var e=r;if(Tf(r)&&(e=r.body),Of(e))return El(e);if(If(e))return Jo(e.getReader());if(Df(e))return Jo(e.stream().getReader());if(Nf(e))return Al(e.arrayBuffer());if(Rf(e))return xl(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Pf=Object.prototype.hasOwnProperty;function Lf(r,e){var t,i,n;return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h,m,v,w,b,S,_,T,R,A,N;return Vt(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),u="",d=$f(r),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,v=typeof h=="string"?h:a.decode(h),f=!m,u+=v,w=u.indexOf(l);w>-1;){if(b=void 0,N=[u.slice(0,w),u.slice(w+l.length)],b=N[0],u=N[1],b.trim()){if(S=b.indexOf(`\r
|
|
27
27
|
\r
|
|
28
|
-
`),
|
|
29
|
-
`,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((i=e.next)===null||i===void 0||i.call(e,A))}catch(P){
|
|
30
|
-
`).forEach(function(
|
|
28
|
+
`),_=Ag(b.slice(0,S)),T=_["content-type"],T&&T.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=b.slice(S);try{A=Ff(r,R.replace(`\r
|
|
29
|
+
`,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((i=e.next)===null||i===void 0||i.call(e,A))}catch(P){Yo(P,e)}}w=u.indexOf(l)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function Ag(r){var e={};return r.split(`
|
|
30
|
+
`).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function Ff(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Sa(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=r,i.statusCode=r.status,i.bodyText=e,i}}function Yo(r,e){var t,i;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(i=e.error)===null||i===void 0||i.call(e,r))}function Mf(r,e,t){kg(e)(r).then(function(i){var n,a;(n=t.next)===null||n===void 0||n.call(t,i),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(i){return Yo(i,t)})}function kg(r){return function(e){return e.text().then(function(t){return Ff(e,t)}).then(function(t){return e.status>=300&&Sa(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Pf.call(t,"data")&&!Pf.call(t,"errors")&&Sa(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(i){return i.operationName}):r.operationName,"'.")),t})}}var Ca=function(r,e){var t;try{t=JSON.stringify(r)}catch(n){var i=__DEV__?new J("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new J(24);throw i.parseError=n,i}return t};var Tg={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Ig={accept:"*/*","content-type":"application/json"},Og={method:"POST"},Uf={http:Tg,headers:Ig,options:Og},jf=function(r,e){return e(r)};function qf(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];var n={},a={};t.forEach(function(d){n=C(C(C({},n),d.options),{headers:C(C({},n.headers),d.headers)}),d.credentials&&(n.credentials=d.credentials),a=C(C({},a),d.http)}),n.headers&&(n.headers=Dg(n.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,l=r.query,u={operationName:o,variables:c};return a.includeExtensions&&(u.extensions=s),a.includeQuery&&(u.query=e(l,mn)),{options:n,body:u}}function Dg(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var i=Object.create(null);Object.keys(Object(r)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:r[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var Bf=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new J(`
|
|
31
31
|
"fetch" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:
|
|
32
32
|
|
|
33
33
|
import fetch from 'cross-fetch';
|
|
@@ -35,9 +35,9 @@ import { ApolloClient, HttpLink } from '@apollo/client';
|
|
|
35
35
|
const client = new ApolloClient({
|
|
36
36
|
link: new HttpLink({ uri: '/graphql', fetch })
|
|
37
37
|
});
|
|
38
|
-
`):new Z(23)};var Bf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var Vf=function(t,e){var r=t.getContext(),i=r.uri;return i||(typeof e=="function"?e(t):e||"/graphql")};function Qf(t,e){var r=[],i=function(d,f){r.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Ca(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Ca(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=t,u=t.indexOf("#");u!==-1&&(o=t.substr(u),s=t.substr(0,u));var c=s.indexOf("?")===-1?"?":"&",l=s+c+r.join("&")+o;return{newURI:l}}var zf=He(function(){return fetch}),Wf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,i=t.fetch,n=t.print,a=n===void 0?Uf:n,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,d=Yt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&qf(i||zf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new $t(function(p){var h=Vf(p,r),m=p.getContext(),b={};if(m.clientAwareness){var _=m.clientAwareness,S=_.name,w=_.version;S&&(b["apollographql-client-name"]=S),w&&(b["apollographql-client-version"]=w)}var v=C(C({},b),m.headers),D={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:v},N=jf(p,a,Mf,f,D),A=N.options,R=N.body;if(R.variables&&!l){var F=new Set(Object.keys(R.variables));nt(p.query,{Variable:function(pe,Zt,ae){ae&&ae.kind!=="VariableDefinition"&&F.delete(pe.name.value)}}),F.size&&(R.variables=C({},R.variables),F.forEach(function(pe){delete R.variables[pe]}))}var P;if(!A.signal){var j=Bf(),Je=j.controller,je=j.signal;P=Je,P&&(A.signal=je)}var H=function(pe){return pe.kind==="OperationDefinition"&&pe.operation==="mutation"};if(u&&!p.query.definitions.some(H)&&(A.method="GET"),yn(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var we=Qf(h,R),Ce=we.newURI,le=we.parseError;if(le)return Ho(le);h=Ce}else try{A.body=Ca(R,"Payload")}catch(pe){return Ho(pe)}return new oe(function(pe){var Zt=i||He(function(){return fetch})||zf;return Zt(h,A).then(function(ae){var Jt;p.setContext({response:ae});var Dr=(Jt=ae.headers)===null||Jt===void 0?void 0:Jt.get("content-type");return Dr!==null&&/^multipart\/mixed/i.test(Dr)?$f(ae,pe):Ff(ae,p,pe)}).catch(function(ae){return Zo(ae,pe)}),function(){P&&P.abort()}})})};var Au=function(t){Re(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,Wf(r).request)||this;return i.options=r,i}return e}($t);var{toString:Hf,hasOwnProperty:Dg}=Object.prototype,Gf=Function.prototype.toString,ku=new Map;function ke(t,e){try{return Tu(t,e)}finally{ku.clear()}}function Tu(t,e){if(t===e)return!0;let r=Hf.call(t),i=Hf.call(e);if(r!==i)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(Zf(t,e))return!0;let n=Kf(t),a=Kf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Dg.call(e,n[s]))return!1;for(let s=0;s<o;++s){let u=n[s];if(!Tu(t[u],e[u]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(Zf(t,e))return!0;let n=t.entries(),a=r==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,u]=o.value;if(!e.has(s)||a&&!Tu(u,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let n=t.byteLength;if(n===e.byteLength)for(;n--&&t[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Gf.call(t);return n!==Gf.call(e)?!1:!Pg(n,Rg)}}return!1}function Kf(t){return Object.keys(t).filter(Ng,t)}function Ng(t){return this[t]!==void 0}var Rg="{ [native code] }";function Pg(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function Zf(t,e){let r=ku.get(t);if(r){if(r.has(e))return!0}else ku.set(t,r=new Set);return r.add(e),!1}var $g=function(){return Object.create(null)},Jf=Array.prototype,Lg=Jf.forEach,Fg=Jf.slice,tr=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=$g),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return Lg.call(e,function(i){return r=r.getChildTrie(i)}),r.data||(r.data=this.makeData(Fg.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Mg(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=r.get(e);return i||r.set(e,i=new t(this.weakness,this.makeData)),i},t}();function Mg(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var et=null,Yf={},Ug=1,jg=()=>class{constructor(){this.id=["slot",Ug++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=et;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===Yf)break;return e!==et&&(et.slots[this.id]=r),!0}return et&&(et.slots[this.id]=Yf),!1}getValue(){if(this.hasValue())return et.slots[this.id]}withValue(e,r,i,n){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return r.apply(n,i)}finally{et=o}}static bind(e){let r=et;return function(){let i=et;try{return et=r,e.apply(this,arguments)}finally{et=i}}}static noContext(e,r,i){if(et){let n=et;try{return et=null,e.apply(i,r)}finally{et=n}}else return e.apply(i,r)}};function Xf(t){try{return t()}catch{}}var Iu="@wry/context:Slot",qg=Xf(()=>globalThis)||Xf(()=>global)||Object.create(null),ed=qg,xn=ed[Iu]||Array[Iu]||function(t){try{Object.defineProperty(ed,Iu,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(jg());var{bind:Bg,noContext:Vg}=xn;function Qg(){}var zg=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Qg),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var i=r.older,n=r.newer;n&&(n.older=i),i&&(i.newer=n),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=n)}return r},t.prototype.set=function(e,r){var i=this.getNode(e);return i?i.value=r:(i={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),Yo=new xn,Ou,Wg=Object.prototype.hasOwnProperty,Nu=(Ou=Array.from,Ou===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Ou);function Jo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Ea=[],Hg=100;function An(t,e){if(!t)throw new Error(e||"assertion failure")}function Gg(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function rd(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function Kg(t){return t.slice(0)}var Zg=function(){function t(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!qr(this))return td(this),this.value[0]},t.prototype.recompute=function(e){return An(!this.recomputing,"already recomputing"),td(this),qr(this)?Jg(this,e):rd(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,id(this),Jo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),cd(this),Ru(this,function(r,i){r.setDirty(),ud(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ea.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Nu(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Ea.push(this.deps),this.deps=null)},t.count=0,t}();function td(t){var e=Yo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),qr(t)?ad(e,t):od(e,t),e}function Jg(t,e){return cd(t),Yo.withValue(t,Yg,[t,e]),ey(t,e)&&Xg(t),rd(t.value)}function Yg(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function qr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Xg(t){t.dirty=!1,!qr(t)&&nd(t)}function id(t){Ru(t,ad)}function nd(t){Ru(t,od)}function Ru(t,e){var r=t.parents.size;if(r)for(var i=Nu(t.parents),n=0;n<r;++n)e(i[n],t)}function ad(t,e){An(t.childValues.has(e)),An(qr(e));var r=!qr(t);if(!t.dirtyChildren)t.dirtyChildren=Ea.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&id(t)}function od(t,e){An(t.childValues.has(e)),An(!qr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,Kg(e.value)):Gg(r,e.value)||t.setDirty(),sd(t,e),!qr(t)&&nd(t)}function sd(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Ea.length<Hg&&Ea.push(r),t.dirtyChildren=null))}function cd(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){ud(t,r)}),t.forgetDeps(),An(t.dirtyChildren===null)}function ud(t,e){e.parents.delete(t),t.childValues.delete(e),sd(t,e)}function ey(t,e){if(typeof t.subscribe=="function")try{Jo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var ty={setDirty:!0,dispose:!0,forget:!0};function Xo(t){var e=new Map,r=t&&t.subscribe;function i(n){var a=Yo.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof r=="function"&&(Jo(o),o.unsubscribe=r(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&Wg.call(ty,o)?o:"setDirty";Nu(s).forEach(function(c){return c[u]()}),e.delete(a),Jo(s)}},i}function ld(){var t=new tr(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var bw=ld(),Du=new Set;function Ti(t,e){e===void 0&&(e=Object.create(null));var r=new zg(e.max||Math.pow(2,16),function(c){return c.dispose()}),i=e.keyArgs,n=e.makeCacheKey||ld(),a=function(){var c=n.apply(null,i?i.apply(null,arguments):arguments);if(c===void 0)return t.apply(null,arguments);var l=r.get(c);l||(r.set(c,l=new Zg(t)),l.subscribe=e.subscribe,l.forget=function(){return r.delete(c)});var d=l.recompute(Array.prototype.slice.call(arguments));return r.set(c,l),Du.add(r),Yo.hasValue()||(Du.forEach(function(f){return f.clean()}),Du.clear()),d};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(c){var l=r.get(c);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(c){var l=r.get(c);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function u(c){return r.delete(c)}return a.forgetKey=u,a.forget=function(){return u(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Pu=function(){function t(){this.getFragmentDoc=Ti(eu)}return t.prototype.batch=function(e){var r=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(r)},i),n},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(C(C({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(C(C({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,i=e.data,n=Yt(e,["id","data"]);return this.write(Object.assign(n,{dataId:r||"ROOT_QUERY",result:i}))},t.prototype.writeFragment=function(e){var r=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=Yt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:r,result:i}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(i){var n=i.readQuery(e),a=r(n);return a==null?n:(i.writeQuery(C(C({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(i){var n=i.readFragment(e),a=r(n);return a==null?n:(i.writeFragment(C(C({},e),{data:a})),a)}})},t}();var xa=function(t){Re(e,t);function e(r,i,n,a){var o,s=t.call(this,r)||this;if(s.message=r,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var u=s.path.length-1;u>=0;--u)s.missing=(o={},o[s.path[u]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Pe=Object.prototype.hasOwnProperty;function Aa(t){return t==null}function ts(t,e){var r=t.__typename,i=t.id,n=t._id;if(typeof r=="string"&&(e&&(e.keyObject=Aa(i)?Aa(n)?void 0:{_id:n}:{id:i}),Aa(i)&&!Aa(n)&&(i=n),!Aa(i)))return"".concat(r,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var pd={dataIdFromObject:ts,addTypename:!0,resultCaching:!0,canonizeResults:!1};function fd(t){return jr(pd,t)}function rs(t){var e=t.canonizeResults;return e===void 0?pd.canonizeResults:e}function dd(t,e){return se(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var $u=/^[_a-z][_0-9a-z]*/i;function Wt(t){var e=t.match($u);return e?e[0]:t}function es(t,e,r){return fe(e)?Se(e)?e.every(function(i){return es(t,i,r)}):t.selections.every(function(i){if(Et(i)&&yr(i,r)){var n=Rt(i);return Pe.call(e,n)&&(!i.selectionSet||es(i.selectionSet,e[n],r))}return!0}):!1}function Br(t){return fe(t)&&!se(t)&&!Se(t)}function hd(){return new mt}function is(t,e){var r=Si(Ci(t));return{fragmentMap:r,lookupFragment:function(i){var n=r[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var ns=Object.create(null),Lu=function(){return ns},md=Object.create(null),kn=function(){function t(e,r){var i=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return va(se(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return se(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return Xt(n);if(se(n))return n;var o=i.policies.identify(n)[0];if(o){var s=Xt(o);return a&&i.merge(o,n),s}}}return t.prototype.toObject=function(){return C({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),Pe.call(this.data,e)){var i=this.data[e];if(i&&Pe.call(i,r))return i[r]}if(r==="__typename"&&Pe.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Vr)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Pe.call(this.data,e))return this.data[e];if(this instanceof Vr)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var i=this,n;se(e)&&(e=e.__ref),se(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof r=="string"?this.lookup(n=r):r;if(!!o){__DEV__?$(typeof n=="string","store.merge expects a string ID"):$(typeof n=="string",1);var s=new mt(iy).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);a||(u.__exists=1),Object.keys(o).forEach(function(c){if(!a||a[c]!==s[c]){u[c]=1;var l=Wt(c);l!==c&&!i.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(i instanceof Vr)&&delete s[c]}}),u.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete u.__typename,Object.keys(u).forEach(function(c){return i.group.dirty(n,c)})}}},t.prototype.modify=function(e,r){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,u={DELETE:ns,INVALIDATE:md,isReference:se,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return i.policies.readField(typeof c=="string"?{fieldName:c,from:l||Xt(e)}:c,{store:i})}};if(Object.keys(n).forEach(function(c){var l=Wt(c),d=n[c];if(d!==void 0){var f=typeof r=="function"?r:r[c]||r[l];if(f){var p=f===Lu?ns:f(va(d),C(C({},u),{fieldName:l,storeFieldName:c,storage:i.getStorage(e,c)}));p===md?i.group.dirty(e,c):(p===ns&&(p=void 0),p!==d&&(a[c]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Vr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&i?this.policies.getStoreFieldName({typename:o,fieldName:r,args:i}):r;return this.modify(e,s?(n={},n[s]=Lu,n):Lu)}return!1},t.prototype.evict=function(e,r){var i=!1;return e.id&&(Pe.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Vr&&this!==r&&(i=this.parent.evict(e,r)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Pe.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(r.__META={extraRootIds:i.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Pe.call(e,a)||r.delete(a)}),e){var i=e.__META,n=Yt(e,["__META"]);Object.keys(n).forEach(function(a){r.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Vr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),i=this.toObject();r.forEach(function(o){Pe.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Vr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},t.prototype.findChildRefIds=function(e){if(!Pe.call(this.refs,e)){var r=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return r;var n=new Set([i]);n.forEach(function(a){se(a)&&(r[a.__ref]=!0),fe(a)&&Object.keys(a).forEach(function(o){var s=a[o];fe(s)&&n.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var gd=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?Xo():null,this.keyMaker=new tr(Pt)},t.prototype.depend=function(e,r){if(this.d){this.d(Fu(e,r));var i=Wt(r);i!==r&&this.d(Fu(e,i)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Fu(e,r),r==="__exists"?"forget":"setDirty")},t}();function Fu(t,e){return e+"#"+t}function Mu(t,e){Ii(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Re(i,r);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,u=n.seed,c=r.call(this,a,new gd(s))||this;return c.stump=new ry(c),c.storageTrie=new tr(Pt),u&&c.replace(u),c}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(t);t.Root=e})(kn||(kn={}));var Vr=function(t){Re(e,t);function e(r,i,n,a){var o=t.call(this,i.policies,a)||this;return o.id=r,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(r,i){return new e(r,this,i,this.group)},e.prototype.removeLayer=function(r){var i=this,n=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(u){ke(o[u],s[u])||i.group.dirty(a,u)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(u){i.group.dirty(a,u)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return C(C({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var i=this.parent.findChildRefIds(r);return Pe.call(this.data,r)?C(C({},i),t.prototype.findChildRefIds.call(this,r)):i},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(kn),ry=function(t){Re(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new gd(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Vr);function iy(t,e,r){var i=t[r],n=e[r];return ke(i,n)?i:n}function Ii(t){return!!(t instanceof kn&&t.group.caching)}function ny(t){return fe(t)?Se(t)?t.slice(0):C({__proto__:Object.getPrototypeOf(t)},t):t}var as=function(){function t(){this.known=new(_f?WeakSet:Set),this.pool=new tr(Pt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return fe(e)&&this.known.has(e)},t.prototype.pass=function(e){if(fe(e)){var r=ny(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(fe(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),u=[s],c=this.sortedKeys(e);u.push(c.json);var l=u.length;c.sorted.forEach(function(p){u.push(r.admit(e[p]))});var o=this.pool.lookupArray(u);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),c.sorted.forEach(function(p,h){d[p]=u[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),i=this.pool.lookupArray(r);if(!i.keys){r.sort();var n=JSON.stringify(r);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:r,json:n})}return i.keys},t}();var xt=Object.assign(function(t){if(fe(t)){Uu===void 0&&yd();var e=Uu.admit(t),r=ju.get(e);return r===void 0&&ju.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:yd}),Uu,ju;function yd(){Uu=new as,ju=new(Pt?WeakMap:Map)}function vd(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var bd=function(){function t(e){var r=this;this.knownResults=new(Pt?WeakMap:Map),this.config=jr(e,{addTypename:e.addTypename!==!1,canonizeResults:rs(e)}),this.canon=e.canon||new as,this.executeSelectionSet=Ti(function(i){var n,a=i.context.canonizeResults,o=vd(i);o[3]=!a;var s=(n=r.executeSelectionSet).peek.apply(n,o);return s?a?C(C({},s),{result:r.canon.admit(s.result)}):s:(Mu(i.context.store,i.enclosingRef.__ref),r.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:vd,makeCacheKey:function(i,n,a,o){if(Ii(a.store))return a.store.makeCacheKey(i,se(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ti(function(i){return Mu(i.context.store,i.enclosingRef.__ref),r.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ii(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new as},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,u=s===void 0?!0:s,c=e.canonizeResults,l=c===void 0?this.config.canonizeResults:c,d=this.config.cache.policies;o=C(C({},xi(ma(i))),o);var f=Xt(a),p=this.executeSelectionSet({selectionSet:Ei(i).selectionSet,objectOrReference:f,enclosingRef:f,context:C({store:r,query:i,policies:d,variables:o,varString:xt(o),canonizeResults:l},is(i,this.config.fragments))}),h;if(p.missing&&(h=[new xa(ay(p.missing),p.missing,i,o)],!u))throw h[0];return{result:p.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,i,n){if(Ii(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,r,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(se(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,u=o.policies,c=o.store,l=c.getFieldValue(n,"__typename"),d=[],f,p=new mt;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&d.push({__typename:l});function h(w,v){var D;return w.missing&&(f=p.merge(f,(D={},D[v]=w.missing,D))),w.result}var m=new Set(i.selections);m.forEach(function(w){var v,D;if(!!yr(w,s))if(Et(w)){var N=u.readField({fieldName:w.name.value,field:w,variables:o.variables,from:n},o),A=Rt(w);N===void 0?Ai.added(w)||(f=p.merge(f,(v={},v[A]="Can't find field '".concat(w.name.value,"' on ").concat(se(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),v))):Se(N)?N=h(r.executeSubSelectedArray({field:w,array:N,enclosingRef:a,context:o}),A):w.selectionSet?N!=null&&(N=h(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:N,enclosingRef:se(N)?N:a,context:o}),A)):o.canonizeResults&&(N=r.canon.pass(N)),N!==void 0&&d.push((D={},D[A]=N,D))}else{var R=wi(w,o.lookupFragment);if(!R&&w.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(w.name.value)):new Z(5);R&&u.fragmentMatches(R,l)&&R.selectionSet.selections.forEach(m.add,m)}});var b=ga(d),_={result:b,missing:f},S=o.canonizeResults?this.canon.admit(_):va(_);return S.result&&this.knownResults.set(S.result,i),S},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,u=new mt;function c(l,d){var f;return l.missing&&(s=u.merge(s,(f={},f[d]=l.missing,f))),l.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(l,d){return l===null?null:Se(l)?c(r.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),d):i.selectionSet?c(r.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:se(l)?l:a,context:o}),d):(__DEV__&&oy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},t}();function ay(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function oy(t,e,r){if(!e.selectionSet){var i=new Set([r]);i.forEach(function(n){fe(n)&&(__DEV__?$(!se(n),"Missing selection set for object of type ".concat(dd(t,n)," returned for query field ").concat(e.name.value)):$(!se(n),6),Object.values(n).forEach(i.add,i))})}}var Tn=new xn,_d=new WeakMap;function ka(t){var e=_d.get(t);return e||_d.set(t,e={vars:new Set,dep:Xo()}),e}function qu(t){ka(t).vars.forEach(function(e){return e.forgetCache(t)})}function Sd(t){ka(t).vars.forEach(function(e){return e.attachCache(t)})}function os(t){var e=new Set,r=new Set,i=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){ka(u).dep.dirty(i),sy(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=Tn.getValue();s&&(n(s),ka(s).dep(i))}return t};i.onNextChange=function(a){return r.add(a),function(){r.delete(a)}};var n=i.attachCache=function(a){return e.add(a),ka(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function sy(t){t.broadcastWatches&&t.broadcastWatches()}var wd=Object.create(null);function Bu(t){var e=JSON.stringify(t);return wd[e]||(wd[e]=Object.create(null))}function Vu(t){var e=Bu(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=zu(t,function(o){var s=In(i.storeObject,o,n);return s===void 0&&r!==i.storeObject&&Pe.call(r,o[0])&&(s=In(r,o,Ed)),__DEV__?$(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):$(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function Qu(t){var e=Bu(t);return e.keyArgsFn||(e.keyArgsFn=function(r,i){var n=i.field,a=i.variables,o=i.fieldName,s=zu(t,function(c){var l=c[0],d=l.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=l.slice(1),p=n.directives.find(function(_){return _.name.value===f}),h=p&&vr(p,a);return h&&In(h,c.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Pe.call(a,m)){var b=c.slice(0);return b[0]=m,In(a,b)}return}if(r)return In(r,c)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function zu(t,e){var r=new mt;return Cd(t).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=r.merge(i,o)}return i},Object.create(null))}function Cd(t){var e=Bu(t);if(!e.paths){var r=e.paths=[],i=[];t.forEach(function(n,a){Se(n)?(Cd(n).forEach(function(o){return r.push(i.concat(o))}),i.length=0):(i.push(n),Se(t[a+1])||(r.push(i.slice(0)),i.length=0))})}return e.paths}function Ed(t,e){return t[e]}function In(t,e,r){return r=r||Ed,xd(e.reduce(function i(n,a){return Se(n)?n.map(function(o){return i(o,a)}):n&&r(n,a)},t))}function xd(t){return fe(t)?Se(t)?t.map(xd):zu(Object.keys(t).sort(),function(e){return In(t,e)}):t}da.setStringify(xt);function Wu(t){return t.args!==void 0?t.args:t.field?vr(t.field,t.variables):null}var cy=function(){},Ad=function(t,e){return e.fieldName},kd=function(t,e,r){var i=r.mergeObjects;return i(t,e)},Td=function(t,e){return e},Od=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=C({dataIdFromObject:ts},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,r){var i,n=this,a=r&&(r.typename||((i=r.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=C(C({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var f=ss(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),u,c=a&&this.getTypePolicy(a),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(Se(d))l=Vu(d);else{u=d;break}}return u=u?String(u):void 0,s.keyObject?[u,s.keyObject]:[u]},t.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,u=Yt(n,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",i),o&&r.setRootTypename("Mutation",i),s&&r.setRootTypename("Subscription",i),Pe.call(r.toBeAdded,i)?r.toBeAdded[i].push(u):r.toBeAdded[i]=[u]})},t.prototype.updateTypePolicy=function(e,r){var i=this,n=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(u,c){u.merge=typeof c=="function"?c:c===!0?kd:c===!1?Td:u.merge}s(n,r.merge),n.keyFn=a===!1?cy:Se(a)?Vu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(u){var c=i.getFieldPolicy(e,u,!0),l=o[u];if(typeof l=="function")c.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;c.keyFn=d===!1?Ad:Se(d)?Qu(d):typeof d=="function"?d:c.keyFn,typeof f=="function"&&(c.read=f),s(c,p)}c.read&&c.merge&&(c.keyFn=c.keyFn||Ad)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];r!==n&&(__DEV__?$(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):$(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[r]=i,this.rootTypenamesById[i]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){r.getSupertypeSet(i,!0),e[i].forEach(function(n){r.getSupertypeSet(n,!0).add(i);var a=n.match($u);(!a||a[0]!==n)&&r.fuzzySubtypes.set(n,new RegExp(n))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Pe.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=r.getTypePolicy(o),u=s.fields,c=Yt(s,["fields"]);Object.assign(i,c),Object.assign(i.fields,u)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,i){if(e){var n=this.getTypePolicy(e).fields;return n[r]||i&&(n[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var i=this.supertypeMap.get(e);return!i&&r&&this.supertypeMap.set(e,i=new Set),i},t.prototype.fragmentMatches=function(e,r,i,n){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),u=[s],c=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&u.indexOf(m)<0&&u.push(m)},l=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<u.length;++f){var p=u[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&$.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;p.forEach(c),l&&f===u.length-1&&es(e.selectionSet,i,n)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var b=r.match(h);b&&b[0]===r&&c(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var i=this.getFieldPolicy(e,r,!1);return!!(i&&i.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,i=e.fieldName,n=this.getFieldPolicy(r,i,!1),a,o=n&&n.keyFn;if(o&&r)for(var s={typename:r,fieldName:i,field:e.field||null,variables:e.variables},u=Wu(e);o;){var c=o(u,s);if(Se(c))o=Qu(c);else{a=c||i;break}}return a===void 0&&(a=e.field?ru(e.field,e.variables):da(i,Wu(e))),a===!1?i:i===Wt(a)?a:i+":"+a},t.prototype.readField=function(e,r){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=r.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Wt(o),u=r.store.getFieldValue(i,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var d=Id(this,i,e,r,r.store.getStorage(se(i)?i.__ref:i,o));return Tn.withValue(this.cache,l,[u,d])}return u}}},t.prototype.getReadFunction=function(e,r){var i=this.getFieldPolicy(e,r,!1);return i&&i.read},t.prototype.getMergeFunction=function(e,r,i){var n=this.getFieldPolicy(e,r,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},t.prototype.runMergeFunction=function(e,r,i,n,a){var o=i.field,s=i.typename,u=i.merge;return u===kd?Dd(n.store)(e,r):u===Td?r:(n.overwrite&&(e=void 0),u(e,r,Id(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},t}();function Id(t,e,r,i,n){var a=t.getStoreFieldName(r),o=Wt(a),s=r.variables||i.variables,u=i.store,c=u.toReference,l=u.canRead;return{args:Wu(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:se,toReference:c,storage:n,cache:t.cache,canRead:l,readField:function(){return t.readField(ss(arguments,e,s),i)},mergeObjects:Dd(i.store)}}function ss(t,e,r){var i=t[0],n=t[1],a=t.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=C({},i),Pe.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&$.warn("Undefined 'from' passed to readField with arguments ".concat(Ef(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Dd(t){return function(r,i){if(Se(r)||Se(i))throw __DEV__?new Z("Cannot automatically merge arrays"):new Z(4);if(fe(r)&&fe(i)){var n=t.getFieldValue(r,"__typename"),a=t.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(se(r)&&Br(i))return t.merge(r.__ref,i),r;if(Br(r)&&se(i))return t.merge(r,i.__ref),i;if(Br(r)&&Br(i))return C(C({},r),i)}return i}}function Hu(t,e,r){var i="".concat(e).concat(r),n=t.flavors.get(i);return n||t.flavors.set(i,n=t.clientOnly===e&&t.deferred===r?t:C(C({},t),{clientOnly:e,deferred:r})),n}var $d=function(){function t(e,r,i){this.cache=e,this.reader=r,this.fragments=i}return t.prototype.writeToStore=function(e,r){var i=this,n=r.query,a=r.result,o=r.dataId,s=r.variables,u=r.overwrite,c=er(n),l=hd();s=C(C({},xi(c)),s);var d=C(C({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:xt(s)},is(n,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:d});if(!se(f))throw __DEV__?new Z("Could not identify object ".concat(JSON.stringify(a))):new Z(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,b=p.mergeTree,_=p.fieldNodeSet,S=Xt(h);if(b&&b.map.size){var w=i.applyMerges(b,S,m,d);if(se(w))return;m=w}if(__DEV__&&!d.overwrite){var v=Object.create(null);_.forEach(function(A){A.selectionSet&&(v[A.name.value]=!0)});var D=function(A){return v[Wt(A)]===!0},N=function(A){var R=b&&b.map.get(A);return Boolean(R&&R.info&&R.info.merge)};Object.keys(m).forEach(function(A){D(A)&&!N(A)&&uy(S,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},t.prototype.processSelectionSet=function(e){var r=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,u=this.cache.policies,c=Object.create(null),l=i&&u.rootTypenamesById[i]||ha(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(c.__typename=l);var d=function(){var w=ss(arguments,c,o.variables);if(se(w.from)){var v=o.incomingById.get(w.from.__ref);if(v){var D=u.readField(C(C({},w),{from:v.storeObject}),o);if(D!==void 0)return D}}return u.readField(w,o)},f=new Set;this.flattenFields(a,n,o,l).forEach(function(w,v){var D,N=Rt(v),A=n[N];if(f.add(v),A!==void 0){var R=u.getStoreFieldName({typename:l,fieldName:v.name.value,field:v,variables:w.variables}),F=Nd(s,R),P=r.processFieldValue(A,v,v.selectionSet?Hu(w,!1,!1):w,F),j=void 0;v.selectionSet&&(se(P)||Br(P))&&(j=d("__typename",P));var Je=u.getMergeFunction(l,v.name.value,j);Je?F.info={field:v,typename:l,merge:Je}:Rd(s,R),c=w.merge(c,(D={},D[R]=P,D))}else __DEV__&&!w.clientOnly&&!w.deferred&&!Ai.added(v)&&!u.getReadFunction(l,v.name.value)&&__DEV__&&$.error("Missing field '".concat(Rt(v),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=u.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:d}),h=p[0],m=p[1];i=i||h,m&&(c=o.merge(c,m))}catch(w){if(!i)throw w}if(typeof i=="string"){var b=Xt(i),_=o.written[i]||(o.written[i]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(n,b,a,o)))return b;var S=o.incomingById.get(i);return S?(S.storeObject=o.merge(S.storeObject,c),S.mergeTree=Gu(S.mergeTree,s),f.forEach(function(w){return S.fieldNodeSet.add(w)})):o.incomingById.set(i,{storeObject:c,mergeTree:cs(s)?void 0:s,fieldNodeSet:f}),b}return c},t.prototype.processFieldValue=function(e,r,i,n){var a=this;return!r.selectionSet||e===null?__DEV__?Bo(e):e:Se(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,i,Nd(n,s));return Rd(n,s),u}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:i,mergeTree:n})},t.prototype.flattenFields=function(e,r,i,n){n===void 0&&(n=ha(r,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new tr(!1);return function u(c,l){var d=s.lookup(c,l.clientOnly,l.deferred);d.visited||(d.visited=!0,c.selections.forEach(function(f){if(!!yr(f,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(p=!0),S==="defer"){var w=vr(_,i.variables);(!w||w.if!==!1)&&(h=!0)}}),Et(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Hu(i,p,h))}else{var b=wi(f,i.lookupFragment);if(!b&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(f.name.value)):new Z(8);b&&o.fragmentMatches(b,n,r,i.variables)&&u(b.selectionSet,Hu(i,p,h))}}}))}(e,i),a},t.prototype.applyMerges=function(e,r,i,n,a){var o,s=this;if(e.map.size&&!se(i)){var u=!Se(i)&&(se(r)||Br(r))?r:void 0,c=i;u&&!a&&(a=[se(u)?u.__ref:u]);var l,d=function(f,p){return Se(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(u,p),m=d(c,p);if(m!==void 0){a&&a.push(p);var b=s.applyMerges(f,h,m,n,a);b!==m&&(l=l||new Map,l.set(p,b)),a&&$(a.pop()===p)}}),l&&(i=Se(c)?c.slice(0):C({},c),l.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(r,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},t}();var Ld=[];function Nd(t,e){var r=t.map;return r.has(e)||r.set(e,Ld.pop()||{map:new Map}),r.get(e)}function Gu(t,e){if(t===e||!e||cs(e))return t;if(!t||cs(t))return e;var r=t.info&&e.info?C(C({},t.info),e.info):t.info||e.info,i=t.map.size&&e.map.size,n=i?new Map:t.map.size?t.map:e.map,a={info:r,map:n};if(i){var o=new Set(e.map.keys());t.map.forEach(function(s,u){a.map.set(u,Gu(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Gu(e.map.get(s),t.map.get(s)))})}return a}function cs(t){return!t||!(t.info||t.map.size)}function Rd(t,e){var r=t.map,i=r.get(e);i&&cs(i)&&(Ld.push(i),r.delete(e))}var Pd=new Set;function uy(t,e,r,i){var n=function(d){var f=i.getFieldValue(d,r);return typeof f=="object"&&f},a=n(t);if(!!a){var o=n(e);if(!!o&&!se(a)&&!ke(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(t,"__typename")||i.getFieldValue(e,"__typename"),u=Wt(r),c="".concat(s,".").concat(u);if(!Pd.has(c)){Pd.add(c);var l=[];!Se(a)&&!Se(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&$.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
|
|
38
|
+
`):new J(23)};var Vf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var Qf=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function zf(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Ca(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Ca(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var l=s.indexOf("?")===-1?"?":"&",u=s+l+t.join("&")+o;return{newURI:u}}var Wf=Ge(function(){return fetch}),Hf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?jf:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,l=r.includeUnusedVariables,u=l===void 0?!1:l,d=Yt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Bf(i||Wf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Pt(function(p){var h=Qf(p,t),m=p.getContext(),v={};if(m.clientAwareness){var w=m.clientAwareness,b=w.name,S=w.version;b&&(v["apollographql-client-name"]=b),S&&(v["apollographql-client-version"]=S)}var _=C(C({},v),m.headers),T={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:_},R=qf(p,a,Uf,f,T),A=R.options,N=R.body;if(N.variables&&!u){var L=new Set(Object.keys(N.variables));ct(p.query,{Variable:function(ue,Zt,ne){ne&&ne.kind!=="VariableDefinition"&&L.delete(ue.name.value)}}),L.size&&(N.variables=C({},N.variables),L.forEach(function(ue){delete N.variables[ue]}))}var P;if(!A.signal){var j=Vf(),ye=j.controller,je=j.signal;P=ye,P&&(A.signal=je)}var G=function(ue){return ue.kind==="OperationDefinition"&&ue.operation==="mutation"};if(c&&!p.query.definitions.some(G)&&(A.method="GET"),gn(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var Ce=zf(h,N),Ee=Ce.newURI,le=Ce.parseError;if(le)return Ko(le);h=Ee}else try{A.body=Ca(N,"Payload")}catch(ue){return Ko(ue)}return new ae(function(ue){var Zt=i||Ge(function(){return fetch})||Wf;return Zt(h,A).then(function(ne){var Jt;p.setContext({response:ne});var Ir=(Jt=ne.headers)===null||Jt===void 0?void 0:Jt.get("content-type");return Ir!==null&&/^multipart\/mixed/i.test(Ir)?Lf(ne,ue):Mf(ne,p,ue)}).catch(function(ne){return Yo(ne,ue)}),function(){P&&P.abort()}})})};var kl=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,Hf(t).request)||this;return i.options=t,i}return e}(Pt);var{toString:Gf,hasOwnProperty:Ng}=Object.prototype,Kf=Function.prototype.toString,Tl=new Map;function Te(r,e){try{return Il(r,e)}finally{Tl.clear()}}function Il(r,e){if(r===e)return!0;let t=Gf.call(r),i=Gf.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Jf(r,e))return!0;let n=Zf(r),a=Zf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Ng.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Il(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Jf(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Il(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Kf.call(r);return n!==Kf.call(e)?!1:!Pg(n,$g)}}return!1}function Zf(r){return Object.keys(r).filter(Rg,r)}function Rg(r){return this[r]!==void 0}var $g="{ [native code] }";function Pg(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Jf(r,e){let t=Tl.get(r);if(t){if(t.has(e))return!0}else Tl.set(r,t=new Set);return t.add(e),!1}var Lg=function(){return Object.create(null)},Yf=Array.prototype,Fg=Yf.forEach,Mg=Yf.slice,tr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Lg),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return Fg.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(Mg.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Ug(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Ug(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var et=null,Xf={},jg=1,qg=()=>class{constructor(){this.id=["slot",jg++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=et;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===Xf)break;return e!==et&&(et.slots[this.id]=t),!0}return et&&(et.slots[this.id]=Xf),!1}getValue(){if(this.hasValue())return et.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return t.apply(n,i)}finally{et=o}}static bind(e){let t=et;return function(){let i=et;try{return et=t,e.apply(this,arguments)}finally{et=i}}}static noContext(e,t,i){if(et){let n=et;try{return et=null,e.apply(i,t)}finally{et=n}}else return e.apply(i,t)}};function ed(r){try{return r()}catch{}}var Ol="@wry/context:Slot",Bg=ed(()=>globalThis)||ed(()=>global)||Object.create(null),td=Bg,En=td[Ol]||Array[Ol]||function(r){try{Object.defineProperty(td,Ol,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(qg());var{bind:Vg,noContext:Qg}=En;function zg(){}var Wg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=zg),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),es=new En,Dl,Hg=Object.prototype.hasOwnProperty,Rl=(Dl=Array.from,Dl===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Dl);function Xo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ea=[],Gg=100;function xn(r,e){if(!r)throw new Error(e||"assertion failure")}function Kg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function id(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Zg(r){return r.slice(0)}var Jg=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Ur(this))return rd(this),this.value[0]},r.prototype.recompute=function(e){return xn(!this.recomputing,"already recomputing"),rd(this),Ur(this)?Yg(this,e):id(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,nd(this),Xo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),ld(this),$l(this,function(t,i){t.setDirty(),ud(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ea.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Rl(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ea.push(this.deps),this.deps=null)},r.count=0,r}();function rd(r){var e=es.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Ur(r)?od(e,r):sd(e,r),e}function Yg(r,e){return ld(r),es.withValue(r,Xg,[r,e]),ty(r,e)&&ey(r),id(r.value)}function Xg(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Ur(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function ey(r){r.dirty=!1,!Ur(r)&&ad(r)}function nd(r){$l(r,od)}function ad(r){$l(r,sd)}function $l(r,e){var t=r.parents.size;if(t)for(var i=Rl(r.parents),n=0;n<t;++n)e(i[n],r)}function od(r,e){xn(r.childValues.has(e)),xn(Ur(e));var t=!Ur(r);if(!r.dirtyChildren)r.dirtyChildren=Ea.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&nd(r)}function sd(r,e){xn(r.childValues.has(e)),xn(!Ur(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Zg(e.value)):Kg(t,e.value)||r.setDirty(),cd(r,e),!Ur(r)&&ad(r)}function cd(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ea.length<Gg&&Ea.push(t),r.dirtyChildren=null))}function ld(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){ud(r,t)}),r.forgetDeps(),xn(r.dirtyChildren===null)}function ud(r,e){e.parents.delete(r),r.childValues.delete(e),cd(r,e)}function ty(r,e){if(typeof r.subscribe=="function")try{Xo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var ry={setDirty:!0,dispose:!0,forget:!0};function ts(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=es.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(Xo(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Hg.call(ry,o)?o:"setDirty";Rl(s).forEach(function(l){return l[c]()}),e.delete(a),Xo(s)}},i}function pd(){var r=new tr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var _w=pd(),Nl=new Set;function ki(r,e){e===void 0&&(e=Object.create(null));var t=new Wg(e.max||Math.pow(2,16),function(l){return l.dispose()}),i=e.keyArgs,n=e.makeCacheKey||pd(),a=function(){var l=n.apply(null,i?i.apply(null,arguments):arguments);if(l===void 0)return r.apply(null,arguments);var u=t.get(l);u||(t.set(l,u=new Jg(r)),u.subscribe=e.subscribe,u.forget=function(){return t.delete(l)});var d=u.recompute(Array.prototype.slice.call(arguments));return t.set(l,u),Nl.add(t),es.hasValue()||(Nl.forEach(function(f){return f.clean()}),Nl.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(l){var u=t.get(l);u&&u.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(l){var u=t.get(l);if(u)return u.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(l){return t.delete(l)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Pl=function(){function r(){this.getFragmentDoc=ki(tl)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(C(C({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(C(C({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=Yt(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=Yt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(C(C({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(C(C({},e),{data:a})),a)}})},r}();var xa=function(r){Re(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var $e=Object.prototype.hasOwnProperty;function Aa(r){return r==null}function is(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Aa(i)?Aa(n)?void 0:{_id:n}:{id:i}),Aa(i)&&!Aa(n)&&(i=n),!Aa(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var fd={dataIdFromObject:is,addTypename:!0,resultCaching:!0,canonizeResults:!1};function dd(r){return Mr(fd,r)}function ns(r){var e=r.canonizeResults;return e===void 0?fd.canonizeResults:e}function hd(r,e){return oe(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Ll=/^[_a-z][_0-9a-z]*/i;function Wt(r){var e=r.match(Ll);return e?e[0]:r}function rs(r,e,t){return pe(e)?we(e)?e.every(function(i){return rs(r,i,t)}):r.selections.every(function(i){if(Et(i)&&gr(i,t)){var n=Rt(i);return $e.call(e,n)&&(!i.selectionSet||rs(i.selectionSet,e[n],t))}return!0}):!1}function jr(r){return pe(r)&&!oe(r)&&!we(r)}function md(){return new yt}function as(r,e){var t=_i(wi(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var os=Object.create(null),Fl=function(){return os},gd=Object.create(null),An=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return va(oe(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return oe(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return Xt(n);if(oe(n))return n;var o=i.policies.identify(n)[0];if(o){var s=Xt(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return C({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),$e.call(this.data,e)){var i=this.data[e];if(i&&$e.call(i,t))return i[t]}if(t==="__typename"&&$e.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof qr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),$e.call(this.data,e))return this.data[e];if(this instanceof qr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;oe(e)&&(e=e.__ref),oe(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?$(typeof n=="string","store.merge expects a string ID"):$(typeof n=="string",1);var s=new yt(ny).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(l){if(!a||a[l]!==s[l]){c[l]=1;var u=Wt(l);u!==l&&!i.policies.hasKeyArgs(s.__typename,u)&&(c[u]=1),s[l]===void 0&&!(i instanceof qr)&&delete s[l]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(l){return i.group.dirty(n,l)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:os,INVALIDATE:gd,isReference:oe,toReference:this.toReference,canRead:this.canRead,readField:function(l,u){return i.policies.readField(typeof l=="string"?{fieldName:l,from:u||Xt(e)}:l,{store:i})}};if(Object.keys(n).forEach(function(l){var u=Wt(l),d=n[l];if(d!==void 0){var f=typeof t=="function"?t:t[l]||t[u];if(f){var p=f===Fl?os:f(va(d),C(C({},c),{fieldName:u,storeFieldName:l,storage:i.getStorage(e,l)}));p===gd?i.group.dirty(e,l):(p===os&&(p=void 0),p!==d&&(a[l]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof qr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Fl,n):Fl)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&($e.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof qr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){$e.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&$e.call(e,a)||t.delete(a)}),e){var i=e.__META,n=Yt(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof qr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){$e.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof qr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!$e.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){oe(a)&&(t[a.__ref]=!0),pe(a)&&Object.keys(a).forEach(function(o){var s=a[o];pe(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var yd=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?ts():null,this.keyMaker=new tr($t)},r.prototype.depend=function(e,t){if(this.d){this.d(Ml(e,t));var i=Wt(t);i!==t&&this.d(Ml(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ml(e,t),t==="__exists"?"forget":"setDirty")},r}();function Ml(r,e){return e+"#"+r}function Ul(r,e){Ti(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Re(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,l=t.call(this,a,new yd(s))||this;return l.stump=new iy(l),l.storageTrie=new tr($t),c&&l.replace(c),l}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(An||(An={}));var qr=function(r){Re(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Te(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return C(C({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return $e.call(this.data,t)?C(C({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(An),iy=function(r){Re(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new yd(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(qr);function ny(r,e,t){var i=r[t],n=e[t];return Te(i,n)?i:n}function Ti(r){return!!(r instanceof An&&r.group.caching)}function ay(r){return pe(r)?we(r)?r.slice(0):C({__proto__:Object.getPrototypeOf(r)},r):r}var ss=function(){function r(){this.known=new(Sf?WeakSet:Set),this.pool=new tr($t),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return pe(e)&&this.known.has(e)},r.prototype.pass=function(e){if(pe(e)){var t=ay(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(pe(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],l=this.sortedKeys(e);c.push(l.json);var u=c.length;l.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),l.sorted.forEach(function(p,h){d[p]=c[u+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var xt=Object.assign(function(r){if(pe(r)){jl===void 0&&vd();var e=jl.admit(r),t=ql.get(e);return t===void 0&&ql.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:vd}),jl,ql;function vd(){jl=new ss,ql=new($t?WeakMap:Map)}function bd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var _d=function(){function r(e){var t=this;this.knownResults=new($t?WeakMap:Map),this.config=Mr(e,{addTypename:e.addTypename!==!1,canonizeResults:ns(e)}),this.canon=e.canon||new ss,this.executeSelectionSet=ki(function(i){var n,a=i.context.canonizeResults,o=bd(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?C(C({},s),{result:t.canon.admit(s.result)}):s:(Ul(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:bd,makeCacheKey:function(i,n,a,o){if(Ti(a.store))return a.store.makeCacheKey(i,oe(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=ki(function(i){return Ul(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ti(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ss},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,l=e.canonizeResults,u=l===void 0?this.config.canonizeResults:l,d=this.config.cache.policies;o=C(C({},Ei(ma(i))),o);var f=Xt(a),p=this.executeSelectionSet({selectionSet:Ci(i).selectionSet,objectOrReference:f,enclosingRef:f,context:C({store:t,query:i,policies:d,variables:o,varString:xt(o),canonizeResults:u},as(i,this.config.fragments))}),h;if(p.missing&&(h=[new xa(oy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ti(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(oe(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,l=o.store,u=l.getFieldValue(n,"__typename"),d=[],f,p=new yt;this.config.addTypename&&typeof u=="string"&&!c.rootIdsByTypename[u]&&d.push({__typename:u});function h(S,_){var T;return S.missing&&(f=p.merge(f,(T={},T[_]=S.missing,T))),S.result}var m=new Set(i.selections);m.forEach(function(S){var _,T;if(!!gr(S,s))if(Et(S)){var R=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),A=Rt(S);R===void 0?xi.added(S)||(f=p.merge(f,(_={},_[A]="Can't find field '".concat(S.name.value,"' on ").concat(oe(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),_))):we(R)?R=h(t.executeSubSelectedArray({field:S,array:R,enclosingRef:a,context:o}),A):S.selectionSet?R!=null&&(R=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:R,enclosingRef:oe(R)?R:a,context:o}),A)):o.canonizeResults&&(R=t.canon.pass(R)),R!==void 0&&d.push((T={},T[A]=R,T))}else{var N=Si(S,o.lookupFragment);if(!N&&S.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(S.name.value)):new J(5);N&&c.fragmentMatches(N,u)&&N.selectionSet.selections.forEach(m.add,m)}});var v=ga(d),w={result:v,missing:f},b=o.canonizeResults?this.canon.admit(w):va(w);return b.result&&this.knownResults.set(b.result,i),b},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new yt;function l(u,d){var f;return u.missing&&(s=c.merge(s,(f={},f[d]=u.missing,f))),u.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(u,d){return u===null?null:we(u)?l(t.executeSubSelectedArray({field:i,array:u,enclosingRef:a,context:o}),d):i.selectionSet?l(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:u,enclosingRef:oe(u)?u:a,context:o}),d):(__DEV__&&sy(o.store,i,u),u)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function oy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function sy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){pe(n)&&(__DEV__?$(!oe(n),"Missing selection set for object of type ".concat(hd(r,n)," returned for query field ").concat(e.name.value)):$(!oe(n),6),Object.values(n).forEach(i.add,i))})}}var kn=new En,Sd=new WeakMap;function ka(r){var e=Sd.get(r);return e||Sd.set(r,e={vars:new Set,dep:ts()}),e}function Bl(r){ka(r).vars.forEach(function(e){return e.forgetCache(r)})}function wd(r){ka(r).vars.forEach(function(e){return e.attachCache(r)})}function cs(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ka(c).dep.dirty(i),cy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=kn.getValue();s&&(n(s),ka(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),ka(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function cy(r){r.broadcastWatches&&r.broadcastWatches()}var Cd=Object.create(null);function Vl(r){var e=JSON.stringify(r);return Cd[e]||(Cd[e]=Object.create(null))}function Ql(r){var e=Vl(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=Wl(r,function(o){var s=Tn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&$e.call(t,o[0])&&(s=Tn(t,o,xd)),__DEV__?$(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):$(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function zl(r){var e=Vl(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=Wl(r,function(l){var u=l[0],d=u.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=u.slice(1),p=n.directives.find(function(w){return w.name.value===f}),h=p&&yr(p,a);return h&&Tn(h,l.slice(1))}return}if(d==="$"){var m=u.slice(1);if(a&&$e.call(a,m)){var v=l.slice(0);return v[0]=m,Tn(a,v)}return}if(t)return Tn(t,l)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Wl(r,e){var t=new yt;return Ed(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Ed(r){var e=Vl(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){we(n)?(Ed(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),we(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function xd(r,e){return r[e]}function Tn(r,e,t){return t=t||xd,Ad(e.reduce(function i(n,a){return we(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Ad(r){return pe(r)?we(r)?r.map(Ad):Wl(Object.keys(r).sort(),function(e){return Tn(r,e)}):r}da.setStringify(xt);function Hl(r){return r.args!==void 0?r.args:r.field?yr(r.field,r.variables):null}var ly=function(){},kd=function(r,e){return e.fieldName},Td=function(r,e,t){var i=t.mergeObjects;return i(r,e)},Id=function(r,e){return e},Dd=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=C({dataIdFromObject:is},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=C(C({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=ls(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,l=a&&this.getTypePolicy(a),u=l&&l.keyFn||this.config.dataIdFromObject;u;){var d=u(e,s);if(we(d))u=Ql(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=Yt(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),$e.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,l){c.merge=typeof l=="function"?l:l===!0?Td:l===!1?Id:c.merge}s(n,t.merge),n.keyFn=a===!1?ly:we(a)?Ql(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var l=i.getFieldPolicy(e,c,!0),u=o[c];if(typeof u=="function")l.read=u;else{var d=u.keyArgs,f=u.read,p=u.merge;l.keyFn=d===!1?kd:we(d)?zl(d):typeof d=="function"?d:l.keyFn,typeof f=="function"&&(l.read=f),s(l,p)}l.read&&l.merge&&(l.keyFn=l.keyFn||kd)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?$(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):$(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Ll);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!$e.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,l=Yt(s,["fields"]);Object.assign(i,l),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],l=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},u=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&$.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(l),u&&f===c.length-1&&rs(e.selectionSet,i,n)&&(u=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var v=t.match(h);v&&v[0]===t&&l(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=Hl(e);o;){var l=o(c,s);if(we(l))o=zl(l);else{a=l||i;break}}return a===void 0&&(a=e.field?il(e.field,e.variables):da(i,Hl(e))),a===!1?i:i===Wt(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Wt(o),c=t.store.getFieldValue(i,o),l=this.getFieldPolicy(e.typename,s,!1),u=l&&l.read;if(u){var d=Od(this,i,e,t,t.store.getStorage(oe(i)?i.__ref:i,o));return kn.withValue(this.cache,u,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===Td?Nd(n.store)(e,t):c===Id?t:(n.overwrite&&(e=void 0),c(e,t,Od(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function Od(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Wt(a),s=t.variables||i.variables,c=i.store,l=c.toReference,u=c.canRead;return{args:Hl(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:oe,toReference:l,storage:n,cache:r.cache,canRead:u,readField:function(){return r.readField(ls(arguments,e,s),i)},mergeObjects:Nd(i.store)}}function ls(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=C({},i),$e.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&$.warn("Undefined 'from' passed to readField with arguments ".concat(xf(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Nd(r){return function(t,i){if(we(t)||we(i))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(pe(t)&&pe(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(oe(t)&&jr(i))return r.merge(t.__ref,i),t;if(jr(t)&&oe(i))return r.merge(t,i.__ref),i;if(jr(t)&&jr(i))return C(C({},t),i)}return i}}function Gl(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:C(C({},r),{clientOnly:e,deferred:t})),n}var Ld=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,l=er(n),u=md();s=C(C({},Ei(l)),s);var d=C(C({store:e,written:Object.create(null),merge:function(p,h){return u.merge(p,h)},variables:s,varString:xt(s)},as(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:d});if(!oe(f))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,v=p.mergeTree,w=p.fieldNodeSet,b=Xt(h);if(v&&v.map.size){var S=i.applyMerges(v,b,m,d);if(oe(S))return;m=S}if(__DEV__&&!d.overwrite){var _=Object.create(null);w.forEach(function(A){A.selectionSet&&(_[A.name.value]=!0)});var T=function(A){return _[Wt(A)]===!0},R=function(A){var N=v&&v.map.get(A);return Boolean(N&&N.info&&N.info.merge)};Object.keys(m).forEach(function(A){T(A)&&!R(A)&&uy(b,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,l=Object.create(null),u=i&&c.rootTypenamesById[i]||ha(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof u=="string"&&(l.__typename=u);var d=function(){var S=ls(arguments,l,o.variables);if(oe(S.from)){var _=o.incomingById.get(S.from.__ref);if(_){var T=c.readField(C(C({},S),{from:_.storeObject}),o);if(T!==void 0)return T}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,u).forEach(function(S,_){var T,R=Rt(_),A=n[R];if(f.add(_),A!==void 0){var N=c.getStoreFieldName({typename:u,fieldName:_.name.value,field:_,variables:S.variables}),L=Rd(s,N),P=t.processFieldValue(A,_,_.selectionSet?Gl(S,!1,!1):S,L),j=void 0;_.selectionSet&&(oe(P)||jr(P))&&(j=d("__typename",P));var ye=c.getMergeFunction(u,_.name.value,j);ye?L.info={field:_,typename:u,merge:ye}:$d(s,N),l=S.merge(l,(T={},T[N]=P,T))}else __DEV__&&!S.clientOnly&&!S.deferred&&!xi.added(_)&&!c.getReadFunction(u,_.name.value)&&__DEV__&&$.error("Missing field '".concat(Rt(_),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:u,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:l,readField:d}),h=p[0],m=p[1];i=i||h,m&&(l=o.merge(l,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var v=Xt(i),w=o.written[i]||(o.written[i]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(n,v,a,o)))return v;var b=o.incomingById.get(i);return b?(b.storeObject=o.merge(b.storeObject,l),b.mergeTree=Kl(b.mergeTree,s),f.forEach(function(S){return b.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:l,mergeTree:us(s)?void 0:s,fieldNodeSet:f}),v}return l},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?Qo(e):e:we(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,Rd(n,s));return $d(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=ha(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new tr(!1);return function c(l,u){var d=s.lookup(l,u.clientOnly,u.deferred);d.visited||(d.visited=!0,l.selections.forEach(function(f){if(!!gr(f,i.variables)){var p=u.clientOnly,h=u.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(w){var b=w.name.value;if(b==="client"&&(p=!0),b==="defer"){var S=yr(w,i.variables);(!S||S.if!==!1)&&(h=!0)}}),Et(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Gl(i,p,h))}else{var v=Si(f,i.lookupFragment);if(!v&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(f.name.value)):new J(8);v&&o.fragmentMatches(v,n,t,i.variables)&&c(v.selectionSet,Gl(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!oe(i)){var c=!we(i)&&(oe(t)||jr(t))?t:void 0,l=i;c&&!a&&(a=[oe(c)?c.__ref:c]);var u,d=function(f,p){return we(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(l,p);if(m!==void 0){a&&a.push(p);var v=s.applyMerges(f,h,m,n,a);v!==m&&(u=u||new Map,u.set(p,v)),a&&$(a.pop()===p)}}),u&&(i=we(l)?l.slice(0):C({},l),u.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var Fd=[];function Rd(r,e){var t=r.map;return t.has(e)||t.set(e,Fd.pop()||{map:new Map}),t.get(e)}function Kl(r,e){if(r===e||!e||us(e))return r;if(!r||us(r))return e;var t=r.info&&e.info?C(C({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Kl(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Kl(e.map.get(s),r.map.get(s)))})}return a}function us(r){return!r||!(r.info||r.map.size)}function $d(r,e){var t=r.map,i=t.get(e);i&&us(i)&&(Fd.push(i),t.delete(e))}var Pd=new Set;function uy(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!oe(a)&&!Te(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Wt(t),l="".concat(s,".").concat(c);if(!Pd.has(l)){Pd.add(l);var u=[];!we(a)&&!we(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!u.includes(f)&&u.push(f)}),__DEV__&&$.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
39
39
|
|
|
40
|
-
To address this problem (which is not a bug in Apollo Client), `).concat(
|
|
40
|
+
To address this problem (which is not a bug in Apollo Client), `).concat(u.length?"either ensure all objects of type "+u.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(l,` field, so InMemoryCache can safely merge these objects:
|
|
41
41
|
|
|
42
42
|
existing: `).concat(JSON.stringify(a).slice(0,1e3),`
|
|
43
43
|
incoming: `).concat(JSON.stringify(o).slice(0,1e3),`
|
|
@@ -46,27 +46,27 @@ For more information about these options, please refer to the documentation:
|
|
|
46
46
|
|
|
47
47
|
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
48
48
|
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
49
|
-
`))}}}}var Ta=function(
|
|
50
|
-
`)})}return
|
|
51
|
-
`)),e=e.replace(/\n$/,""),e},
|
|
52
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return r&&!ke(this.options.variables,r)&&(n.variables=this.options.variables=C(C({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(n,ye.refetch)},e.prototype.fetchMore=function(r){var i=this,n=C(C({},r.query?r:C(C(C(C({},this.options),{query:this.query}),r),{variables:C(C({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ye.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,n,ye.fetchMore).then(function(c){return i.queryManager.removeQuery(a),o.networkStatus===ye.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var d=r.updateQuery;d?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:c.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:c.data})},onWatchUpdated:function(l){u.add(l.query)}}),c}).finally(function(){u.has(i.query)||Ku(i)})},e.prototype.subscribeToMore=function(r){var i=this,n=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&i.updateQuery(function(s,u){var c=u.variables;return o(s,{subscriptionData:a,variables:c})})},error:function(a){if(r.onError){r.onError(a);return}__DEV__&&$.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return ke(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},ye.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:r,options:i,observable:this,initialFetchPolicy:s}):r==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(r,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,i)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?$(a,"Attempted to start a polling query without a polling interval."):$(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Qr(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ye.poll).then(u,u))},u=function(){var c=r.pollingInfo;c&&(clearTimeout(c.timeout),c.timeout=setTimeout(s,c.interval))};u()}}},e.prototype.updateLastResult=function(r,i){return i===void 0&&(i=this.variables),this.last=C(C({},this.last),{result:this.queryManager.assumeImmutableResults?r:Bo(r),variables:i}),qe(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,i){var n=this;this.isTornDown=!1;var a=i===ye.refetch||i===ye.fetchMore||i===ye.poll,o=this.options.variables,s=this.options.fetchPolicy,u=jr(this.options,r||{}),c=a?u:py(this.options,u);a||(this.updatePolling(),r&&r.variables&&!ke(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),i===void 0&&(i=ye.setVariables)));var l=c.variables&&C({},c.variables),d=this.fetch(c,i),f={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(r,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(r,i))&&((n||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,i),ki(this.observers,"next",r))},e.prototype.reportError=function(r,i){var n=C(C({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:ye.error,loading:!1});this.updateLastResult(n,i),ki(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(oe);Qo(us);function Ku(t){var e=t.options,r=e.fetchPolicy,i=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):r}}):t.reobserve()}function dy(t){__DEV__&&$.error("Unhandled error",t.message,t.stack)}function Zu(t){__DEV__&&t&&__DEV__&&$.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var ls=function(){function t(e){var r=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){r.resolvers=uu(r.resolvers,i)}):this.resolvers=uu(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Bt(this,void 0,void 0,function(){return Vt(this,function(u){return r?[2,this.resolveDocument(r,i.data,n,a,this.fragmentMatcher,s).then(function(c){return C(C({},i),{data:c.result})})]:[2,i]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return yn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return cu(e)},t.prototype.prepareContext=function(e){var r=this.cache;return C(C({},e),{cache:r,getCacheKey:function(i){return r.identify(i)}})},t.prototype.addExportedVariables=function(e,r,i){return r===void 0&&(r={}),i===void 0&&(i={}),Bt(this,void 0,void 0,function(){return Vt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(i),r).then(function(a){return C(C({},r),a.exportedVariables)})]:[2,C({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return nt(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(r=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),r))return _i}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:su(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Bt(this,void 0,void 0,function(){var s,u,c,l,d,f,p,h,m,b,_;return Vt(this,function(S){return s=Ei(e),u=Ci(e),c=Si(u),l=this.collectSelectionsToResolve(s,c),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,b={fragmentMap:c,context:C(C({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,r,b).then(function(w){return{result:w,exportedVariables:b.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Vt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,u=[i],c=function(f){return Bt(l,void 0,void 0,function(){var p,h;return Vt(this,function(m){return!r&&!n.selectionsToResolve.has(f)?[2]:yr(f,s)?Et(f)?[2,this.resolveField(f,r,i,n).then(function(b){var _;typeof b<"u"&&u.push((_={},_[Rt(f)]=b,_))})]:(iu(f)?p=f:(p=a[f.name.value],__DEV__?$(p,"No fragment named ".concat(f.name.value)):$(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,r,i,n).then(function(b){u.push(b)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return ga(u)})]})})},t.prototype.resolveField=function(e,r,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h=this;return Vt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Rt(e),u=o!==s,c=i[s]||i[o],l=Promise.resolve(c),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[u?o:s],p&&(l=Promise.resolve(Tn.withValue(this.cache,p,[i,vr(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(b){var _,S;if(b===void 0&&(b=c),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(D){D.name.value==="as"&&D.value.kind==="StringValue"&&(n.exportedVariables[D.value.value]=b)})}),!e.selectionSet||b==null)return b;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(v){return v.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(b))return h.resolveSubSelectedArray(e,r||w,b,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||w,b,n)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,r,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,n)}))},t.prototype.collectSelectionsToResolve=function(e,r){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),nt(o,{Directive:function(u,c,l,d,f){u.name.value==="client"&&f.forEach(function(p){i(p)&&pa(p)&&s.add(p)})},FragmentSpread:function(u,c,l,d,f){var p=r[u.name.value];__DEV__?$(p,"No fragment named ".concat(u.name.value)):$(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&pa(m)&&s.add(m)}),s.add(u),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},t}();var On=new(Pt?WeakMap:Map);function Ju(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return On.set(t,(On.get(t)+1)%1e15),r.apply(this,arguments)})}function Md(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var ps=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;On.has(i)||(On.set(i,0),Ju(i,"evict"),Ju(i,"modify"),Ju(i,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||ye.loading;return this.variables&&this.networkStatus!==ye.loading&&!ke(this.variables,e.variables)&&(r=ye.setVariables),ke(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){Md(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&ke(r,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(r);return this.updateLastDiff(n,r),n},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!ke(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=r.getDiff();i.fromOptimisticTransaction?e.observe():Ku(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Md(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Qr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=C(C({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!ke(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var i=this.lastWrite;return!(i&&i.dmCount===On.get(this.cache)&&ke(r,i.variables)&&ke(e.data,i.result.data))},t.prototype.markResult=function(e,r,i,n){var a=this,o=new mt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var u=zo(this.getDiff().result,e);e.data=u}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=o.merge(c.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(fs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:r,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:On.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=l.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ye.ready},t.prototype.markError=function(e){return this.networkStatus=ye.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function fs(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",i=!Cn(t);return!i&&r&&t.data&&(i=!0),i}var hy=Object.prototype.hasOwnProperty,Ud=function(){function t(e){var r=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,u=e.ssrMode,c=u===void 0?!1:u,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Pt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new ls({cache:r}),this.ssrMode=c,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new Z("QueryManager stopped while query was in flight"):new Z(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,c=u===void 0?[]:u,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,b=e.errorPolicy,_=b===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":b,S=e.keepRootFields,w=e.context;return Bt(this,void 0,void 0,function(){var v,D,N,A,R,F;return Vt(this,function(P){switch(P.label){case 0:return __DEV__?$(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):$(n,15),__DEV__?$(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):$(m==="network-only"||m==="no-cache",16),v=this.generateMutationId(),D=this.transform(n),N=D.document,A=D.hasClientExports,n=this.cache.transformForLink(N),a=this.getVariables(n,a),A?[4,this.localState.addExportedVariables(n,a,w)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[v]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:f,keepRootFields:S}),this.broadcastQueries(),F=this,[2,new Promise(function(j,Je){return Vo(F.getObservableFromLink(n,C(C({},w),{optimisticResponse:o}),a,!1),function(je){if(Cn(je)&&_==="none")throw new br({graphQLErrors:Wo(je)});R&&(R.loading=!1,R.error=null);var H=C({},je);return typeof c=="function"&&(c=c(H)),_==="ignore"&&Cn(H)&&delete H.errors,F.markMutationResult({mutationId:v,result:H,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:c,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:S})}).subscribe({next:function(je){F.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&j(je)},error:function(je){R&&(R.loading=!1,R.error=je),o&&F.cache.removeOptimistic(v),F.broadcastQueries(),Je(je instanceof br?je:new br({networkError:je}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var i=this;r===void 0&&(r=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&fs(n,e.errorPolicy)){if(Ur(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ur(n)&&qe(n.incremental)){var s=r.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),u=void 0;s.result&&(u=zo(s.result,n)),typeof u<"u"&&(n.data=u,a.push({result:u,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!hy.call(c,h))){var m=c[h],b=i.queries.get(f),_=b.document,S=b.variables,w=r.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),v=w.result,D=w.complete;if(D&&v){var N=m(v,{mutationResult:n,queryName:_&&bn(_)||void 0,queryVariables:S});N&&a.push({result:N,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!wf(n)||Ur(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=C(C({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,b){var _=b.fieldName,S=b.DELETE;return _==="__typename"?m:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},t.prototype.markMutationOptimistic=function(e,r){var i=this,n=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(C(C({},r),{result:{data:n}}),a)}catch(o){__DEV__&&$.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,i){return this.fetchQueryObservable(e,r,i).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,i){e[i]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var i=this.cache.transformDocument(e),n=ou(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Xc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:xi(er(i)),asQuery:C(C({},i),{definitions:i.definitions.map(function(c){return c.kind==="OperationDefinition"&&c.operation!=="query"?C(C({},c),{operation:"query"}):c})})},u=function(c){c&&!r.has(c)&&r.set(c,s)};u(e),u(i),u(a),u(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return C(C({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=C(C({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new ps(this),i=new us({queryManager:this,queryInfo:r,options:e});return this.queries.set(i.queryId,r),r.init({document:i.query,observableQuery:i,variables:i.variables}),i},t.prototype.query=function(e,r){var i=this;return r===void 0&&(r=this.generateQueryId()),__DEV__?$(e.query,"query option is required. You must specify your GraphQL document in the query option."):$(e.query,17),__DEV__?$(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):$(e.query.kind==="Document",18),__DEV__?$(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):$(!e.returnPartialData,19),__DEV__?$(!e.pollInterval,"pollInterval option only supported on watchQuery."):$(!e.pollInterval,20),this.fetchQuery(r,e).finally(function(){return i.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new Z("Store reset while query was in flight (not completed in link chain)"):new Z(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=ye.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):tu(o)?n.set(r.transform(o).document,!1):fe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var u=o.observableQuery,c=o.document;if(u){if(e==="all"){i.set(s,u);return}var l=u.queryName,d=u.options.fetchPolicy;if(d==="standby"||e==="active"&&!u.hasObservers())return;(e==="active"||l&&n.has(l)||c&&n.has(c))&&(i.set(s,u),l&&n.set(l,!0),c&&n.set(c,!0))}}),a.size&&a.forEach(function(o){var s=ba("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),c=new us({queryManager:r,queryInfo:u,options:C(C({},o),{fetchPolicy:"network-only"})});$(c.queryId===s),u.setObservableQuery(c),i.set(s,c)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&$.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,u=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var c=function(d){return r.getObservableFromLink(i,u,d).map(function(f){if(n!=="no-cache"&&(fs(f,a)&&r.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),Cn(f))throw new br({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,u).then(c);return new oe(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return c(o)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,i,n){var a=this,o;n===void 0&&(n=(o=r?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,u=this.transform(e).serverQuery;if(u){var c=this,l=c.inFlightLinkObservables,d=c.link,f={query:u,variables:i,operationName:bn(u)||void 0,context:this.prepareContext(C(C({},r),{forceFetch:!n}))};if(r=f.context,n){var p=l.get(u)||new Map;l.set(u,p);var h=xt(i);if(s=p.get(h),!s){var m=new wn([En(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(u)})}}else s=new wn([En(d,f)])}else s=new wn([oe.of({data:{}})]),r=this.prepareContext(r);var b=this.transform(e).clientQuery;return b&&(s=Vo(s,function(_){return a.localState.runResolvers({document:b,remoteResult:_,context:r,variables:i})})),s},t.prototype.getResultsFromLink=function(e,r,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Vo(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Wo(o),u=s.length>0;if(n>=e.lastRequestId){if(u&&i.errorPolicy==="none")throw e.markError(new br({graphQLErrors:s}));e.markResult(o,a,i,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:ye.ready};return u&&i.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=ye.error),c},function(o){var s=Fd(o)?o:new br({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,i){var n=this;i===void 0&&(i=ye.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),u=this.defaultOptions.watchQuery,c=r.fetchPolicy,l=c===void 0?u&&u.fetchPolicy||"cache-first":c,d=r.errorPolicy,f=d===void 0?u&&u.errorPolicy||"none":d,p=r.returnPartialData,h=p===void 0?!1:p,m=r.notifyOnNetworkStatusChange,b=m===void 0?!1:m,_=r.context,S=_===void 0?{}:_,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:b,context:S}),v=function(A){w.variables=A;var R=n.fetchQueryByPolicy(s,w,i);return w.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),R},D=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){D(),setTimeout(function(){return N.cancel(A)})});var N=new wn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(v):v(w.variables));return N.promise.then(D,D),N},t.prototype.refetchQueries=function(e){var r=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,u=s===void 0?o?ba("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){l.set(p,{oq:f,lastDiff:r.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ps&&f.watcher.observableQuery;if(m){if(c){l.delete(m.queryId);var b=c(m,p,h);return b===!0&&(b=m.refetch()),b!==!1&&d.set(m,b),b}c!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,b=f.diff,_;if(c){if(!b){var S=h.queryInfo;S.reset(),b=S.getDiff()}_=c(h,b,m)}(!c||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(p)}),u&&this.cache.removeOptimistic(u),d},t.prototype.fetchQueryByPolicy=function(e,r,i){var n=this,a=r.query,o=r.variables,s=r.fetchPolicy,u=r.refetchWritePolicy,c=r.errorPolicy,l=r.returnPartialData,d=r.context,f=r.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(v,D){D===void 0&&(D=e.networkStatus||ye.loading);var N=v.result;__DEV__&&!l&&!ke(N,{})&&Zu(v.missing);var A=function(R){return oe.of(C({data:R,loading:Qr(D),networkStatus:D},v.complete?null:{partial:!0}))};return N&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:N},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return A(R.data||void 0)}):c==="none"&&D===ye.refetch&&Array.isArray(v.missing)?A(void 0):A(N)},b=s==="no-cache"?0:i===ye.refetch&&u!=="merge"?1:2,_=function(){return n.getResultsFromLink(e,b,{variables:o,context:d,fetchPolicy:s,errorPolicy:c})},S=f&&typeof p=="number"&&p!==i&&Qr(i);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ps(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return C(C({},r),{clientAwareness:this.clientAwareness})},t}();var jd=!1;var ds=function(){function t(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,u=s===void 0?!1:s,c=e.ssrForceFetchDelay,l=c===void 0?0:c,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,b=e.assumeImmutableResults,_=b===void 0?!1:b,S=e.resolvers,w=e.typeDefs,v=e.fragmentMatcher,D=e.name,N=e.version,A=e.link;if(A||(A=i?new Au({uri:i,credentials:n,headers:a}):$t.empty()),!o)throw __DEV__?new Z(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
53
|
-
For more information, please visit: https://go.apollo.dev/c/docs`):new Z(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return r.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!jd&&f&&__DEV__&&(jd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,F=R&&R.userAgent,P=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&$.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Af,this.localState=new ls({cache:o,client:this,resolvers:S,fragmentMatcher:v}),this.queryManager=new Ud({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:D,version:N},localState:this.localState,assumeImmutableResults:_,onBroadcast:f?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=_a(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=_a(this.defaultOptions.query,e)),__DEV__?$(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):$(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=_a(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return En(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(i){return i!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(i){return i!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),i=[],n=[];r.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&$.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();Jp(bi?"log":"silent");function ct(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function _r(t){return ct(t)==="object"}function qd(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Yu(t,e){return t.length<124?t:e}var Bd="graphql-transport-ws";var gt;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(gt||(gt={}));var $e;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})($e||($e={}));function Vd(t){if(!_r(t))throw new Error(`Message is expected to be an object, but got ${ct(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ct(t.type)}`);switch(t.type){case $e.ConnectionInit:case $e.ConnectionAck:case $e.Ping:case $e.Pong:{if(t.payload!=null&&!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case $e.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ct(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${ct(t.payload.query)}`);if(t.payload.variables!=null&&!_r(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ct(t.payload.variables)}`);if(t.payload.operationName!=null&&ct(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ct(t.payload.operationName)}`);if(t.payload.extensions!=null&&!_r(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ct(t.payload.extensions)}`);break}case $e.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ct(t.payload)}`);break}case $e.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!qd(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case $e.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function Qd(t,e){return Vd(typeof t=="string"?JSON.parse(t,e):t)}function Dn(t,e){return Vd(t),JSON.stringify(t,e)}function Xu(t){let{url:e,connectionParams:r,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:u=0,retryAttempts:c=5,retryWait:l=async function(we){let Ce=1e3;for(let le=0;le<we;le++)Ce*=2;await new Promise(le=>setTimeout(le,Ce+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=hs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Ce=Math.random()*16|0;return(we=="x"?Ce:Ce&3|8).toString(16)})},jsonMessageReplacer:b,jsonMessageReviver:_}=t,S;if(h){if(!gy(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,v=(()=>{let H=(()=>{let Ce={};return{on(le,pe){return Ce[le]=pe,()=>{delete Ce[le]}},emit(le){var pe;"id"in le&&((pe=Ce[le.id])===null||pe===void 0||pe.call(Ce,le))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[H.emit,p.message]:[H.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:H.on,on(Ce,le){let pe=we[Ce];return pe.push(le),()=>{pe.splice(pe.indexOf(le),1)}},emit(Ce,...le){for(let pe of[...we[Ce]])pe(...le)}}})();function D(H){let we=[v.on("error",Ce=>{we.forEach(le=>le()),H(Ce)}),v.on("closed",Ce=>{we.forEach(le=>le()),H(Ce)})]}let N,A=0,R,F=!1,P=0,j=!1;async function Je(){clearTimeout(R);let[H,we]=await(N??(N=new Promise((pe,Zt)=>(async()=>{if(F){if(await l(P),!A)return N=void 0,Zt({code:1e3,reason:"All Subscriptions Gone"});P++}v.emit("connecting");let ae=new w(typeof e=="function"?await e():e,Bd),Jt,Dr;function Ao(){isFinite(o)&&o>0&&(clearTimeout(Dr),Dr=setTimeout(()=>{ae.readyState===w.OPEN&&(ae.send(Dn({type:$e.Ping})),v.emit("ping",!1,void 0))},o))}D(Ye=>{N=void 0,clearTimeout(Jt),clearTimeout(Dr),Zt(Ye),hs(Ye)&&Ye.code===4499&&(ae.close(4499,"Terminated"),ae.onerror=null,ae.onclose=null)}),ae.onerror=Ye=>v.emit("error",Ye),ae.onclose=Ye=>v.emit("closed",Ye),ae.onopen=async()=>{try{v.emit("opened",ae);let Ye=typeof r=="function"?await r():r;if(ae.readyState!==w.OPEN)return;ae.send(Dn(Ye?{type:$e.ConnectionInit,payload:Ye}:{type:$e.ConnectionInit},b)),isFinite(u)&&u>0&&(Jt=setTimeout(()=>{ae.close(gt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),Ao()}catch(Ye){v.emit("error",Ye),ae.close(gt.InternalClientError,Yu(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let fn=!1;ae.onmessage=({data:Ye})=>{try{let Xe=Qd(Ye,_);if(v.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){v.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Ao():s||(ae.send(Dn(Xe.payload?{type:$e.Pong,payload:Xe.payload}:{type:$e.Pong})),v.emit("pong",!1,Xe.payload));return}if(fn)return;if(Xe.type!==$e.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(Jt),fn=!0,v.emit("connected",ae,Xe.payload),F=!1,P=0,pe([ae,new Promise((V3,pm)=>D(pm))])}catch(Xe){ae.onmessage=null,v.emit("error",Xe),ae.close(gt.BadResponse,Yu(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));H.readyState===w.CLOSING&&await we;let Ce=()=>{},le=new Promise(pe=>Ce=pe);return[H,Ce,Promise.race([le.then(()=>{if(!A){let pe=()=>H.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{H.readyState===w.OPEN&&pe()},a):pe()}}),we])]}function je(H){if(hs(H)&&(my(H.code)||[gt.InternalServerError,gt.InternalClientError,gt.BadRequest,gt.BadResponse,gt.Unauthorized,gt.SubprotocolNotAcceptable,gt.SubscriberAlreadyExists,gt.TooManyInitialisationRequests].includes(H.code)))throw H;if(j)return!1;if(hs(H)&&H.code===1e3)return A>0;if(!c||P>=c||!d(H)||f?.(H))throw H;return F=!0}return i||(async()=>{for(A++;;)try{let[,,H]=await Je();await H}catch(H){try{if(!je(H))return}catch(we){return n?.(we)}}})(),{on:v.on,subscribe(H,we){let Ce=m(H),le=!1,pe=!1,Zt=()=>{A--,le=!0};return(async()=>{for(A++;;)try{let[ae,Jt,Dr]=await Je();if(le)return Jt();let Ao=v.onMessage(Ce,fn=>{switch(fn.type){case $e.Next:{we.next(fn.payload);return}case $e.Error:{pe=!0,le=!0,we.error(fn.payload),Zt();return}case $e.Complete:{le=!0,Zt();return}}});ae.send(Dn({id:Ce,type:$e.Subscribe,payload:H},b)),Zt=()=>{!le&&ae.readyState===w.OPEN&&ae.send(Dn({id:Ce,type:$e.Complete},b)),A--,le=!0,Jt()},await Dr.finally(Ao);return}catch(ae){if(!je(ae))return}})().then(()=>{pe||we.complete()}).catch(ae=>{we.error(ae)}),()=>{le||Zt()}},async dispose(){if(j=!0,N){let[H]=await N;H.close(1e3,"Normal Closure")}},terminate(){N&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function hs(t){return _r(t)&&"code"in t&&"reason"in t}function my(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function gy(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function yy(t){return fe(t)&&"code"in t&&"reason"in t}var el=function(t){Re(e,t);function e(r){var i=t.call(this)||this;return i.client=r,i}return e.prototype.request=function(r){var i=this;return new oe(function(n){return i.client.subscribe(C(C({},r),{query:gn(r.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):yy(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new br({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}($t);var Ws=function(){return Ws=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Ws.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ts(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ts=function(r){return typeof r}:Ts=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ts(t)}function vy(t){return Ts(t)=="object"&&t!==null}var u1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Sl(t,e){for(var r=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=r.exec(t.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function by(t){return l1(t.source,Sl(t.source,t.start))}function l1(t,e){var r=t.locationOffset.column-1,i=Is(r)+t.body,n=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,u=e.column+s,c="".concat(t.name,":").concat(o,":").concat(u,`
|
|
54
|
-
`),
|
|
55
|
-
`)}function
|
|
56
|
-
|
|
57
|
-
`+
|
|
58
|
-
|
|
59
|
-
`+
|
|
60
|
-
`)}function
|
|
61
|
-
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=Xy(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw kt(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw kt(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw kt(t,o,"Unterminated string.")}function Yy(t,e,r,i,n,a){for(var o=t.body,s=e+3,u=s,c=0,l="";s<o.length&&!isNaN(c=o.charCodeAt(s));){if(c===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(u,s),new Fe(I.BLOCK_STRING,e,s+3,r,i,n,Vy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw kt(t,s,"Invalid character within String: ".concat(zi(c),"."));c===10?(++s,++a.line,a.lineStart=s):c===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):c===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(u,s)+'"""',s+=4,u=s):++s}throw kt(t,s,"Unterminated string.")}function Xy(t,e,r,i){return ms(t)<<12|ms(e)<<8|ms(r)<<4|ms(i)}function ms(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function e0(t,e,r,i,n){for(var a=t.body,o=a.length,s=e+1,u=0;s!==o&&!isNaN(u=a.charCodeAt(s))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new Fe(I.NAME,e,s,r,i,n,a.slice(e,s))}function t0(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function r0(t,e){var r=new i0(t,e);return r.parseDocument()}var i0=function(){function t(r,i){var n=qy(r)?r:new g1(r);this._lexer=new zy(n),this._options=i}var e=t.prototype;return e.parseName=function(){var i=this.expectToken(I.NAME);return{kind:W.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:W.DOCUMENT,definitions:this.many(I.SOF,this.parseDefinition,I.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(I.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(I.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(I.BRACE_L))return{kind:W.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(I.NAME)&&(a=this.parseName()),{kind:W.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(I.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(I.PAREN_L,this.parseVariableDefinition,I.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:W.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(I.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(I.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(I.DOLLAR),{kind:W.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:W.SELECTION_SET,selections:this.many(I.BRACE_L,this.parseSelection,I.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(I.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(I.COLON)?(a=n,o=this.parseName()):o=n,{kind:W.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(I.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(I.PAREN_L,n,I.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(I.COLON),{kind:W.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:W.ARGUMENT,name:this.parseName(),value:(this.expectToken(I.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(I.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(I.NAME)?{kind:W.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:W.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:W.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:W.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case I.BRACKET_L:return this.parseList(i);case I.BRACE_L:return this.parseObject(i);case I.INT:return this._lexer.advance(),{kind:W.INT,value:n.value,loc:this.loc(n)};case I.FLOAT:return this._lexer.advance(),{kind:W.FLOAT,value:n.value,loc:this.loc(n)};case I.STRING:case I.BLOCK_STRING:return this.parseStringLiteral();case I.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:W.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:W.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:W.NULL,loc:this.loc(n)};default:return{kind:W.ENUM,value:n.value,loc:this.loc(n)}}case I.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:W.STRING,value:i.value,block:i.kind===I.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:W.LIST,values:this.any(I.BRACKET_L,o,I.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:W.OBJECT,fields:this.any(I.BRACE_L,o,I.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(I.COLON),{kind:W.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(I.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(I.AT),{kind:W.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(I.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(I.BRACKET_R),n={kind:W.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(I.BANG)?{kind:W.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:W.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===I.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(I.STRING)||this.peek(I.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);return{kind:W.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(I.COLON);var a=this.parseNamedType();return{kind:W.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:W.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(I.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(I.AMP)||this.peek(I.NAME));return n}return this.delimitedMany(I.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(I.BRACE_L)&&this._lexer.lookahead().kind===I.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(I.BRACE_L,this.parseFieldDefinition,I.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(I.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:W.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:u,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(I.PAREN_L,this.parseInputValueDef,I.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(I.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(I.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:W.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:W.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:W.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(I.EQUALS)?this.delimitedMany(I.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:W.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseEnumValueDefinition,I.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:W.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseInputValueDef,I.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===I.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:W.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:W.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:W.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:W.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(I.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:W.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(I.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(By[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new h1(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw kt(this._lexer.source,n.start,"Expected ".concat(y1(i),", found ").concat(il(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===I.NAME&&n.value===i)this._lexer.advance();else throw kt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(il(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===I.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return kt(this._lexer.source,n.start,"Unexpected ".concat(il(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},t}();function il(t){var e=t.value;return y1(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function y1(t){return Wy(t)?'"'.concat(t,'"'):t}var Rs=new Map,El=new Map,v1=!0,Hs=!1;function b1(t){return t.replace(/[\s,]+/g," ").trim()}function n0(t){return b1(t.source.body.substring(t.start,t.end))}function a0(t){var e=new Set,r=[];return t.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=n0(i.loc),o=El.get(n);o&&!o.has(a)?v1&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
49
|
+
`))}}}}var Ta=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=cs,i.txCount=0,i.config=dd(t),i.addTypename=!!i.config.addTypename,i.policies=new Dd({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var t=this.data=new An.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new Ld(this,this.storeReader=new _d({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ns(this.config),canon:t?void 0:n&&n.canon,fragments:a}),a),this.maybeBroadcastWatch=ki(function(o,s){return i.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?i.optimisticData:i.data;if(Ti(s)){var c=o.optimistic,l=o.id,u=o.variables;return s.makeCacheKey(o.query,o.callback,xt({optimistic:c,id:l,variables:u}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var i=t.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(C(C({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(a){if(a instanceof xa)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if($e.call(t,"id")&&!t.id)return!1;var i=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(C(C({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var i=this;return this.watches.size||wd(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){i.watches.delete(t)&&!i.watches.size&&Bl(i),i.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){xt.reset();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,i){return(i?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,i){return(i?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(oe(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(i){__DEV__&&$.warn(i)}},e.prototype.evict=function(t){if(!t.id){if($e.call(t,"id"))return!1;t=C(C({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var i=this;return this.init(),xt.reset(),t&&t.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),Bl(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var i=this.optimisticData.removeLayer(t);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(t){var i=this,n=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,l,u=function(f){var p=i,h=p.data,m=p.optimisticData;++i.txCount,f&&(i.data=i.optimisticData=f);try{return l=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(C(C({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,u):o===!1?u(this.data):u(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(C(C({},t),{onWatchUpdated:function(f,p){var h=c.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return i.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),l},e.prototype.performTransaction=function(t,i){return this.batch({update:t,optimistic:i||i!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var i=this.typenameDocumentCache.get(t);return i||(i=xi(t),this.typenameDocumentCache.set(t,i),this.typenameDocumentCache.set(i,i)),i}return t},e.prototype.transformForLink=function(t){var i=this.config.fragments;return i?i.transform(t):t},e.prototype.broadcastWatches=function(t){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,t)})},e.prototype.broadcastWatch=function(t,i){var n=t.lastDiff,a=this.diff(t);i&&(t.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,t,a,n)===!1)||(!n||!Te(n.result,a.result))&&t.callback(t.lastDiff=a,n)},e}(Pl);function Md(r){return r.hasOwnProperty("graphQLErrors")}var py=function(r){var e="";if(qe(r.graphQLErrors)||qe(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
|
|
50
|
+
`)})}return r.networkError&&(e+="".concat(r.networkError.message,`
|
|
51
|
+
`)),e=e.replace(/\n$/,""),e},vr=function(r){Re(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||py(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var ve;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(ve||(ve={}));function Br(r){return r?r<7:!1}var fy=Object.assign,dy=Object.hasOwnProperty,ps=function(r){Re(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(v){try{var w=v._subscription._observer;w&&!w.error&&(w.error=hy)}catch{}var b=!o.observers.size;o.observers.add(v);var S=o.last;return S&&S.error?v.error&&v.error(S.error):S&&S.result&&v.next&&v.next(S.result),b&&o.reobserve().catch(function(){}),function(){o.observers.delete(v)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,l=c.fetchPolicy,u=l===void 0?"cache-first":l,d=a.fetchPolicy,f=d===void 0?u:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?u:f:p;o.options=C(C({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=n.queryId||i.generateQueryId();var m=er(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||ve.ready,a=C(C({},i),{loading:Br(n),networkStatus:n}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Te(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===ve.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ve.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Jl(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!Te(this.last.result,t)||i&&!Te(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||Te(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&dy.call(t,"variables")){var o=ma(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&$.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
|
|
52
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Te(this.options.variables,t)&&(n.variables=this.options.variables=C(C({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,ve.refetch)},e.prototype.fetchMore=function(t){var i=this,n=C(C({},t.query?t:C(C(C(C({},this.options),{query:this.query}),t),{variables:C(C({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ve.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,ve.fetchMore).then(function(l){return i.queryManager.removeQuery(a),o.networkStatus===ve.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(u){var d=t.updateQuery;d?u.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:l.data,variables:n.variables})}):u.writeQuery({query:n.query,variables:n.variables,data:l.data})},onWatchUpdated:function(u){c.add(u.query)}}),l}).finally(function(){c.has(i.query)||Zl(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var l=c.variables;return o(s,{subscriptionData:a,variables:l})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&$.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Te(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},ve.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?$(a,"Attempted to start a polling query without a polling interval."):$(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Br(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ve.poll).then(c,c))},c=function(){var l=t.pollingInfo;l&&(clearTimeout(l.timeout),l.timeout=setTimeout(s,l.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=C(C({},this.last),{result:this.queryManager.assumeImmutableResults?t:Qo(t),variables:i}),qe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===ve.refetch||i===ve.fetchMore||i===ve.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Mr(this.options,t||{}),l=a?c:fy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Te(t.variables,o)&&l.fetchPolicy!=="standby"&&l.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",l),i===void 0&&(i=ve.setVariables)));var u=l.variables&&C({},l.variables),d=this.fetch(l,i),f={next:function(p){n.reportResult(p,u)},error:function(p){n.reportError(p,u)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Ai(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=C(C({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:ve.error,loading:!1});this.updateLastResult(n,i),Ai(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ae);Wo(ps);function Zl(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function hy(r){__DEV__&&$.error("Unhandled error",r.message,r.stack)}function Jl(r){__DEV__&&r&&__DEV__&&$.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var fs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=ul(t.resolvers,i)}):this.resolvers=ul(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Bt(this,void 0,void 0,function(){return Vt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(l){return C(C({},i),{data:l.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return gn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return ll(e)},r.prototype.prepareContext=function(e){var t=this.cache;return C(C({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Bt(this,void 0,void 0,function(){return Vt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return C(C({},t),a.exportedVariables)})]:[2,C({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return ct(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return bi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:cl(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Bt(this,void 0,void 0,function(){var s,c,l,u,d,f,p,h,m,v,w;return Vt(this,function(b){return s=Ci(e),c=wi(e),l=_i(c),u=this.collectSelectionsToResolve(s,l),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,v={fragmentMap:l,context:C(C({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,v).then(function(S){return{result:S,exportedVariables:v.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u=this;return Vt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],l=function(f){return Bt(u,void 0,void 0,function(){var p,h;return Vt(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:gr(f,s)?Et(f)?[2,this.resolveField(f,t,i,n).then(function(v){var w;typeof v<"u"&&c.push((w={},w[Rt(f)]=v,w))})]:(nl(f)?p=f:(p=a[f.name.value],__DEV__?$(p,"No fragment named ".concat(f.name.value)):$(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(v){c.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return ga(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h=this;return Vt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Rt(e),c=o!==s,l=i[s]||i[o],u=Promise.resolve(l),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(u=Promise.resolve(kn.withValue(this.cache,p,[i,yr(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,u.then(function(v){var w,b;if(v===void 0&&(v=l),e.directives&&e.directives.forEach(function(_){_.name.value==="export"&&_.arguments&&_.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(n.exportedVariables[T.value.value]=v)})}),!e.selectionSet||v==null)return v;var S=(b=(w=e.directives)===null||w===void 0?void 0:w.some(function(_){return _.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(v))return h.resolveSubSelectedArray(e,t||S,v,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,v,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),ct(o,{Directive:function(c,l,u,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&pa(p)&&s.add(p)})},FragmentSpread:function(c,l,u,d,f){var p=t[c.name.value];__DEV__?$(p,"No fragment named ".concat(c.name.value)):$(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&pa(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var In=new($t?WeakMap:Map);function Yl(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return In.set(r,(In.get(r)+1)%1e15),t.apply(this,arguments)})}function Ud(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ds=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;In.has(i)||(In.set(i,0),Yl(i,"evict"),Yl(i,"modify"),Yl(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||ve.loading;return this.variables&&this.networkStatus!==ve.loading&&!Te(this.variables,e.variables)&&(t=ve.setVariables),Te(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){Ud(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Te(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Te(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():Zl(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;Ud(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Br(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=C(C({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Te(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===In.get(this.cache)&&Te(t,i.variables)&&Te(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new yt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var c=Ho(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var l=this.getDiff();e.data=o.merge(l.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(hs(e,i.errorPolicy)?this.cache.performTransaction(function(u){if(a.shouldWrite(e,i.variables))u.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:In.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=u.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ve.ready},r.prototype.markError=function(e){return this.networkStatus=ve.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function hs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!wn(r);return!i&&t&&r.data&&(i=!0),i}var my=Object.prototype.hasOwnProperty,jd=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,l=c===void 0?!1:c,u=e.clientAwareness,d=u===void 0?{}:u,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new($t?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new fs({cache:t}),this.ssrMode=l,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new J("QueryManager stopped while query was in flight"):new J(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,l=c===void 0?[]:c,u=e.awaitRefetchQueries,d=u===void 0?!1:u,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,v=e.errorPolicy,w=v===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":v,b=e.keepRootFields,S=e.context;return Bt(this,void 0,void 0,function(){var _,T,R,A,N,L;return Vt(this,function(P){switch(P.label){case 0:return __DEV__?$(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):$(n,15),__DEV__?$(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):$(m==="network-only"||m==="no-cache",16),_=this.generateMutationId(),T=this.transform(n),R=T.document,A=T.hasClientExports,n=this.cache.transformForLink(R),a=this.getVariables(n,a),A?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return N=this.mutationStore&&(this.mutationStore[_]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:_,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:f,keepRootFields:b}),this.broadcastQueries(),L=this,[2,new Promise(function(j,ye){return zo(L.getObservableFromLink(n,C(C({},S),{optimisticResponse:o}),a,!1),function(je){if(wn(je)&&w==="none")throw new vr({graphQLErrors:Go(je)});N&&(N.loading=!1,N.error=null);var G=C({},je);return typeof l=="function"&&(l=l(G)),w==="ignore"&&wn(G)&&delete G.errors,L.markMutationResult({mutationId:_,result:G,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:l,removeOptimistic:o?_:void 0,onQueryUpdated:p,keepRootFields:b})}).subscribe({next:function(je){L.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&j(je)},error:function(je){N&&(N.loading=!1,N.error=je),o&&L.cache.removeOptimistic(_),L.broadcastQueries(),ye(je instanceof vr?je:new vr({networkError:je}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&hs(n,e.errorPolicy)){if(Fr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Fr(n)&&qe(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Ho(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var l=e.updateQueries;l&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!my.call(l,h))){var m=l[h],v=i.queries.get(f),w=v.document,b=v.variables,S=t.diff({query:w,variables:b,returnPartialData:!0,optimistic:!1}),_=S.result,T=S.complete;if(T&&_){var R=m(_,{mutationResult:n,queryName:w&&vn(w)||void 0,queryVariables:b});R&&a.push({result:R,dataId:"ROOT_QUERY",query:w,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Cf(n)||Fr(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=C(C({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,v){var w=v.fieldName,b=v.DELETE;return w==="__typename"?m:b}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return u.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(C(C({},t),{result:{data:n}}),a)}catch(o){__DEV__&&$.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=sl(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:el(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ei(er(i)),asQuery:C(C({},i),{definitions:i.definitions.map(function(l){return l.kind==="OperationDefinition"&&l.operation!=="query"?C(C({},l),{operation:"query"}):l})})},c=function(l){l&&!t.has(l)&&t.set(l,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return C(C({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=C(C({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new ds(this),i=new ps({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?$(e.query,"query option is required. You must specify your GraphQL document in the query option."):$(e.query,17),__DEV__?$(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):$(e.query.kind==="Document",18),__DEV__?$(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):$(!e.returnPartialData,19),__DEV__?$(!e.pollInterval,"pollInterval option only supported on watchQuery."):$(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new J("Store reset while query was in flight (not completed in link chain)"):new J(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=ve.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):rl(o)?n.set(t.transform(o).document,!1):pe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,l=o.document;if(c){if(e==="all"){i.set(s,c);return}var u=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||u&&n.has(u)||l&&n.has(l))&&(i.set(s,c),u&&n.set(u,!0),l&&n.set(l,!0))}}),a.size&&a.forEach(function(o){var s=ba("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),l=new ps({queryManager:t,queryInfo:c,options:C(C({},o),{fetchPolicy:"network-only"})});$(l.queryId===s),c.setObservableQuery(l),i.set(s,l)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&$.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var l=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(hs(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),wn(f))throw new vr({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var u=this.localState.addExportedVariables(i,o,c).then(l);return new ae(function(d){var f=null;return u.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return l(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var l=this,u=l.inFlightLinkObservables,d=l.link,f={query:c,variables:i,operationName:vn(c)||void 0,context:this.prepareContext(C(C({},t),{forceFetch:!n}))};if(t=f.context,n){var p=u.get(c)||new Map;u.set(c,p);var h=xt(i);if(s=p.get(h),!s){var m=new Sn([Cn(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&u.delete(c)})}}else s=new Sn([Cn(d,f)])}else s=new Sn([ae.of({data:{}})]),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(s=zo(s,function(w){return a.localState.runResolvers({document:v,remoteResult:w,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return zo(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Go(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new vr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var l={data:o.data,loading:!1,networkStatus:ve.ready};return c&&i.errorPolicy!=="ignore"&&(l.errors=s,l.networkStatus=ve.error),l},function(o){var s=Md(o)?o:new vr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=ve.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,u=l===void 0?c&&c.fetchPolicy||"cache-first":l,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,v=m===void 0?!1:m,w=t.context,b=w===void 0?{}:w,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:u,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:v,context:b}),_=function(A){S.variables=A;var N=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&N.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),N},T=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){T(),setTimeout(function(){return R.cancel(A)})});var R=new Sn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(_):_(S.variables));return R.promise.then(T,T),R},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?ba("refetchQueries"):void 0:s,l=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){u.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ds&&f.watcher.observableQuery;if(m){if(l){u.delete(m.queryId);var v=l(m,p,h);return v===!0&&(v=m.refetch()),v!==!1&&d.set(m,v),v}l!==null&&u.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),u.size&&u.forEach(function(f,p){var h=f.oq,m=f.lastDiff,v=f.diff,w;if(l){if(!v){var b=h.queryInfo;b.reset(),v=b.getDiff()}w=l(h,v,m)}(!l||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,u=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(_,T){T===void 0&&(T=e.networkStatus||ve.loading);var R=_.result;__DEV__&&!u&&!Te(R,{})&&Jl(_.missing);var A=function(N){return ae.of(C({data:N,loading:Br(T),networkStatus:T},_.complete?null:{partial:!0}))};return R&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(N){return A(N.data||void 0)}):l==="none"&&T===ve.refetch&&Array.isArray(_.missing)?A(void 0):A(R)},v=s==="no-cache"?0:i===ve.refetch&&c!=="merge"?1:2,w=function(){return n.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:l})},b=f&&typeof p=="number"&&p!==i&&Br(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:u||b?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||u||b?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),w()]:[w()];case"no-cache":return b?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ds(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return C(C({},t),{clientAwareness:this.clientAwareness})},r}();var qd=!1;var ms=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,l=e.ssrForceFetchDelay,u=l===void 0?0:l,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,v=e.assumeImmutableResults,w=v===void 0?!1:v,b=e.resolvers,S=e.typeDefs,_=e.fragmentMatcher,T=e.name,R=e.version,A=e.link;if(A||(A=i?new kl({uri:i,credentials:n,headers:a}):Pt.empty()),!o)throw __DEV__?new J(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
53
|
+
For more information, please visit: https://go.apollo.dev/c/docs`):new J(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=c||u>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,u&&setTimeout(function(){return t.disableNetworkFetches=!1},u),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!qd&&f&&__DEV__&&(qd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var N=window.navigator,L=N&&N.userAgent,P=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&$.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=kf,this.localState=new fs({cache:o,client:this,resolvers:b,fragmentMatcher:_}),this.queryManager=new jd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:R},localState:this.localState,assumeImmutableResults:w,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=_a(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=_a(this.defaultOptions.query,e)),__DEV__?$(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):$(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=_a(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Cn(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&$.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Yp(vi?"log":"silent");function ft(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function br(r){return ft(r)==="object"}function Bd(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Xl(r,e){return r.length<124?r:e}var Vd="graphql-transport-ws";var vt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(vt||(vt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function Qd(r){if(!br(r))throw new Error(`Message is expected to be an object, but got ${ft(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ft(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ft(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${ft(r.payload.query)}`);if(r.payload.variables!=null&&!br(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ft(r.payload.variables)}`);if(r.payload.operationName!=null&&ft(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ft(r.payload.operationName)}`);if(r.payload.extensions!=null&&!br(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ft(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ft(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Bd(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function zd(r,e){return Qd(typeof r=="string"?JSON.parse(r,e):r)}function On(r,e){return Qd(r),JSON.stringify(r,e)}function eu(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:l=5,retryWait:u=async function(Ce){let Ee=1e3;for(let le=0;le<Ce;le++)Ee*=2;await new Promise(le=>setTimeout(le,Ee+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=gs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ce=>{let Ee=Math.random()*16|0;return(Ce=="x"?Ee:Ee&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:w}=r,b;if(h){if(!yy(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=b,_=(()=>{let G=(()=>{let Ee={};return{on(le,ue){return Ee[le]=ue,()=>{delete Ee[le]}},emit(le){var ue;"id"in le&&((ue=Ee[le.id])===null||ue===void 0||ue.call(Ee,le))}}})(),Ce={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[G.emit,p.message]:[G.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:G.on,on(Ee,le){let ue=Ce[Ee];return ue.push(le),()=>{ue.splice(ue.indexOf(le),1)}},emit(Ee,...le){for(let ue of[...Ce[Ee]])ue(...le)}}})();function T(G){let Ce=[_.on("error",Ee=>{Ce.forEach(le=>le()),G(Ee)}),_.on("closed",Ee=>{Ce.forEach(le=>le()),G(Ee)})]}let R,A=0,N,L=!1,P=0,j=!1;async function ye(){clearTimeout(N);let[G,Ce]=await(R??(R=new Promise((ue,Zt)=>(async()=>{if(L){if(await u(P),!A)return R=void 0,Zt({code:1e3,reason:"All Subscriptions Gone"});P++}_.emit("connecting");let ne=new S(typeof e=="function"?await e():e,Vd),Jt,Ir;function To(){isFinite(o)&&o>0&&(clearTimeout(Ir),Ir=setTimeout(()=>{ne.readyState===S.OPEN&&(ne.send(On({type:Pe.Ping})),_.emit("ping",!1,void 0))},o))}T(Ye=>{R=void 0,clearTimeout(Jt),clearTimeout(Ir),Zt(Ye),gs(Ye)&&Ye.code===4499&&(ne.close(4499,"Terminated"),ne.onerror=null,ne.onclose=null)}),ne.onerror=Ye=>_.emit("error",Ye),ne.onclose=Ye=>_.emit("closed",Ye),ne.onopen=async()=>{try{_.emit("opened",ne);let Ye=typeof t=="function"?await t():t;if(ne.readyState!==S.OPEN)return;ne.send(On(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},v)),isFinite(c)&&c>0&&(Jt=setTimeout(()=>{ne.close(vt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),To()}catch(Ye){_.emit("error",Ye),ne.close(vt.InternalClientError,Xl(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let pn=!1;ne.onmessage=({data:Ye})=>{try{let Xe=zd(Ye,w);if(_.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){_.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?To():s||(ne.send(On(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),_.emit("pong",!1,Xe.payload));return}if(pn)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(Jt),pn=!0,_.emit("connected",ne,Xe.payload),L=!1,P=0,ue([ne,new Promise((Q3,fm)=>T(fm))])}catch(Xe){ne.onmessage=null,_.emit("error",Xe),ne.close(vt.BadResponse,Xl(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));G.readyState===S.CLOSING&&await Ce;let Ee=()=>{},le=new Promise(ue=>Ee=ue);return[G,Ee,Promise.race([le.then(()=>{if(!A){let ue=()=>G.close(1e3,"Normal Closure");isFinite(a)&&a>0?N=setTimeout(()=>{G.readyState===S.OPEN&&ue()},a):ue()}}),Ce])]}function je(G){if(gs(G)&&(gy(G.code)||[vt.InternalServerError,vt.InternalClientError,vt.BadRequest,vt.BadResponse,vt.Unauthorized,vt.SubprotocolNotAcceptable,vt.SubscriberAlreadyExists,vt.TooManyInitialisationRequests].includes(G.code)))throw G;if(j)return!1;if(gs(G)&&G.code===1e3)return A>0;if(!l||P>=l||!d(G)||f?.(G))throw G;return L=!0}return i||(async()=>{for(A++;;)try{let[,,G]=await ye();await G}catch(G){try{if(!je(G))return}catch(Ce){return n?.(Ce)}}})(),{on:_.on,subscribe(G,Ce){let Ee=m(G),le=!1,ue=!1,Zt=()=>{A--,le=!0};return(async()=>{for(A++;;)try{let[ne,Jt,Ir]=await ye();if(le)return Jt();let To=_.onMessage(Ee,pn=>{switch(pn.type){case Pe.Next:{Ce.next(pn.payload);return}case Pe.Error:{ue=!0,le=!0,Ce.error(pn.payload),Zt();return}case Pe.Complete:{le=!0,Zt();return}}});ne.send(On({id:Ee,type:Pe.Subscribe,payload:G},v)),Zt=()=>{!le&&ne.readyState===S.OPEN&&ne.send(On({id:Ee,type:Pe.Complete},v)),A--,le=!0,Jt()},await Ir.finally(To);return}catch(ne){if(!je(ne))return}})().then(()=>{ue||Ce.complete()}).catch(ne=>{Ce.error(ne)}),()=>{le||Zt()}},async dispose(){if(j=!0,R){let[G]=await R;G.close(1e3,"Normal Closure")}},terminate(){R&&_.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function gs(r){return br(r)&&"code"in r&&"reason"in r}function gy(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function yy(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function vy(r){return pe(r)&&"code"in r&&"reason"in r}var tu=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new ae(function(n){return i.client.subscribe(C(C({},t),{query:mn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):vy(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new vr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Pt);var Gs=function(){return Gs=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Gs.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Os(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Os=function(t){return typeof t}:Os=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(r)}function by(r){return Os(r)=="object"&&r!==null}var u1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wu(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function _y(r){return p1(r.source,wu(r.source,r.start))}function p1(r,e){var t=r.locationOffset.column-1,i=Ds(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,l="".concat(r.name,":").concat(o,":").concat(c,`
|
|
54
|
+
`),u=i.split(/\r\n|[\n\r]/g),d=u[n];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return l+Wd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(v){return["",v]}),[[" ",Ds(p-1)+"^"],["",h[f+1]]]))}return l+Wd([["".concat(o-1),u[n-1]],["".concat(o),d],["",Ds(c-1)+"^"],["".concat(o+1),u[n+1]]])}function Wd(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return Sy(t,n)+(a?" | "+a:" |")}).join(`
|
|
55
|
+
`)}function Ds(r){return Array(r+1).join(" ")}function Sy(r,e){return Ds(r-e.length)+e}function Ns(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ns=function(t){return typeof t}:Ns=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ns(r)}function Hd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function wy(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hd(Object(t),!0).forEach(function(i){Cy(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Hd(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function Cy(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Gd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function xy(r,e,t){return e&&Gd(r.prototype,e),t&&Gd(r,t),r}function Ay(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ro(r,e)}function ky(r){var e=d1();return function(){var i=io(r),n;if(e){var a=io(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return f1(this,n)}}function f1(r,e){return e&&(Ns(e)==="object"||typeof e=="function")?e:Ra(r)}function Ra(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Cu(r){var e=typeof Map=="function"?new Map:void 0;return Cu=function(i){if(i===null||!Ty(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Rs(i,arguments,io(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ro(n,i)},Cu(r)}function Rs(r,e,t){return d1()?Rs=Reflect.construct:Rs=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),l=new c;return o&&ro(l,o.prototype),l},Rs.apply(null,arguments)}function d1(){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 Ty(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function ro(r,e){return ro=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},ro(r,e)}function io(r){return io=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},io(r)}var Iy=function(r){Ay(t,r);var e=ky(t);function t(i,n,a,o,s,c,l){var u,d,f,p;Ey(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Kd(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,v=(w=p.nodes)!==null&&w!==void 0?w:[];m<v.length;m++){var w,b=v[m],S=b.loc;S!=null&&h.push(S)}h=Kd(h),p.source=a??((u=h)===null||u===void 0?void 0:u[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(T){return T.start})),p.locations=o&&a?o.map(function(T){return wu(a,T)}):(f=h)===null||f===void 0?void 0:f.map(function(T){return wu(T.source,T.start)}),p.path=s??void 0;var _=c?.extensions;return l==null&&by(_)?p.extensions=wy({},_):p.extensions=l??{},Object.defineProperties(Ra(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ra(p),"stack",{value:c.stack,writable:!0,configurable:!0}),f1(p)):(Error.captureStackTrace?Error.captureStackTrace(Ra(p),t):Object.defineProperty(Ra(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return xy(t,[{key:"toString",value:function(){return Oy(this)}},{key:u1,get:function(){return"Object"}}]),t}(Cu(Error));function Kd(r){return r===void 0||r.length===0?void 0:r}function Oy(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
|
|
56
|
+
|
|
57
|
+
`+_y(n.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
|
|
58
|
+
|
|
59
|
+
`+p1(r.source,s)}return e}function kt(r,e,t){return new Iy("Syntax Error: ".concat(t),void 0,r,[e])}var H=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 Dy(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ny=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Eu=Ny;function h1(r){var e=r.prototype.toJSON;typeof e=="function"||Dy(0),r.prototype.inspect=e,Eu&&(r.prototype[Eu]=e)}var m1=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();h1(m1);var Fe=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();h1(Fe);var O=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 $s(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$s=function(t){return typeof t}:$s=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$s(r)}var Ry=10,g1=2;function $y(r){return yc(r,[])}function yc(r,e){switch($s(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Py(r,e);default:return String(r)}}function Py(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=My(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:yc(n,t)}else if(Array.isArray(r))return Fy(r,t);return Ly(r,t)}function Ly(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>g1)return"["+Uy(r)+"]";var i=t.map(function(n){var a=yc(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Fy(r,e){if(r.length===0)return"[]";if(e.length>g1)return"[Array]";for(var t=Math.min(Ry,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(yc(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function My(r){var e=r[String(Eu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Uy(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ru(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var jy=function(e,t){return e instanceof t};function Zd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function qy(r,e,t){return e&&Zd(r.prototype,e),t&&Zd(r,t),r}var y1=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ru(0,"Body must be a string. Received: ".concat($y(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||ru(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ru(0,"column in locationOffset is 1-indexed and must be positive.")}return qy(r,[{key:u1,get:function(){return"Source"}}]),r}();function By(r){return jy(r,y1)}var Vy=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 Qy(r){var e=r.split(/\r\n|[\n\r]/g),t=zy(r);if(t!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(t);for(var n=0;n<e.length&&Jd(e[n]);)++n;for(var a=e.length;a>n&&Jd(e[a-1]);)--a;return e.slice(n,a).join(`
|
|
60
|
+
`)}function Jd(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function zy(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Wy=function(){function r(t){var i=new Fe(O.SOF,0,0,0,0,null);this.source=t,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var i=this.token=this.lookahead();return i},e.lookahead=function(){var i=this.token;if(i.kind!==O.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Gy(this,i)}while(i.kind===O.COMMENT);return i},r}();function Hy(r){return r===O.BANG||r===O.DOLLAR||r===O.AMP||r===O.PAREN_L||r===O.PAREN_R||r===O.SPREAD||r===O.COLON||r===O.EQUALS||r===O.AT||r===O.BRACKET_L||r===O.BRACKET_R||r===O.BRACE_L||r===O.PIPE||r===O.BRACE_R}function Qi(r){return isNaN(r)?O.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Gy(r,e){for(var t=r.source,i=t.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Fe(O.BANG,a,a+1,s,c,e);case 35:return Zy(t,a,s,c,e);case 36:return new Fe(O.DOLLAR,a,a+1,s,c,e);case 38:return new Fe(O.AMP,a,a+1,s,c,e);case 40:return new Fe(O.PAREN_L,a,a+1,s,c,e);case 41:return new Fe(O.PAREN_R,a,a+1,s,c,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Fe(O.SPREAD,a,a+3,s,c,e);break;case 58:return new Fe(O.COLON,a,a+1,s,c,e);case 61:return new Fe(O.EQUALS,a,a+1,s,c,e);case 64:return new Fe(O.AT,a,a+1,s,c,e);case 91:return new Fe(O.BRACKET_L,a,a+1,s,c,e);case 93:return new Fe(O.BRACKET_R,a,a+1,s,c,e);case 123:return new Fe(O.BRACE_L,a,a+1,s,c,e);case 124:return new Fe(O.PIPE,a,a+1,s,c,e);case 125:return new Fe(O.BRACE_R,a,a+1,s,c,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?Xy(t,a,s,c,e,r):Yy(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Jy(t,a,o,s,c,e);case 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 t0(t,a,s,c,e)}throw kt(t,a,Ky(o))}var l=r.line,u=1+a-r.lineStart;return new Fe(O.EOF,n,n,l,u,e)}function Ky(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Qi(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Qi(r),".")}function Zy(r,e,t,i,n){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Fe(O.COMMENT,e,s,t,i,n,a.slice(e+1,s))}function Jy(r,e,t,i,n,a){var o=r.body,s=t,c=e,l=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw kt(r,c,"Invalid number, unexpected digit after 0: ".concat(Qi(s),"."))}else c=iu(r,c,s),s=o.charCodeAt(c);if(s===46&&(l=!0,s=o.charCodeAt(++c),c=iu(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(l=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=iu(r,c,s),s=o.charCodeAt(c)),s===46||r0(s))throw kt(r,c,"Invalid number, expected digit but got: ".concat(Qi(s),"."));return new Fe(l?O.FLOAT:O.INT,e,c,i,n,a,o.slice(e,c))}function iu(r,e,t){var i=r.body,n=e,a=t;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw kt(r,n,"Invalid number, expected digit but got: ".concat(Qi(a),"."))}function Yy(r,e,t,i,n){for(var a=r.body,o=e+1,s=o,c=0,l="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return l+=a.slice(s,o),new Fe(O.STRING,e,o+1,t,i,n,l);if(c<32&&c!==9)throw kt(r,o,"Invalid character within String: ".concat(Qi(c),"."));if(++o,c===92){switch(l+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:l+='"';break;case 47:l+="/";break;case 92:l+="\\";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+=`
|
|
61
|
+
`;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=e0(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(u<0){var d=a.slice(o+1,o+5);throw kt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}l+=String.fromCharCode(u),o+=4;break}default:throw kt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw kt(r,o,"Unterminated string.")}function Xy(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,l=0,u="";s<o.length&&!isNaN(l=o.charCodeAt(s));){if(l===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return u+=o.slice(c,s),new Fe(O.BLOCK_STRING,e,s+3,t,i,n,Qy(u));if(l<32&&l!==9&&l!==10&&l!==13)throw kt(r,s,"Invalid character within String: ".concat(Qi(l),"."));l===10?(++s,++a.line,a.lineStart=s):l===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):l===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(u+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw kt(r,s,"Unterminated string.")}function e0(r,e,t,i){return ys(r)<<12|ys(e)<<8|ys(t)<<4|ys(i)}function ys(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function t0(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Fe(O.NAME,e,s,t,i,n,a.slice(e,s))}function r0(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function i0(r,e){var t=new n0(r,e);return t.parseDocument()}var n0=function(){function r(t,i){var n=By(t)?t:new y1(t);this._lexer=new Wy(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(O.NAME);return{kind:H.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:H.DOCUMENT,definitions:this.many(O.SOF,this.parseDefinition,O.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(O.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(O.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(O.BRACE_L))return{kind:H.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(O.NAME)&&(a=this.parseName()),{kind:H.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(O.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(O.PAREN_L,this.parseVariableDefinition,O.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:H.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(O.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(O.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(O.DOLLAR),{kind:H.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:H.SELECTION_SET,selections:this.many(O.BRACE_L,this.parseSelection,O.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(O.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(O.COLON)?(a=n,o=this.parseName()):o=n,{kind:H.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(O.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(O.PAREN_L,n,O.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(O.COLON),{kind:H.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:H.ARGUMENT,name:this.parseName(),value:(this.expectToken(O.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(O.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(O.NAME)?{kind:H.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:H.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:H.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:H.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case O.BRACKET_L:return this.parseList(i);case O.BRACE_L:return this.parseObject(i);case O.INT:return this._lexer.advance(),{kind:H.INT,value:n.value,loc:this.loc(n)};case O.FLOAT:return this._lexer.advance(),{kind:H.FLOAT,value:n.value,loc:this.loc(n)};case O.STRING:case O.BLOCK_STRING:return this.parseStringLiteral();case O.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:H.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:H.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:H.NULL,loc:this.loc(n)};default:return{kind:H.ENUM,value:n.value,loc:this.loc(n)}}case O.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:H.STRING,value:i.value,block:i.kind===O.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:H.LIST,values:this.any(O.BRACKET_L,o,O.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:H.OBJECT,fields:this.any(O.BRACE_L,o,O.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(O.COLON),{kind:H.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(O.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(O.AT),{kind:H.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(O.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(O.BRACKET_R),n={kind:H.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(O.BANG)?{kind:H.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:H.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===O.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(O.STRING)||this.peek(O.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);return{kind:H.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(O.COLON);var a=this.parseNamedType();return{kind:H.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(O.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(O.AMP)||this.peek(O.NAME));return n}return this.delimitedMany(O.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(O.BRACE_L)&&this._lexer.lookahead().kind===O.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(O.BRACE_L,this.parseFieldDefinition,O.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(O.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:H.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(O.PAREN_L,this.parseInputValueDef,O.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(O.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(O.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:H.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:H.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(O.EQUALS)?this.delimitedMany(O.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:H.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseEnumValueDefinition,O.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:H.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseInputValueDef,O.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===O.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:H.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:H.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(O.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:H.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(O.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Vy[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new m1(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw kt(this._lexer.source,n.start,"Expected ".concat(v1(i),", found ").concat(nu(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===O.NAME&&n.value===i)this._lexer.advance();else throw kt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(nu(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===O.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return kt(this._lexer.source,n.start,"Unexpected ".concat(nu(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function nu(r){var e=r.value;return v1(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function v1(r){return Hy(r)?'"'.concat(r,'"'):r}var Ps=new Map,xu=new Map,b1=!0,Ks=!1;function _1(r){return r.replace(/[\s,]+/g," ").trim()}function a0(r){return _1(r.source.body.substring(r.start,r.end))}function o0(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=a0(i.loc),o=xu.get(n);o&&!o.has(a)?b1&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
62
62
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
63
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||El.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(i))}else r.push(i)}),Ws(Ws({},t),{definitions:r})}function o0(t){var e=new Set(t.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function s0(t){var e=b1(t);if(!Rs.has(e)){var r=r0(t,{experimentalFragmentVariables:Hs,allowLegacyFragmentVariables:Hs});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Rs.set(e,o0(a0(r)))}return Rs.get(e)}function E(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var i=t[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=t[a+1]}),s0(i)}function c0(){Rs.clear(),El.clear()}function u0(){v1=!1}function l0(){Hs=!0}function p0(){Hs=!1}var Ia={gql:E,resetCaches:c0,disableFragmentWarnings:u0,enableExperimentalFragmentVariables:l0,disableExperimentalFragmentVariables:p0};(function(t){t.gql=Ia.gql,t.resetCaches=Ia.resetCaches,t.disableFragmentWarnings=Ia.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Ia.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Ia.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function f0(){}function li(){return f0}var Y=li,g=li,Ze=li,_e=li,G=li,Dt=li,d0=li,Gl=li,_1=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},S1=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Wi=class{constructor(e){this.code=e}};_1([g(),S1("design:type",String)],Wi.prototype,"code",void 0);Wi=_1([G(),S1("design:paramtypes",[String])],Wi);var Kl=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Zl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ur=class{constructor(e,r){this.address=e,this.name=r}};Kl([g(),Zl("design:type",String)],ur.prototype,"address",void 0);Kl([g(),Zl("design:type",String)],ur.prototype,"name",void 0);ur=Kl([G(),Zl("design:paramtypes",[String,String])],ur);var Ie=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Qe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Tr=class{constructor(e,r){this.key=r,this.signature=e}};Ie([g(),Qe("design:type",String)],Tr.prototype,"signature",void 0);Ie([g(),Qe("design:type",String)],Tr.prototype,"key",void 0);Ie([g(),Qe("design:type",Boolean)],Tr.prototype,"valid",void 0);Ie([g(),Qe("design:type",Boolean)],Tr.prototype,"invalid",void 0);Tr=Ie([G(),Ze(),Qe("design:paramtypes",[String,String])],Tr);var Hi=class{};Ie([g(),Qe("design:type",String)],Hi.prototype,"signature",void 0);Ie([g(),Qe("design:type",String)],Hi.prototype,"key",void 0);Ie([g(),Qe("design:type",Boolean)],Hi.prototype,"valid",void 0);Ie([g(),Qe("design:type",Boolean)],Hi.prototype,"invalid",void 0);Hi=Ie([Ze()],Hi);function pi(t){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Ie([g(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([g(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([g(),Qe("design:type",Tr)],e.prototype,"proof",void 0),e=Ie([G(),Qe("design:paramtypes",[String,String,Object,Tr])],e),e}function h0(t){let e=class{};return Ie([g(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([g(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([g(),Qe("design:type",Hi)],e.prototype,"proof",void 0),e=Ie([Ze()],e),e}var Jd=class extends pi(){};Jd=Ie([G()],Jd);var Gs=class extends pi(){};Ie([g(),Qe("design:type",ur)],Gs.prototype,"language",void 0);Ie([g(),Qe("design:type",Wi)],Gs.prototype,"icon",void 0);Gs=Ie([G()],Gs);function v8(t){return t&&t.author&&t.timestamp&&t.data}var Ue=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},it=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([g(),it("design:type",String)],Gi.prototype,"source",void 0);Ue([g(),it("design:type",String)],Gi.prototype,"target",void 0);Ue([g(),it("design:type",String)],Gi.prototype,"predicate",void 0);Gi=Ue([G(),it("design:paramtypes",[Object])],Gi);var Ks=class{};Ue([g(),it("design:type",Array)],Ks.prototype,"additions",void 0);Ue([g(),it("design:type",Array)],Ks.prototype,"removals",void 0);Ks=Ue([Ze()],Ks);var Zs=class{constructor(e,r){this.additions=e,this.removals=r}};Ue([g(),it("design:type",Array)],Zs.prototype,"additions",void 0);Ue([g(),it("design:type",Array)],Zs.prototype,"removals",void 0);Zs=Ue([G(),it("design:paramtypes",[Array,Array])],Zs);var io=class{};Ue([g(),it("design:type",String)],io.prototype,"source",void 0);Ue([g(),it("design:type",String)],io.prototype,"target",void 0);Ue([g(),it("design:type",String)],io.prototype,"predicate",void 0);io=Ue([Ze()],io);var ni=class extends pi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),r=(r<<5)-r+n,r|=0;return r}};Ue([g(),it("design:type",String)],ni.prototype,"status",void 0);ni=Ue([G()],ni);var xl=class extends h0(){};Ue([g(),it("design:type",String)],xl.prototype,"status",void 0);xl=Ue([Ze()],xl);function x8(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function A8(t){return t&&t.source&&t.target}var Js=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Ue([g(),it("design:type",ni)],Js.prototype,"oldLink",void 0);Ue([g(),it("design:type",ni)],Js.prototype,"newLink",void 0);Js=Ue([G(),it("design:paramtypes",[ni,ni])],Js);var nn=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},yo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Al,fr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(i=>i.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};nn([g(),yo("design:type",Array)],fr.prototype,"links",void 0);fr=nn([G(),yo("design:paramtypes",[Array])],fr);var Ys=class{};nn([g(),yo("design:type",Array)],Ys.prototype,"links",void 0);Ys=nn([Ze()],Ys);var kl=Al=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new Al;return r.links.push(e),r}};nn([g(),yo("design:type",Array)],kl.prototype,"links",void 0);kl=Al=nn([Ze(),yo("design:paramtypes",[Array])],kl);var Ki=class extends pi(){};Ki=nn([G()],Ki);var q=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},B=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Xr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new fr}};q([g(),B("design:type",String)],Xr.prototype,"did",void 0);q([g(),B("design:type",fr)],Xr.prototype,"perspective",void 0);q([g(),B("design:type",String)],Xr.prototype,"directMessageLanguage",void 0);Xr=q([G(),B("design:paramtypes",[String,fr])],Xr);var Yd=class extends pi(){};Yd=q([G()],Yd);var ai=class{constructor(e,r,i,n,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ai.prototype,"did",void 0);q([g(),B("design:type",String)],ai.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ai.prototype,"didSignedByDeviceKey",void 0);ai=q([G(),B("design:paramtypes",[String,String,String,String,String,String])],ai);var oi=class{constructor(e,r,i,n,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],oi.prototype,"did",void 0);q([g(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=q([Ze(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var Xs=class{constructor(e,r){this.signature=e,this.publicKey=r}};q([g(),B("design:type",String)],Xs.prototype,"signature",void 0);q([g(),B("design:type",String)],Xs.prototype,"publicKey",void 0);Xs=q([G(),B("design:paramtypes",[String,String])],Xs);var Bn=class{constructor(e,r){this.domain=e,this.pointers=r}};q([g(),B("design:type",String)],Bn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Bn.prototype,"pointers",void 0);Bn=q([G(),B("design:paramtypes",[String,Array])],Bn);var ec=class{constructor(e,r){this.with=e,this.can=r}};q([g(),B("design:type",Bn)],ec.prototype,"with",void 0);q([g(),B("design:type",Array)],ec.prototype,"can",void 0);ec=q([G(),B("design:paramtypes",[Bn,Array])],ec);var Ir=class{constructor(e,r,i,n,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],Ir.prototype,"appName",void 0);q([g(),B("design:type",String)],Ir.prototype,"appDesc",void 0);q([g(),B("design:type",String)],Ir.prototype,"appUrl",void 0);q([g(),B("design:type",String)],Ir.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=q([G(),B("design:paramtypes",[String,String,String,Array,String])],Ir);var Vn=class{constructor(e,r,i,n){this.requestId=e,this.auth=r,this.token=i,this.revoked=n}};q([g(),B("design:type",String)],Vn.prototype,"requestId",void 0);q([g(),B("design:type",String)],Vn.prototype,"token",void 0);q([g(),B("design:type",Boolean)],Vn.prototype,"revoked",void 0);q([g(),B("design:type",Ir)],Vn.prototype,"auth",void 0);Vn=q([G(),B("design:paramtypes",[String,Ir,String,Boolean])],Vn);var Qn=class{constructor(e,r){this.domain=e,this.pointers=r}};q([g(),B("design:type",String)],Qn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Qn.prototype,"pointers",void 0);Qn=q([Ze(),B("design:paramtypes",[String,Array])],Qn);var tc=class{constructor(e,r){this.with=e,this.can=r}};q([g(),B("design:type",Qn)],tc.prototype,"with",void 0);q([g(),B("design:type",Array)],tc.prototype,"can",void 0);tc=q([Ze(),B("design:paramtypes",[Qn,Array])],tc);var dr=class{constructor(e,r,i,n,a,o){this.appName=e,this.appDesc=r,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([g(),B("design:type",String)],dr.prototype,"appName",void 0);q([g(),B("design:type",String)],dr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],dr.prototype,"appDomain",void 0);q([g(),B("design:type",String)],dr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],dr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],dr.prototype,"capabilities",void 0);dr=q([Ze(),B("design:paramtypes",[String,String,String,String,String,Array])],dr);var Zi=class{constructor(e,r,i){this.did=e,this.success=r,this.error=i}};q([g(),B("design:type",String)],Zi.prototype,"did",void 0);q([g(),B("design:type",Boolean)],Zi.prototype,"success",void 0);q([g(),B("design:type",String)],Zi.prototype,"error",void 0);Zi=q([G(),B("design:paramtypes",[String,Boolean,String])],Zi);var Jn=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Yn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isInitialized",void 0);Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isUnlocked",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"did",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"didDocument",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"error",void 0);Mt=Jn([G(),Yn("design:paramtypes",[Object])],Mt);var Xd=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Le=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},yt,vt,Tl=class{constructor(e,r){yt.set(this,void 0),vt.set(this,void 0),Xd(this,yt,e,"f"),Xd(this,vt,r,"f")}async otherAgents(){return await Le(this,yt,"f").otherAgents(Le(this,vt,"f"))}async hasTelepresenceAdapter(){return await Le(this,yt,"f").hasTelepresenceAdapter(Le(this,vt,"f"))}async onlineAgents(){return await Le(this,yt,"f").onlineAgents(Le(this,vt,"f"))}async setOnlineStatus(e){return await Le(this,yt,"f").setOnlineStatus(Le(this,vt,"f"),e)}async setOnlineStatusU(e){return await Le(this,yt,"f").setOnlineStatusU(Le(this,vt,"f"),e)}async sendSignal(e,r){return await Le(this,yt,"f").sendSignal(Le(this,vt,"f"),e,r)}async sendSignalU(e,r){return await Le(this,yt,"f").sendSignalU(Le(this,vt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Le(this,yt,"f").sendBroadcast(Le(this,vt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Le(this,yt,"f").sendBroadcastU(Le(this,vt,"f"),e,r)}async addSignalHandler(e){await Le(this,yt,"f").addSignalHandler(Le(this,vt,"f"),e)}removeSignalHandler(e){Le(this,yt,"f").removeSignalHandler(Le(this,vt,"f"),e)}};yt=new WeakMap,vt=new WeakMap;var an=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},on=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ot=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};an([g(),on("design:type",String)],ot.prototype,"source",void 0);an([g(),on("design:type",String)],ot.prototype,"target",void 0);an([g(),on("design:type",String)],ot.prototype,"predicate",void 0);an([g(),on("design:type",Date)],ot.prototype,"fromDate",void 0);an([g(),on("design:type",Date)],ot.prototype,"untilDate",void 0);an([g(),on("design:type",Number)],ot.prototype,"limit",void 0);ot=an([G(),Ze(),on("design:paramtypes",[Object])],ot);var eh=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},tt=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},bt,wr;function gs(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var wt=class{constructor(){bt.set(this,void 0),wr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new wt;return eh(r,wr,e,"f"),r}static from(e){let r=new wt;return eh(r,bt,e,"f"),r}toUrl(){if(tt(this,wr,"f")&&!tt(this,bt,"f"))return tt(this,wr,"f");if(!tt(this,wr,"f")&&(tt(this,bt,"f")===void 0||tt(this,bt,"f")===""||tt(this,bt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof tt(this,bt,"f")){case"string":e=`string:${gs(tt(this,bt,"f"))}`;break;case"number":e=`number:${gs(tt(this,bt,"f"))}`;break;case"boolean":e=`boolean:${gs(tt(this,bt,"f"))}`;break;case"object":e=`json:${gs(JSON.stringify(tt(this,bt,"f")))}`;break}return`literal://${e}`}get(){if(tt(this,bt,"f"))return tt(this,bt,"f");if(!tt(this,wr,"f"))throw new Error("Can't render empty Literal");if(!tt(this,wr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=tt(this,wr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};bt=new WeakMap,wr=new WeakMap;function ei(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jl(t){return`set${ei(t)}`}function kr(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Yl(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function m0(t){return`add${ei(Yl(t))}`}function g0(t){let e=t.substring(3),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function y0(t){return`remove${ei(Yl(t))}`}function v0(t){let e=t.substring(6),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function b0(t){let e=t.substring(13),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function _0(t){return`setCollection${ei(Yl(t))}`}function Di(t){if(Array.isArray(t))return`[${t.map(Di).join(", ")}]`;let e=Object.keys(t),r=[];for(let i of e){let n=JSON.stringify(t[i]),a=`${i}: ${n}`;r.push(a)}return`{${r.join(", ")}}`}var nl=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},J=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},lt,pt,De,rc=class{constructor(t,e,r){lt.set(this,void 0),pt.set(this,void 0),De.set(this,void 0),nl(this,lt,e,"f"),nl(this,pt,r,"f"),nl(this,De,t,"f")}get baseExpression(){return J(this,lt,"f")}async init(){let isInstance=await J(this,De,"f").isSubjectInstance(J(this,lt,"f"),J(this,pt,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,pt,"f")} for ${J(this,lt,"f")}`;let results=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_getter(C, "${J(this,lt,"f")}", "${t}", Value)`);if(r&&r.length>0){let i=r[0].Value;if(e)try{if(i){let n=await J(this,De,"f").getExpression(i);try{return JSON.parse(n.data)}catch{return n.data}}else return i}catch{return i}else return i}else return r||void 0}})}let setters=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Jl(property)]=async t=>{resolveLanguage&&(t=await J(this,De,"f").createExpression(t,resolveLanguage)),await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let results2=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{let e=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection_getter(C, "${J(this,lt,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(i=>i!==""&&i!==""):[]}});let adders=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[m0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let removers=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[y0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let collectionSetters=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[_0(collection)]=async t=>{Array.isArray(t)?await J(this,De,"f").executeAction(actions,J(this,lt,"f"),t.map(e=>({name:"value",value:e}))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}}};lt=new WeakMap,pt=new WeakMap,De=new WeakMap;var be=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},T=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ps,Cr,ir,nr,ji,Gr,Kr,Ni,Pa,$s,Ri,Pi,Lt,Mn,Il,de,ge,$i,Li,Fi,$a,ic=class{constructor(e,r,i){Ps.add(this),Cr.set(this,void 0),ir.set(this,void 0),nr.set(this,void 0),ji.set(this,void 0),Gr.set(this,void 0),Kr.set(this,void 0),Ni.set(this,void 0),Pa.set(this,!1),$s.set(this,void 0),Ri.set(this,void 0),Pi.set(this,void 0),Lt.set(this,void 0),Mn.set(this,void 0),this.isSurrealDB=!1,be(this,Cr,e,"f"),be(this,Mn,r,"f"),be(this,nr,i,"f"),be(this,ji,new Set,"f"),be(this,Ni,null,"f"),be(this,$s,new Promise((n,a)=>{be(this,Ri,n,"f"),be(this,Pi,a,"f")}),"f")}async subscribe(){T(this,Kr,"f")&&(T(this,Kr,"f").call(this),be(this,Kr,void 0,"f")),T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,Gr,"f")&&(clearTimeout(T(this,Gr,"f")),be(this,Gr,void 0,"f"));try{let r;this.isSurrealDB?r=await T(this,nr,"f").perspectiveSubscribeSurrealQuery(T(this,Cr,"f"),T(this,Mn,"f")):r=await T(this,nr,"f").subscribeQuery(T(this,Cr,"f"),T(this,Mn,"f")),be(this,ir,r.subscriptionId,"f"),r.result?(be(this,Ni,r.result,"f"),T(this,Ps,"m",Il).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),be(this,Lt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),be(this,Kr,T(this,nr,"f").subscribeToQueryUpdates(T(this,ir,"f"),i=>{T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,Ri,"f")&&(T(this,Ri,"f").call(this,!0),be(this,Ri,void 0,"f"),be(this,Pi,void 0,"f")),!(i.isInit&&T(this,Ni,"f"))&&(be(this,Ni,i,"f"),T(this,Ps,"m",Il).call(this,i))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),T(this,Pi,"f")&&(T(this,Pi,"f").call(this,r),be(this,Ri,void 0,"f"),be(this,Pi,void 0,"f")),r}let e=async()=>{if(!T(this,Pa,"f")){try{this.isSurrealDB?await T(this,nr,"f").perspectiveKeepAliveSurrealQuery(T(this,Cr,"f"),T(this,ir,"f")):await T(this,nr,"f").keepAliveQuery(T(this,Cr,"f"),T(this,ir,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",T(this,Mn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}T(this,Pa,"f")||be(this,Gr,setTimeout(e,3e4),"f")}};be(this,Gr,setTimeout(e,3e4),"f")}get id(){return T(this,ir,"f")}get initialized(){return T(this,$s,"f")}get result(){return T(this,Ni,"f")}onResult(e){return T(this,ji,"f").add(e),()=>T(this,ji,"f").delete(e)}dispose(){be(this,Pa,!0,"f"),clearTimeout(T(this,Gr,"f")),T(this,Kr,"f")&&T(this,Kr,"f").call(this),T(this,ji,"f").clear(),T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,ir,"f")&&(this.isSurrealDB?T(this,nr,"f").perspectiveDisposeSurrealQuerySubscription(T(this,Cr,"f"),T(this,ir,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):T(this,nr,"f").disposeQuerySubscription(T(this,Cr,"f"),T(this,ir,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Cr=new WeakMap,ir=new WeakMap,nr=new WeakMap,ji=new WeakMap,Gr=new WeakMap,Kr=new WeakMap,Ni=new WeakMap,Pa=new WeakMap,$s=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Lt=new WeakMap,Mn=new WeakMap,Ps=new WeakSet,Il=function t(e){for(let r of T(this,ji,"f"))try{r(e)}catch(i){console.error("Error in query subscription callback:",i)}};var jn=class{constructor(t,e){de.set(this,void 0),ge.set(this,void 0),$i.set(this,void 0),Li.set(this,void 0),Fi.set(this,void 0),$a.set(this,void 0),be(this,$i,[],"f"),be(this,Li,[],"f"),be(this,Fi,[],"f"),be(this,$a,[],"f"),be(this,de,t,"f"),be(this,ge,e,"f"),this.uuid=T(this,de,"f").uuid,this.name=T(this,de,"f").name,this.owners=T(this,de,"f").owners,this.sharedUrl=T(this,de,"f").sharedUrl,this.neighbourhood=T(this,de,"f").neighbourhood,this.state=T(this,de,"f").state,T(this,ge,"f").addPerspectiveLinkAddedListener(T(this,de,"f").uuid,T(this,$i,"f")),T(this,ge,"f").addPerspectiveLinkRemovedListener(T(this,de,"f").uuid,T(this,Li,"f")),T(this,ge,"f").addPerspectiveLinkUpdatedListener(T(this,de,"f").uuid,T(this,Fi,"f")),T(this,ge,"f").addPerspectiveSyncStateChangeListener(T(this,de,"f").uuid,T(this,$a,"f"))}async executeAction(t,e,r,i){return await T(this,ge,"f").executeCommands(T(this,de,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),i)}async get(t){return await T(this,ge,"f").queryLinks(T(this,de,"f").uuid,t)}async infer(t){return await T(this,ge,"f").queryProlog(T(this,de,"f").uuid,t)}async querySurrealDB(t){return await T(this,ge,"f").querySurrealDB(T(this,de,"f").uuid,t)}async add(t,e="shared",r){return await T(this,ge,"f").addLink(T(this,de,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await T(this,ge,"f").addLinks(T(this,de,"f").uuid,t,e,r)}async removeLinks(t,e){return await T(this,ge,"f").removeLinks(T(this,de,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await T(this,ge,"f").linkMutations(T(this,de,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await T(this,ge,"f").addLinkExpression(T(this,de,"f").uuid,t,e,r)}async update(t,e,r){return await T(this,ge,"f").updateLink(T(this,de,"f").uuid,t,e,r)}async remove(t,e){return await T(this,ge,"f").removeLink(T(this,de,"f").uuid,t,e)}async createBatch(){return await T(this,ge,"f").createBatch(T(this,de,"f").uuid)}async commitBatch(t){return await T(this,ge,"f").commitBatch(T(this,de,"f").uuid,t)}async getExpression(t){return await T(this,ge,"f").getExpression(t)}async createExpression(t,e){return await T(this,ge,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?T(this,$i,"f").push(e):t==="link-removed"?T(this,Li,"f").push(e):t==="link-updated"&&T(this,Fi,"f").push(e)}async addSyncStateChangeListener(t){T(this,$a,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=T(this,$i,"f").indexOf(e);T(this,$i,"f").splice(r,1)}else if(t==="link-removed"){let r=T(this,Li,"f").indexOf(e);T(this,Li,"f").splice(r,1)}else if(t==="link-updated"){let r=T(this,Fi,"f").indexOf(e);T(this,Fi,"f").splice(r,1)}}async snapshot(){return T(this,ge,"f").snapshotByUUID(T(this,de,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new ot({source:t.source,predicate:t.predicate}),i=await this.get(r),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[t];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let t=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let r of t){let i=await this.get(new ot({source:"ad4m://self",predicate:r}));for(let n of i){let a=n.data.target,o=await this.get(new ot({source:a,predicate:"ad4m://sdna"}));for(let s of o){let u=wt.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=wt.from(t);if((await this.get(new ot({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new ot({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=wt.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(t,e,r){return T(this,ge,"f").addSdna(T(this,de,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e,r,i){let n;if(typeof t=="string")n=t,await T(this,ge,"f").createSubject(T(this,de,"f").uuid,JSON.stringify({className:n,initialValues:r}),e,r?JSON.stringify(r):void 0,i);else{let a=this.buildQueryFromTemplate(t);await T(this,ge,"f").createSubject(T(this,de,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,i)}return i?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await T(this,ge,"f").getSubjectData(T(this,de,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await T(this,ge,"f").getSubjectData(T(this,de,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClassName(e),i=!1,n=5,a=0;for(;a<n&&!i;)i=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return i}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(e),i=new rc(this,t,r);return await i.init(),i}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let i of e){let n=await this.infer(`subject_class("${i}", C), instance(C, X)`),a=await Promise.all(n.map(async o=>await this.getSubjectProxy(o.X,i)));r=r.concat(a)}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let i of e)r=await this.infer(`subject_class("${i}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let i=[],n=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>i.push(l)):i.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{n.includes(l)||n.push(l)}):n.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of i)c+=`, property(C, "${l}")`;for(let l of n)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${g0(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${v0(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${b0(l)}", _)`;c+=".",e=c}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(i=>i.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:i}=t.generateSDNA();await this.addSdna(r,i,"subject_class")}getNeighbourhoodProxy(){return T(this,ge,"f").getNeighbourhoodProxy(T(this,de,"f").uuid)}get ai(){return T(this,ge,"f").aiClient}async subscribeInfer(t){let e=new ic(this.uuid,t,T(this,ge,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new ic(this.uuid,t,T(this,ge,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};de=new WeakMap,ge=new WeakMap,$i=new WeakMap,Li=new WeakMap,Fi=new WeakMap,$a=new WeakMap;var zr=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Q=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},ie,La,Fa,Ma,Ls,Ua,Fs,Ms,ut=`
|
|
63
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||xu.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),Gs(Gs({},r),{definitions:t})}function s0(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function c0(r){var e=_1(r);if(!Ps.has(e)){var t=i0(r,{experimentalFragmentVariables:Ks,allowLegacyFragmentVariables:Ks});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Ps.set(e,s0(o0(t)))}return Ps.get(e)}function E(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),c0(i)}function l0(){Ps.clear(),xu.clear()}function u0(){b1=!1}function p0(){Ks=!0}function f0(){Ks=!1}var Ia={gql:E,resetCaches:l0,disableFragmentWarnings:u0,enableExperimentalFragmentVariables:p0,disableExperimentalFragmentVariables:f0};(function(r){r.gql=Ia.gql,r.resetCaches=Ia.resetCaches,r.disableFragmentWarnings=Ia.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Ia.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Ia.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function d0(){}function li(){return d0}var Y=li,g=li,Je=li,Se=li,K=li,Dt=li,h0=li,Ku=li,S1=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},w1=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},zi=class{constructor(e){this.code=e}};S1([g(),w1("design:type",String)],zi.prototype,"code",void 0);zi=S1([K(),w1("design:paramtypes",[String])],zi);var Zu=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ju=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},cr=class{constructor(e,t){this.address=e,this.name=t}};Zu([g(),Ju("design:type",String)],cr.prototype,"address",void 0);Zu([g(),Ju("design:type",String)],cr.prototype,"name",void 0);cr=Zu([K(),Ju("design:paramtypes",[String,String])],cr);var De=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ar=class{constructor(e,t){this.key=t,this.signature=e}};De([g(),ze("design:type",String)],Ar.prototype,"signature",void 0);De([g(),ze("design:type",String)],Ar.prototype,"key",void 0);De([g(),ze("design:type",Boolean)],Ar.prototype,"valid",void 0);De([g(),ze("design:type",Boolean)],Ar.prototype,"invalid",void 0);Ar=De([K(),Je(),ze("design:paramtypes",[String,String])],Ar);var Wi=class{};De([g(),ze("design:type",String)],Wi.prototype,"signature",void 0);De([g(),ze("design:type",String)],Wi.prototype,"key",void 0);De([g(),ze("design:type",Boolean)],Wi.prototype,"valid",void 0);De([g(),ze("design:type",Boolean)],Wi.prototype,"invalid",void 0);Wi=De([Je()],Wi);function ui(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return De([g(),ze("design:type",String)],e.prototype,"author",void 0),De([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),De([g(),ze("design:type",Object)],e.prototype,"data",void 0),De([g(),ze("design:type",Ar)],e.prototype,"proof",void 0),e=De([K(),ze("design:paramtypes",[String,String,Object,Ar])],e),e}function m0(r){let e=class{};return De([g(),ze("design:type",String)],e.prototype,"author",void 0),De([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),De([g(),ze("design:type",Object)],e.prototype,"data",void 0),De([g(),ze("design:type",Wi)],e.prototype,"proof",void 0),e=De([Je()],e),e}var Yd=class extends ui(){};Yd=De([K()],Yd);var Zs=class extends ui(){};De([g(),ze("design:type",cr)],Zs.prototype,"language",void 0);De([g(),ze("design:type",zi)],Zs.prototype,"icon",void 0);Zs=De([K()],Zs);function b8(r){return r&&r.author&&r.timestamp&&r.data}var Ue=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},st=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([g(),st("design:type",String)],Hi.prototype,"source",void 0);Ue([g(),st("design:type",String)],Hi.prototype,"target",void 0);Ue([g(),st("design:type",String)],Hi.prototype,"predicate",void 0);Hi=Ue([K(),st("design:paramtypes",[Object])],Hi);var Js=class{};Ue([g(),st("design:type",Array)],Js.prototype,"additions",void 0);Ue([g(),st("design:type",Array)],Js.prototype,"removals",void 0);Js=Ue([Je()],Js);var Ys=class{constructor(e,t){this.additions=e,this.removals=t}};Ue([g(),st("design:type",Array)],Ys.prototype,"additions",void 0);Ue([g(),st("design:type",Array)],Ys.prototype,"removals",void 0);Ys=Ue([K(),st("design:paramtypes",[Array,Array])],Ys);var no=class{};Ue([g(),st("design:type",String)],no.prototype,"source",void 0);Ue([g(),st("design:type",String)],no.prototype,"target",void 0);Ue([g(),st("design:type",String)],no.prototype,"predicate",void 0);no=Ue([Je()],no);var ii=class extends ui(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Ue([g(),st("design:type",String)],ii.prototype,"status",void 0);ii=Ue([K()],ii);var Au=class extends m0(){};Ue([g(),st("design:type",String)],Au.prototype,"status",void 0);Au=Ue([Je()],Au);function A8(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function k8(r){return r&&r.source&&r.target}var Xs=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Ue([g(),st("design:type",ii)],Xs.prototype,"oldLink",void 0);Ue([g(),st("design:type",ii)],Xs.prototype,"newLink",void 0);Xs=Ue([K(),st("design:paramtypes",[ii,ii])],Xs);var rn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ku,pr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};rn([g(),bo("design:type",Array)],pr.prototype,"links",void 0);pr=rn([K(),bo("design:paramtypes",[Array])],pr);var ec=class{};rn([g(),bo("design:type",Array)],ec.prototype,"links",void 0);ec=rn([Je()],ec);var Tu=ku=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new ku;return t.links.push(e),t}};rn([g(),bo("design:type",Array)],Tu.prototype,"links",void 0);Tu=ku=rn([Je(),bo("design:paramtypes",[Array])],Tu);var Gi=class extends ui(){};Gi=rn([K()],Gi);var q=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},B=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Yr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new pr}};q([g(),B("design:type",String)],Yr.prototype,"did",void 0);q([g(),B("design:type",pr)],Yr.prototype,"perspective",void 0);q([g(),B("design:type",String)],Yr.prototype,"directMessageLanguage",void 0);Yr=q([K(),B("design:paramtypes",[String,pr])],Yr);var Xd=class extends ui(){};Xd=q([K()],Xd);var ni=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ni.prototype,"did",void 0);q([g(),B("design:type",String)],ni.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ni.prototype,"didSignedByDeviceKey",void 0);ni=q([K(),B("design:paramtypes",[String,String,String,String,String,String])],ni);var ai=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ai.prototype,"did",void 0);q([g(),B("design:type",String)],ai.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ai.prototype,"didSignedByDeviceKey",void 0);ai=q([Je(),B("design:paramtypes",[String,String,String,String,String,String])],ai);var tc=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([g(),B("design:type",String)],tc.prototype,"signature",void 0);q([g(),B("design:type",String)],tc.prototype,"publicKey",void 0);tc=q([K(),B("design:paramtypes",[String,String])],tc);var Bn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Bn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Bn.prototype,"pointers",void 0);Bn=q([K(),B("design:paramtypes",[String,Array])],Bn);var rc=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Bn)],rc.prototype,"with",void 0);q([g(),B("design:type",Array)],rc.prototype,"can",void 0);rc=q([K(),B("design:paramtypes",[Bn,Array])],rc);var kr=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],kr.prototype,"appName",void 0);q([g(),B("design:type",String)],kr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],kr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],kr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],kr.prototype,"capabilities",void 0);kr=q([K(),B("design:paramtypes",[String,String,String,Array,String])],kr);var Vn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};q([g(),B("design:type",String)],Vn.prototype,"requestId",void 0);q([g(),B("design:type",String)],Vn.prototype,"token",void 0);q([g(),B("design:type",Boolean)],Vn.prototype,"revoked",void 0);q([g(),B("design:type",kr)],Vn.prototype,"auth",void 0);Vn=q([K(),B("design:paramtypes",[String,kr,String,Boolean])],Vn);var Qn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Qn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Qn.prototype,"pointers",void 0);Qn=q([Je(),B("design:paramtypes",[String,Array])],Qn);var ic=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Qn)],ic.prototype,"with",void 0);q([g(),B("design:type",Array)],ic.prototype,"can",void 0);ic=q([Je(),B("design:paramtypes",[Qn,Array])],ic);var fr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([g(),B("design:type",String)],fr.prototype,"appName",void 0);q([g(),B("design:type",String)],fr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],fr.prototype,"appDomain",void 0);q([g(),B("design:type",String)],fr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],fr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],fr.prototype,"capabilities",void 0);fr=q([Je(),B("design:paramtypes",[String,String,String,String,String,Array])],fr);var Ki=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};q([g(),B("design:type",String)],Ki.prototype,"did",void 0);q([g(),B("design:type",Boolean)],Ki.prototype,"success",void 0);q([g(),B("design:type",String)],Ki.prototype,"error",void 0);Ki=q([K(),B("design:paramtypes",[String,Boolean,String])],Ki);var Jn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Yn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Mt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isInitialized",void 0);Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isUnlocked",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"did",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"didDocument",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"error",void 0);Mt=Jn([K(),Yn("design:paramtypes",[Object])],Mt);var eh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Le=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},bt,_t,Iu=class{constructor(e,t){bt.set(this,void 0),_t.set(this,void 0),eh(this,bt,e,"f"),eh(this,_t,t,"f")}async otherAgents(){return await Le(this,bt,"f").otherAgents(Le(this,_t,"f"))}async hasTelepresenceAdapter(){return await Le(this,bt,"f").hasTelepresenceAdapter(Le(this,_t,"f"))}async onlineAgents(){return await Le(this,bt,"f").onlineAgents(Le(this,_t,"f"))}async setOnlineStatus(e){return await Le(this,bt,"f").setOnlineStatus(Le(this,_t,"f"),e)}async setOnlineStatusU(e){return await Le(this,bt,"f").setOnlineStatusU(Le(this,_t,"f"),e)}async sendSignal(e,t){return await Le(this,bt,"f").sendSignal(Le(this,_t,"f"),e,t)}async sendSignalU(e,t){return await Le(this,bt,"f").sendSignalU(Le(this,_t,"f"),e,t)}async sendBroadcast(e,t=!1){return await Le(this,bt,"f").sendBroadcast(Le(this,_t,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Le(this,bt,"f").sendBroadcastU(Le(this,_t,"f"),e,t)}async addSignalHandler(e){await Le(this,bt,"f").addSignalHandler(Le(this,_t,"f"),e)}removeSignalHandler(e){Le(this,bt,"f").removeSignalHandler(Le(this,_t,"f"),e)}};bt=new WeakMap,_t=new WeakMap;var nn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},an=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ot=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};nn([g(),an("design:type",String)],ot.prototype,"source",void 0);nn([g(),an("design:type",String)],ot.prototype,"target",void 0);nn([g(),an("design:type",String)],ot.prototype,"predicate",void 0);nn([g(),an("design:type",Date)],ot.prototype,"fromDate",void 0);nn([g(),an("design:type",Date)],ot.prototype,"untilDate",void 0);nn([g(),an("design:type",Number)],ot.prototype,"limit",void 0);ot=nn([K(),Je(),an("design:paramtypes",[Object])],ot);var th=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},tt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},St,Sr;function vs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ut=class{constructor(){St.set(this,void 0),Sr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new ut;return th(t,Sr,e,"f"),t}static from(e){let t=new ut;return th(t,St,e,"f"),t}toUrl(){if(tt(this,Sr,"f")&&!tt(this,St,"f"))return tt(this,Sr,"f");if(!tt(this,Sr,"f")&&(tt(this,St,"f")===void 0||tt(this,St,"f")===""||tt(this,St,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof tt(this,St,"f")){case"string":e=`string:${vs(tt(this,St,"f"))}`;break;case"number":e=`number:${vs(tt(this,St,"f"))}`;break;case"boolean":e=`boolean:${vs(tt(this,St,"f"))}`;break;case"object":e=`json:${vs(JSON.stringify(tt(this,St,"f")))}`;break}return`literal://${e}`}get(){if(tt(this,St,"f"))return tt(this,St,"f");if(!tt(this,Sr,"f"))throw new Error("Can't render empty Literal");if(!tt(this,Sr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=tt(this,Sr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};St=new WeakMap,Sr=new WeakMap;function Xr(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Yu(r){return`set${Xr(r)}`}function jn(r){return r.endsWith("y")?r.slice(0,-1)+"ies":r+"s"}function Xu(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function g0(r){return`add${Xr(Xu(r))}`}function y0(r){let e=r.substring(3),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function v0(r){return`remove${Xr(Xu(r))}`}function b0(r){let e=r.substring(6),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function _0(r){let e=r.substring(13),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function S0(r){return`setCollection${Xr(Xu(r))}`}function Oi(r){if(Array.isArray(r))return`[${r.map(Oi).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var au=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},V=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},rt,it,Ie,ao=class{constructor(r,e,t){rt.set(this,void 0),it.set(this,void 0),Ie.set(this,void 0),au(this,rt,e,"f"),au(this,it,t,"f"),au(this,Ie,r,"f")}get baseExpression(){return V(this,rt,"f")}async init(){let isInstance=await V(this,Ie,"f").isSubjectInstance(V(this,rt,"f"),V(this,it,"f"));if(!isInstance)throw`Not a valid subject instance of ${V(this,it,"f")} for ${V(this,rt,"f")}`;let results=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties){let e=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_resolve(C, "${r}")`);Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let t=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_getter(C, "${V(this,rt,"f")}", "${r}", Value)`);if(t&&t.length>0&&t[0].Value!==void 0&&t[0].Value!==null&&t[0].Value!==""){let i=t[0].Value;if(e)try{if(i){let n=await V(this,Ie,"f").getExpression(i);try{return JSON.parse(n.data)}catch{return n.data}}else return i}catch{return i}else return i}}catch{}try{return await V(this,Ie,"f").getPropertyValueViaSurreal(V(this,rt,"f"),V(this,it,"f"),r)}catch(t){console.warn(`Failed to get property ${r} via SurrealDB:`,t);return}}})}let setters=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Yu(property)]=async r=>{resolveLanguage&&(r=await V(this,Ie,"f").createExpression(r,resolveLanguage)),await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let results2=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let e=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_getter(C, "${V(this,rt,"f")}", "${r}", Value)`);if(e&&e.length>0&&e[0].Value&&Array.isArray(e[0].Value)&&e[0].Value.length>0){let t=e[0].Value.filter(i=>i!==""&&i!=="");if(t.length>0)return t}}catch{}try{return await V(this,Ie,"f").getCollectionValuesViaSurreal(V(this,rt,"f"),V(this,it,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[g0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:e}]))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let removers=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[v0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:e}]))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let collectionSetters=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[S0(collection)]=async r=>{Array.isArray(r)?await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),r.map(e=>({name:"value",value:e}))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}}};rt=new WeakMap,it=new WeakMap,Ie=new WeakMap;var _e=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},I=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ls,wr,ir,nr,Ui,Wr,Hr,Di,$a,Fs,Ni,Ri,Lt,Fn,Ou,de,ge,$i,Pi,Li,Pa,nc=class{constructor(e,t,i){Ls.add(this),wr.set(this,void 0),ir.set(this,void 0),nr.set(this,void 0),Ui.set(this,void 0),Wr.set(this,void 0),Hr.set(this,void 0),Di.set(this,void 0),$a.set(this,!1),Fs.set(this,void 0),Ni.set(this,void 0),Ri.set(this,void 0),Lt.set(this,void 0),Fn.set(this,void 0),this.isSurrealDB=!1,_e(this,wr,e,"f"),_e(this,Fn,t,"f"),_e(this,nr,i,"f"),_e(this,Ui,new Set,"f"),_e(this,Di,null,"f"),_e(this,Fs,new Promise((n,a)=>{_e(this,Ni,n,"f"),_e(this,Ri,a,"f")}),"f")}async subscribe(){I(this,Hr,"f")&&(I(this,Hr,"f").call(this),_e(this,Hr,void 0,"f")),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,Wr,"f")&&(clearTimeout(I(this,Wr,"f")),_e(this,Wr,void 0,"f"));try{let t;this.isSurrealDB?t=await I(this,nr,"f").perspectiveSubscribeSurrealQuery(I(this,wr,"f"),I(this,Fn,"f")):t=await I(this,nr,"f").subscribeQuery(I(this,wr,"f"),I(this,Fn,"f")),_e(this,ir,t.subscriptionId,"f"),t.result?(_e(this,Di,t.result,"f"),I(this,Ls,"m",Ou).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),_e(this,Lt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),_e(this,Hr,I(this,nr,"f").subscribeToQueryUpdates(I(this,ir,"f"),i=>{I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,Ni,"f")&&(I(this,Ni,"f").call(this,!0),_e(this,Ni,void 0,"f"),_e(this,Ri,void 0,"f")),!(i.isInit&&I(this,Di,"f"))&&(_e(this,Di,i,"f"),I(this,Ls,"m",Ou).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),I(this,Ri,"f")&&(I(this,Ri,"f").call(this,t),_e(this,Ni,void 0,"f"),_e(this,Ri,void 0,"f")),t}let e=async()=>{if(!I(this,$a,"f")){try{this.isSurrealDB?await I(this,nr,"f").perspectiveKeepAliveSurrealQuery(I(this,wr,"f"),I(this,ir,"f")):await I(this,nr,"f").keepAliveQuery(I(this,wr,"f"),I(this,ir,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",I(this,Fn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}I(this,$a,"f")||_e(this,Wr,setTimeout(e,3e4),"f")}};_e(this,Wr,setTimeout(e,3e4),"f")}get id(){return I(this,ir,"f")}get initialized(){return I(this,Fs,"f")}get result(){return I(this,Di,"f")}onResult(e){return I(this,Ui,"f").add(e),()=>I(this,Ui,"f").delete(e)}dispose(){_e(this,$a,!0,"f"),clearTimeout(I(this,Wr,"f")),I(this,Hr,"f")&&I(this,Hr,"f").call(this),I(this,Ui,"f").clear(),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,ir,"f")&&(this.isSurrealDB?I(this,nr,"f").perspectiveDisposeSurrealQuerySubscription(I(this,wr,"f"),I(this,ir,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):I(this,nr,"f").disposeQuerySubscription(I(this,wr,"f"),I(this,ir,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};wr=new WeakMap,ir=new WeakMap,nr=new WeakMap,Ui=new WeakMap,Wr=new WeakMap,Hr=new WeakMap,Di=new WeakMap,$a=new WeakMap,Fs=new WeakMap,Ni=new WeakMap,Ri=new WeakMap,Lt=new WeakMap,Fn=new WeakMap,Ls=new WeakSet,Ou=function r(e){for(let t of I(this,Ui,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Un=class{constructor(r,e){de.set(this,void 0),ge.set(this,void 0),$i.set(this,void 0),Pi.set(this,void 0),Li.set(this,void 0),Pa.set(this,void 0),_e(this,$i,[],"f"),_e(this,Pi,[],"f"),_e(this,Li,[],"f"),_e(this,Pa,[],"f"),_e(this,de,r,"f"),_e(this,ge,e,"f"),this.uuid=I(this,de,"f").uuid,this.name=I(this,de,"f").name,this.owners=I(this,de,"f").owners,this.sharedUrl=I(this,de,"f").sharedUrl,this.neighbourhood=I(this,de,"f").neighbourhood,this.state=I(this,de,"f").state,I(this,ge,"f").addPerspectiveLinkAddedListener(I(this,de,"f").uuid,I(this,$i,"f")),I(this,ge,"f").addPerspectiveLinkRemovedListener(I(this,de,"f").uuid,I(this,Pi,"f")),I(this,ge,"f").addPerspectiveLinkUpdatedListener(I(this,de,"f").uuid,I(this,Li,"f")),I(this,ge,"f").addPerspectiveSyncStateChangeListener(I(this,de,"f").uuid,I(this,Pa,"f"))}async executeAction(r,e,t,i){return await I(this,ge,"f").executeCommands(I(this,de,"f").uuid,JSON.stringify(r),e,JSON.stringify(t),i)}async get(r){return await I(this,ge,"f").queryLinks(I(this,de,"f").uuid,r)}async infer(r){return await I(this,ge,"f").queryProlog(I(this,de,"f").uuid,r)}async querySurrealDB(r){return await I(this,ge,"f").querySurrealDB(I(this,de,"f").uuid,r)}async add(r,e="shared",t){return await I(this,ge,"f").addLink(I(this,de,"f").uuid,r,e,t)}async addLinks(r,e="shared",t){return await I(this,ge,"f").addLinks(I(this,de,"f").uuid,r,e,t)}async removeLinks(r,e){return await I(this,ge,"f").removeLinks(I(this,de,"f").uuid,r,e)}async linkMutations(r,e="shared"){return await I(this,ge,"f").linkMutations(I(this,de,"f").uuid,r,e)}async addLinkExpression(r,e="shared",t){return await I(this,ge,"f").addLinkExpression(I(this,de,"f").uuid,r,e,t)}async update(r,e,t){return await I(this,ge,"f").updateLink(I(this,de,"f").uuid,r,e,t)}async remove(r,e){return await I(this,ge,"f").removeLink(I(this,de,"f").uuid,r,e)}async createBatch(){return await I(this,ge,"f").createBatch(I(this,de,"f").uuid)}async commitBatch(r){return await I(this,ge,"f").commitBatch(I(this,de,"f").uuid,r)}async getExpression(r){return await I(this,ge,"f").getExpression(r)}async createExpression(r,e){return await I(this,ge,"f").createExpression(r,e)}async addListener(r,e){r==="link-added"?I(this,$i,"f").push(e):r==="link-removed"?I(this,Pi,"f").push(e):r==="link-updated"&&I(this,Li,"f").push(e)}async addSyncStateChangeListener(r){I(this,Pa,"f").push(r)}async removeListener(r,e){if(r==="link-added"){let t=I(this,$i,"f").indexOf(e);I(this,$i,"f").splice(t,1)}else if(r==="link-removed"){let t=I(this,Pi,"f").indexOf(e);I(this,Pi,"f").splice(t,1)}else if(r==="link-updated"){let t=I(this,Li,"f").indexOf(e);I(this,Li,"f").splice(t,1)}}async snapshot(){return I(this,ge,"f").snapshotByUUID(I(this,de,"f").uuid)}async loadSnapshot(r){let e=JSON.parse(JSON.stringify(r));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(r){delete r.target;let e=await this.get(r);return e.length?e[0].data.target:null}async setSingleTarget(r,e="shared"){let t=new ot({source:r.source,predicate:r.predicate}),i=await this.get(t),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[r];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(r){return(await this.infer(`flowable("${r}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(r,e){return(await this.infer(`register_sdna_flow("${r}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let r=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of r){let i=await this.get(new ot({source:"ad4m://self",predicate:t}));for(let n of i){let a=n.data.target,o=await this.get(new ot({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=ut.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(r){let e=ut.from(r);if((await this.get(new ot({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new ot({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=ut.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(r,e,t){return I(this,ge,"f").addSdna(I(this,de,"f").uuid,r,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(r=>r.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(r){if(typeof r=="string")return r;{let e=await this.subjectClassesByTemplate(r);return e[0]?e[0]:r.className}}async createSubject(r,e,t,i){let n;if(typeof r=="string")n=r,await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,i);else{let a=this.buildQueryFromTemplate(r);await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,i)}return i?e:this.getSubjectProxy(e,r)}async getSubjectData(r,e){if(typeof r=="string")return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({className:r}),e));let t=this.buildQueryFromTemplate(r);return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(r,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return!1;if(i.requiredTriples.length===0){console.log("no required triples, checking surrealDB");let n=`SELECT count() AS count FROM link WHERE in.uri = '${r}'`;console.log("checkQuery",n);let a=await this.querySurrealDB(n);console.log("result",a);let o=a[0]?.count??0;return(typeof o=="object"&&o?.Int!==void 0?o.Int:o)>0}for(let n of i.requiredTriples){console.log("checking triple",n);let a;n.target?a=`SELECT count() AS count FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' AND out.uri = '${n.target}'`:a=`SELECT count() AS count FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}'`,console.log("checkQuery",a);let o=await this.querySurrealDB(a);if(console.log("result",o),!o||o.length===0)return!1;let s=o[0]?.count??0;if((typeof s=="object"&&s?.Int!==void 0?s.Int:s)===0)return!1}return!0}async getSubjectProxy(r,e){if(!await this.isSubjectInstance(r,e))throw`Expression ${r} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=new ao(this,r,t);return await i.init(),i}async getSubjectClassMetadataFromSDNA(r){try{let e=await this.get(new ot({source:`literal://string:${r}`,predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${r}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${r} has no target:`,e[0]),null;let t=ut.fromUrl(e[0].data.target).get(),i=[],n=t.match(/instance\([^,]+,\s*\w+\)\s*:-\s*(.+?)\./s);if(n){let u=n[1];console.log("instance rule body:",u);let d=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,f;for(;(f=d.exec(u))!==null;){let p=f[1],h=f[2];i.push({predicate:p,target:h}),console.log(`Extracted triple: predicate="${p}", target="${h}"`)}}else console.warn(`No instance rule found in SDNA for ${r}`);let a=i.map(u=>u.predicate);console.log("extracted requiredTriples:",i);let o=new Map,s=await this.infer(`subject_class("${r}", C), property(C, P)`);if(s)for(let u of s){let d=u.P,f=null,p=await this.infer(`subject_class("${r}", C), property_setter(C, "${d}", Setter)`);if(p&&p.length>0){let m=p[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);m&&(f=m[1]||m[2])}if(!f){let h=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${d}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));h&&(f=h[1])}if(f){let h=await this.infer(`subject_class("${r}", C), property_resolve_language(C, "${d}", Lang)`),m=h&&h.length>0?h[0].Lang:void 0;o.set(d,{predicate:f,resolveLanguage:m})}}let c=new Map,l=await this.infer(`subject_class("${r}", C), collection(C, Coll)`);if(l)for(let u of l){let d=u.Coll,f=null,p,h=await this.infer(`subject_class("${r}", C), collection_adder(C, "${d}", Adder)`);if(h&&h.length>0){let b=h[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);b&&(f=b[1]||b[2])}let m=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${d}"[^)]*\\)\\s*:-[^.]+\\.`),v=t.match(m);if(v){let w=v[0],b=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,S=w.match(b);if(S){let _=S[1];if(_.startsWith("(")&&_.endsWith(")")&&(_=_.substring(1,_.length-1)),console.log(`Collection "${d}" getter body:`,_),!f){let R=_.match(/triple\([^,]+,\s*"([^"]+)"/);R&&(f=R[1])}let T=_.match(/subject_class\("([^"]+)"/);T&&(p=T[1],console.log(`Collection "${d}" has instanceFilter: ${p}`))}}f&&c.set(d,{predicate:f,instanceFilter:p})}return{requiredPredicates:a,requiredTriples:i,properties:o,collections:c}}catch(e){return console.error(`Error getting metadata for ${r}:`,e),null}}generateSurrealInstanceQuery(r){if(console.log("generateSurrealInstanceQuery called with requiredTriples:",r.requiredTriples),r.requiredTriples.length===0){let i="SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0";return console.log("Generated query (no required triples):",i),i}let t=`SELECT uri AS base FROM node WHERE ${r.requiredTriples.map(i=>i.target?`count(->link[WHERE predicate = '${i.predicate}' AND out.uri = '${i.target}']) > 0`:`count(->link[WHERE predicate = '${i.predicate}']) > 0`).join(" AND ")}`;return console.log("Generated query:",t),t}async getPropertyValueViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return;let n=i.properties.get(t);if(!n)return;let a=`SELECT out.uri AS value FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' LIMIT 1`,o=await this.querySurrealDB(a);if(!o||o.length===0)return;let s=o[0].value;if(n.resolveLanguage&&s)try{let c=await this.getExpression(s);try{return JSON.parse(c.data)}catch{return c.data}}catch{return s}return s}async getCollectionValuesViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return[];let n=i.collections.get(t);if(!n)return[];let a=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' ORDER BY timestamp ASC`,o=await this.querySurrealDB(a);if(!o||o.length===0)return[];let s=o.map(c=>c.value).filter(c=>c!==""&&c!=="");if(console.log(`getCollectionValuesViaSurreal: base="${r}", collection="${t}", predicate="${n.predicate}", found ${s.length} values:`,s),n.instanceFilter){console.log(` Applying instance filter "${n.instanceFilter}" to collection "${t}"`);let c=[];for(let l of s){let u=await this.isSubjectInstance(l,n.instanceFilter);console.log(` Checking if "${l}" is instance of "${n.instanceFilter}": ${u}`),u&&c.push(l)}return console.log(` After filtering: ${c.length} values`),c}return s}async getAllSubjectInstances(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new ao(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}async getAllSubjectProxies(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n);console.log("surrealQuery",a);let o=await this.querySurrealDB(a);console.log(`getAllSubjectProxies: SurrealDB returned ${o?.length||0} results`);let s=o.map(c=>({X:c.base}));console.log("newInstance",s),t=t.concat(s)}else console.warn(`getAllSubjectProxies: No metadata found for ${i}`)}return t}buildQueryFromTemplate(r){let e;return function(t){let i=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(u=>i.push(u)):i.push(...Object.keys(t).filter(u=>!Array.isArray(t[u]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(u=>u!=="isSubjectInstance").forEach(u=>{n.includes(u)||n.push(u)}):n.push(...Object.keys(t).filter(u=>Array.isArray(t[u])).filter(u=>u!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(u=>typeof t[u]=="function"&&u.startsWith("set")&&!u.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("set")&&!u.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("add")}));let s=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("remove")}));let c=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("setCollection")}));let l="subject_class(Class, C)";for(let u of i)l+=`, property(C, "${u}")`;for(let u of n)l+=`, collection(C, "${u}")`;for(let u of a){let d=u.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),l+=`, property_setter(C, "${d}", _)`}for(let u of o)l+=`, collection_adder(C, "${y0(u)}", _)`;for(let u of s)l+=`, collection_remover(C, "${b0(u)}", _)`;for(let u of c)l+=`, collection_setter(C, "${_0(u)}", _)`;l+=".",e=l}(r),e}async subjectClassesByTemplate(r){let e=this.buildQueryFromTemplate(r),t=await this.infer(e);return t?t.map(i=>i.Class):[]}async ensureSDNASubjectClass(r){if((await this.subjectClassesByTemplate(new r)).length>0)return;let{name:t,sdna:i}=r.generateSDNA();await this.addSdna(t,i,"subject_class")}getNeighbourhoodProxy(){return I(this,ge,"f").getNeighbourhoodProxy(I(this,de,"f").uuid)}get ai(){return I(this,ge,"f").aiClient}async subscribeInfer(r){let e=new nc(this.uuid,r,I(this,ge,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(r){let e=new nc(this.uuid,r,I(this,ge,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};de=new WeakMap,ge=new WeakMap,$i=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Pa=new WeakMap;var Vr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},z=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ie,La,Fa,Ma,Ms,Ua,Us,js,dt=`
|
|
64
64
|
author
|
|
65
65
|
timestamp
|
|
66
66
|
status
|
|
67
67
|
data { source, predicate, target }
|
|
68
68
|
proof { valid, invalid, signature, key }
|
|
69
|
-
`,
|
|
69
|
+
`,Dn=`
|
|
70
70
|
uuid
|
|
71
71
|
name
|
|
72
72
|
sharedUrl
|
|
@@ -87,139 +87,139 @@ neighbourhood {
|
|
|
87
87
|
}
|
|
88
88
|
author
|
|
89
89
|
}
|
|
90
|
-
`,
|
|
90
|
+
`,ac=class{constructor(e,t=!0){ie.set(this,void 0),La.set(this,void 0),Fa.set(this,void 0),Ma.set(this,void 0),Ms.set(this,void 0),Ua.set(this,void 0),Us.set(this,void 0),js.set(this,void 0),Vr(this,ie,e,"f"),Vr(this,La,[],"f"),Vr(this,Fa,[],"f"),Vr(this,Ma,[],"f"),Vr(this,Ms,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Vr(this,Ua,e,"f")}setNeighbourhoodClient(e){Vr(this,Us,e,"f")}setAIClient(e){Vr(this,js,e,"f")}get aiClient(){return z(this,js,"f")}async all(){let{perspectives:e}=k(await z(this,ie,"f").query({query:E`query perspectives {
|
|
91
91
|
perspectives {
|
|
92
|
-
${
|
|
92
|
+
${Dn}
|
|
93
93
|
}
|
|
94
|
-
}`}));return e.map(
|
|
94
|
+
}`}));return e.map(t=>new Un(t,this))}async byUUID(e){let{perspective:t}=k(await z(this,ie,"f").query({query:E`query perspective($uuid: String!) {
|
|
95
95
|
perspective(uuid: $uuid) {
|
|
96
|
-
${
|
|
96
|
+
${Dn}
|
|
97
97
|
}
|
|
98
|
-
}`,variables:{uuid:e}}));return
|
|
98
|
+
}`,variables:{uuid:e}}));return t?new Un(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=k(await z(this,ie,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
|
|
99
99
|
perspectiveSnapshot(uuid: $uuid) {
|
|
100
|
-
links { ${
|
|
100
|
+
links { ${dt} }
|
|
101
101
|
}
|
|
102
|
-
}`,variables:{uuid:e}}));return
|
|
102
|
+
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
103
103
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
104
|
-
}`,variables:{uuid:e}}));return
|
|
104
|
+
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
105
105
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
106
|
-
${
|
|
106
|
+
${dt}
|
|
107
107
|
}
|
|
108
|
-
}`,variables:{uuid:e,query:
|
|
108
|
+
}`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
109
109
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
110
|
-
}`,variables:{uuid:e,query:
|
|
110
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
111
111
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
112
|
-
}`,variables:{uuid:e,query:
|
|
112
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
113
113
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
114
114
|
subscriptionId
|
|
115
115
|
result
|
|
116
116
|
}
|
|
117
|
-
}`,variables:{uuid:e,query:
|
|
117
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
118
118
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
119
119
|
subscriptionId
|
|
120
120
|
result
|
|
121
121
|
}
|
|
122
|
-
}`,variables:{uuid:e,query:
|
|
122
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
123
123
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
124
|
-
}`,variables:{uuid:e,subscriptionId:
|
|
124
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
125
125
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
126
|
-
}`,variables:{uuid:e,subscriptionId:
|
|
126
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}subscribeToQueryUpdates(e,t){let i=z(this,ie,"f").subscribe({query:E`
|
|
127
127
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
128
128
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
129
129
|
}
|
|
130
|
-
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}
|
|
130
|
+
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
131
131
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
132
|
-
}`,variables:{uuid:e,subscriptionId:
|
|
132
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
133
133
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
134
|
-
}`,variables:{uuid:e,subscriptionId:
|
|
134
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}async add(e){let{perspectiveAdd:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
|
|
135
135
|
perspectiveAdd(name: $name) {
|
|
136
|
-
${
|
|
136
|
+
${Dn}
|
|
137
137
|
}
|
|
138
|
-
}`,variables:{name:e}}));return new
|
|
138
|
+
}`,variables:{name:e}}));return new Un(t,this)}async update(e,t){let{perspectiveUpdate:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
139
139
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
140
|
-
${
|
|
140
|
+
${Dn}
|
|
141
141
|
}
|
|
142
|
-
}`,variables:{uuid:e,name:
|
|
142
|
+
}`,variables:{uuid:e,name:t}}));return new Un(i,this)}async remove(e){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
|
|
143
143
|
perspectiveRemove(uuid: $uuid)
|
|
144
|
-
}`,variables:{uuid:e}}))}async addLink(e,
|
|
144
|
+
}`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
145
145
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
146
|
-
${
|
|
146
|
+
${dt}
|
|
147
147
|
}
|
|
148
|
-
}`,variables:{uuid:e,link:
|
|
148
|
+
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
149
149
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
150
|
-
${
|
|
150
|
+
${dt}
|
|
151
151
|
}
|
|
152
|
-
}`,variables:{uuid:e,links:
|
|
152
|
+
}`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
153
153
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
154
|
-
${
|
|
154
|
+
${dt}
|
|
155
155
|
}
|
|
156
|
-
}`,variables:{uuid:e,links:
|
|
156
|
+
}`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
157
157
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
158
158
|
additions {
|
|
159
|
-
${
|
|
159
|
+
${dt}
|
|
160
160
|
}
|
|
161
161
|
removals {
|
|
162
|
-
${
|
|
162
|
+
${dt}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
}`,variables:{uuid:e,mutations:
|
|
165
|
+
}`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
166
166
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
167
|
-
${
|
|
167
|
+
${dt}
|
|
168
168
|
}
|
|
169
|
-
}`,variables:{uuid:e,link:
|
|
169
|
+
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
170
170
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
171
|
-
${
|
|
171
|
+
${dt}
|
|
172
172
|
}
|
|
173
|
-
}`,variables:{uuid:e,oldLink:
|
|
173
|
+
}`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
174
174
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
175
|
-
}`,variables:{uuid:e,link:
|
|
175
|
+
}`,variables:{uuid:e,link:t,batchId:i}}));return n}async addSdna(e,t,i,n){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
|
|
176
176
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
|
|
177
|
-
}`,variables:{uuid:e,name:
|
|
177
|
+
}`,variables:{uuid:e,name:t,sdnaCode:i,sdnaType:n}})).perspectiveAddSdna}async executeCommands(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
178
178
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
179
|
-
}`,variables:{uuid:e,commands:
|
|
179
|
+
}`,variables:{uuid:e,commands:t,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
180
180
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
181
|
-
}`,variables:{uuid:e,subjectClass:
|
|
181
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,i){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
182
182
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
183
|
-
}`,variables:{uuid:e,subjectClass:
|
|
184
|
-
perspectiveAdded { ${
|
|
183
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await z(this,Ua,"f").get(e)}async createExpression(e,t){return await z(this,Ua,"f").create(e,t)}addPerspectiveAddedListener(e){z(this,La,"f").push(e)}subscribePerspectiveAdded(){z(this,ie,"f").subscribe({query:E` subscription {
|
|
184
|
+
perspectiveAdded { ${Dn} }
|
|
185
185
|
}
|
|
186
|
-
`}).subscribe({next:e=>{
|
|
187
|
-
perspectiveUpdated { ${
|
|
186
|
+
`}).subscribe({next:e=>{z(this,La,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){z(this,Fa,"f").push(e)}subscribePerspectiveUpdated(){z(this,ie,"f").subscribe({query:E` subscription {
|
|
187
|
+
perspectiveUpdated { ${Dn} }
|
|
188
188
|
}
|
|
189
|
-
`}).subscribe({next:e=>{
|
|
189
|
+
`}).subscribe({next:e=>{z(this,Fa,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){z(this,Ms,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
|
|
190
190
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
191
191
|
}
|
|
192
|
-
`}).subscribe({next:i=>{
|
|
192
|
+
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){z(this,Ma,"f").push(e)}subscribePerspectiveRemoved(){z(this,ie,"f").subscribe({query:E` subscription {
|
|
193
193
|
perspectiveRemoved
|
|
194
194
|
}
|
|
195
|
-
`}).subscribe({next:e=>{
|
|
196
|
-
perspectiveLinkAdded(uuid: "${e}") { ${
|
|
195
|
+
`}).subscribe({next:e=>{z(this,Ma,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
|
|
196
|
+
perspectiveLinkAdded(uuid: "${e}") { ${dt} }
|
|
197
197
|
}
|
|
198
|
-
`}).subscribe({next:i=>{
|
|
199
|
-
perspectiveLinkRemoved(uuid: "${e}") { ${
|
|
198
|
+
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
|
|
199
|
+
perspectiveLinkRemoved(uuid: "${e}") { ${dt} }
|
|
200
200
|
}
|
|
201
|
-
`}).subscribe({next:i=>{
|
|
201
|
+
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
|
|
202
202
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
203
203
|
oldLink {
|
|
204
|
-
${
|
|
204
|
+
${dt}
|
|
205
205
|
}
|
|
206
206
|
newLink {
|
|
207
|
-
${
|
|
207
|
+
${dt}
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
`}).subscribe({next:i=>{
|
|
211
|
+
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkUpdated.newLink.status||delete i.data.perspectiveLinkUpdated.newLink.status,i.data.perspectiveLinkUpdated.oldLink.status||delete i.data.perspectiveLinkUpdated.oldLink.status,n(i.data.perspectiveLinkUpdated)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}getNeighbourhoodProxy(e){return new Iu(z(this,Us,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
|
|
212
212
|
perspectiveCreateBatch(uuid: $uuid)
|
|
213
|
-
}`,variables:{uuid:e}}));return
|
|
213
|
+
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
214
214
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
215
215
|
additions {
|
|
216
|
-
${
|
|
216
|
+
${dt}
|
|
217
217
|
}
|
|
218
218
|
removals {
|
|
219
|
-
${
|
|
219
|
+
${dt}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
}`,variables:{uuid:e,batchId:
|
|
222
|
+
}`,variables:{uuid:e,batchId:t}}));return i}};ie=new WeakMap,La=new WeakMap,Fa=new WeakMap,Ma=new WeakMap,Ms=new WeakMap,Ua=new WeakMap,Us=new WeakMap,js=new WeakMap;var bs=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},se=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},he,ja,qa,Ba,Oa=`
|
|
223
223
|
did
|
|
224
224
|
directMessageLanguage
|
|
225
225
|
perspective {
|
|
@@ -233,7 +233,7 @@ neighbourhood {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
`,
|
|
236
|
+
`,_s=`
|
|
237
237
|
requestId
|
|
238
238
|
revoked
|
|
239
239
|
auth {
|
|
@@ -249,145 +249,145 @@ neighbourhood {
|
|
|
249
249
|
can
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
`,
|
|
252
|
+
`,Nn=`
|
|
253
253
|
isInitialized
|
|
254
254
|
isUnlocked
|
|
255
255
|
did
|
|
256
256
|
didDocument
|
|
257
257
|
error
|
|
258
|
-
`,
|
|
258
|
+
`,Ss=`
|
|
259
259
|
did
|
|
260
260
|
didSigningKeyId
|
|
261
261
|
deviceKeyType
|
|
262
262
|
deviceKey
|
|
263
263
|
deviceKeySignedByDid
|
|
264
264
|
didSignedByDeviceKey
|
|
265
|
-
`,
|
|
265
|
+
`,w0=`
|
|
266
266
|
signature
|
|
267
267
|
publicKey
|
|
268
|
-
`,
|
|
268
|
+
`,oo=class{constructor(e,t=!0){he.set(this,void 0),ja.set(this,void 0),qa.set(this,void 0),Ba.set(this,void 0),bs(this,he,e,"f"),bs(this,qa,[],"f"),bs(this,Ba,[],"f"),bs(this,ja,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await se(this,he,"f").query({query:E`query agent { agent { ${Oa} } }`})),t=new Yr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=k(await se(this,he,"f").query({query:E`query agentStatus {
|
|
269
269
|
agentStatus {
|
|
270
|
-
${
|
|
270
|
+
${Nn}
|
|
271
271
|
}
|
|
272
|
-
}`}));return new Mt(e)}async generate(e){let{agentGenerate:
|
|
272
|
+
}`}));return new Mt(e)}async generate(e){let{agentGenerate:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentGenerate(
|
|
273
273
|
$passphrase: String!
|
|
274
274
|
) {
|
|
275
275
|
agentGenerate(passphrase: $passphrase) {
|
|
276
|
-
${
|
|
276
|
+
${Nn}
|
|
277
277
|
}
|
|
278
|
-
}`,variables:{passphrase:e}}));return new Mt(
|
|
278
|
+
}`,variables:{passphrase:e}}));return new Mt(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=k(await se(this,he,"f").mutate({mutation:E`mutation agentImport(
|
|
279
279
|
$did: String!,
|
|
280
280
|
$didDocument: String!,
|
|
281
281
|
$keystore: String!,
|
|
282
282
|
$passphrase: String!
|
|
283
283
|
) {
|
|
284
284
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
285
|
-
${
|
|
285
|
+
${Nn}
|
|
286
286
|
}
|
|
287
|
-
}`,variables:{did:
|
|
287
|
+
}`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Mt(o)}async lock(e){let{agentLock:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
|
|
288
288
|
agentLock(passphrase: $passphrase) {
|
|
289
|
-
${
|
|
289
|
+
${Nn}
|
|
290
290
|
}
|
|
291
|
-
}`,variables:{passphrase:e}}));return new Mt(
|
|
291
|
+
}`,variables:{passphrase:e}}));return new Mt(t)}async unlock(e,t=!0){let{agentUnlock:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
292
292
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
293
|
-
${
|
|
293
|
+
${Nn}
|
|
294
294
|
}
|
|
295
|
-
}`,variables:{passphrase:e,holochain:
|
|
295
|
+
}`,variables:{passphrase:e,holochain:t}}));return new Mt(i)}async byDID(e){let{agentByDID:t}=k(await se(this,he,"f").query({query:E`query agentByDID($did: String!) {
|
|
296
296
|
agentByDID(did: $did) {
|
|
297
297
|
${Oa}
|
|
298
298
|
}
|
|
299
|
-
}`,variables:{did:e}}));return
|
|
299
|
+
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
300
300
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
301
301
|
${Oa}
|
|
302
302
|
}
|
|
303
|
-
}`,variables:{perspective:
|
|
303
|
+
}`,variables:{perspective:t}})),n=i,a=new Yr(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new ac(se(this,he,"f")),i=new oo(se(this,he,"f")),n=await t.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let c of e.additions)await n.add(c);for(let c of e.removals)await n.remove(c);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
304
304
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
305
305
|
${Oa}
|
|
306
306
|
}
|
|
307
|
-
}`,variables:{directMessageLanguage:e}})),i=
|
|
307
|
+
}`,variables:{directMessageLanguage:e}})),i=t,n=new Yr(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
308
308
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
309
|
-
${
|
|
309
|
+
${Ss}
|
|
310
310
|
}
|
|
311
|
-
}`,variables:{proofs:e}}));return
|
|
311
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
312
312
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
313
|
-
${
|
|
313
|
+
${Ss}
|
|
314
314
|
}
|
|
315
|
-
}`,variables:{proofs:e}}));return
|
|
315
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await se(this,he,"f").query({query:E`query agentGetEntanglementProofs {
|
|
316
316
|
agentGetEntanglementProofs {
|
|
317
|
-
${
|
|
317
|
+
${Ss}
|
|
318
318
|
}
|
|
319
|
-
}`}));return e}async entanglementProofPreFlight(e,
|
|
319
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
320
320
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
321
|
-
${
|
|
321
|
+
${Ss}
|
|
322
322
|
}
|
|
323
|
-
}`,variables:{deviceKey:e,deviceKeyType:
|
|
323
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){se(this,qa,"f").push(e)}addAppChangedListener(e){se(this,ja,"f").push(e)}subscribeAgentUpdated(){se(this,he,"f").subscribe({query:E` subscription {
|
|
324
324
|
agentUpdated { ${Oa} }
|
|
325
325
|
}
|
|
326
|
-
`}).subscribe({next:e=>{let
|
|
326
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;se(this,qa,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){se(this,he,"f").subscribe({query:E` subscription {
|
|
327
327
|
agentAppsChanged {
|
|
328
|
-
${
|
|
328
|
+
${_s}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
`}).subscribe({next:e=>{
|
|
332
|
-
agentStatusChanged { ${
|
|
331
|
+
`}).subscribe({next:e=>{se(this,ja,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){se(this,Ba,"f").push(e)}subscribeAgentStatusChanged(){se(this,he,"f").subscribe({query:E` subscription {
|
|
332
|
+
agentStatusChanged { ${Nn} }
|
|
333
333
|
}
|
|
334
|
-
`}).subscribe({next:e=>{let
|
|
334
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;se(this,Ba,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=k(await se(this,he,"f").mutate({mutation:E`
|
|
335
335
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
336
336
|
agentRequestCapability(authInfo: $authInfo)
|
|
337
337
|
}
|
|
338
|
-
`,variables:{authInfo:e}}));return
|
|
338
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=k(await se(this,he,"f").mutate({mutation:E`
|
|
339
339
|
mutation agentPermitCapability($auth: String!) {
|
|
340
340
|
agentPermitCapability(auth: $auth)
|
|
341
341
|
}
|
|
342
|
-
`,variables:{auth:e}}));return
|
|
342
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=k(await se(this,he,"f").mutate({mutation:E`
|
|
343
343
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
344
344
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
345
345
|
}
|
|
346
|
-
`,variables:{requestId:e,rand:
|
|
346
|
+
`,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=k(await se(this,he,"f").mutate({mutation:E`query agentGetApps {
|
|
347
347
|
agentGetApps {
|
|
348
|
-
${
|
|
348
|
+
${_s}
|
|
349
349
|
}
|
|
350
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:
|
|
350
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
|
|
351
351
|
agentRemoveApp(requestId: $requestId) {
|
|
352
|
-
${
|
|
352
|
+
${_s}
|
|
353
353
|
}
|
|
354
|
-
}`,variables:{requestId:e}}));return
|
|
354
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
|
|
355
355
|
agentRevokeToken(requestId: $requestId) {
|
|
356
|
-
${
|
|
356
|
+
${_s}
|
|
357
357
|
}
|
|
358
|
-
}`,variables:{requestId:e}}));return
|
|
358
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=k(await se(this,he,"f").mutate({mutation:E`
|
|
359
359
|
query agentIsLocked {
|
|
360
360
|
agentIsLocked
|
|
361
361
|
}
|
|
362
|
-
`}));return e}async signMessage(e){let{agentSignMessage:
|
|
362
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
|
|
363
363
|
agentSignMessage(message: $message) {
|
|
364
|
-
${
|
|
364
|
+
${w0}
|
|
365
365
|
}
|
|
366
|
-
}`,variables:{message:e}}));return
|
|
366
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
367
367
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
368
368
|
did
|
|
369
369
|
success
|
|
370
370
|
error
|
|
371
371
|
}
|
|
372
|
-
}`,variables:{email:e,password:
|
|
372
|
+
}`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
373
373
|
runtimeLoginUser(email: $email, password: $password)
|
|
374
|
-
}`,variables:{email:e,password:
|
|
374
|
+
}`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
375
375
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
376
376
|
success
|
|
377
377
|
message
|
|
378
378
|
requiresPassword
|
|
379
379
|
isExistingUser
|
|
380
380
|
}
|
|
381
|
-
}`,variables:{email:e,appInfo:
|
|
381
|
+
}`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
382
382
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
383
|
-
}`,variables:{email:e,code:
|
|
383
|
+
}`,variables:{email:e,code:t,verificationType:i}}));return n}};he=new WeakMap,ja=new WeakMap,qa=new WeakMap,Ba=new WeakMap;var C0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Qr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ht,rh=`
|
|
384
384
|
name
|
|
385
385
|
address
|
|
386
386
|
settings
|
|
387
387
|
icon { code }
|
|
388
388
|
constructorIcon { code }
|
|
389
389
|
settingsIcon { code }
|
|
390
|
-
`,
|
|
390
|
+
`,ih=`
|
|
391
391
|
name
|
|
392
392
|
address
|
|
393
393
|
description
|
|
@@ -397,45 +397,45 @@ neighbourhood {
|
|
|
397
397
|
templateAppliedParams
|
|
398
398
|
possibleTemplateParams
|
|
399
399
|
sourceCodeLink
|
|
400
|
-
`,
|
|
400
|
+
`,Du=class{constructor(e){Ht.set(this,void 0),C0(this,Ht,e,"f")}async byAddress(e){let{language:t}=k(await Qr(this,Ht,"f").query({query:E`query byAddress($address: String!) {
|
|
401
401
|
language(address: $address) {
|
|
402
|
-
${
|
|
402
|
+
${rh}
|
|
403
403
|
}
|
|
404
|
-
}`,variables:{address:e}}));return
|
|
404
|
+
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=k(await Qr(this,Ht,"f").query({query:E`query byFilter($filter: String!) {
|
|
405
405
|
languages(filter: $filter) {
|
|
406
|
-
${
|
|
406
|
+
${rh}
|
|
407
407
|
}
|
|
408
|
-
}`,variables:{filter:e}}));return
|
|
408
|
+
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
409
409
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
410
|
-
}`,variables:{languageAddress:e,settings:
|
|
410
|
+
}`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
|
|
411
411
|
$sourceLanguageHash: String!,
|
|
412
412
|
$templateData: String!,
|
|
413
413
|
) {
|
|
414
414
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
415
415
|
name, address
|
|
416
416
|
}
|
|
417
|
-
}`,variables:{sourceLanguageHash:e,templateData:
|
|
417
|
+
}`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languagePublish(
|
|
418
418
|
$languagePath: String!,
|
|
419
419
|
$languageMeta: LanguageMetaInput!,
|
|
420
420
|
) {
|
|
421
421
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
422
|
-
${
|
|
422
|
+
${ih}
|
|
423
423
|
}
|
|
424
|
-
}`,variables:{languagePath:e,languageMeta:
|
|
424
|
+
}`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=k(await Qr(this,Ht,"f").query({query:E`query languageMeta(
|
|
425
425
|
$address: String!,
|
|
426
426
|
) {
|
|
427
427
|
languageMeta(address: $address) {
|
|
428
|
-
${
|
|
428
|
+
${ih}
|
|
429
429
|
}
|
|
430
|
-
}`,variables:{address:e}}));return
|
|
430
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=k(await Qr(this,Ht,"f").query({query:E`query languageSource(
|
|
431
431
|
$address: String!,
|
|
432
432
|
) {
|
|
433
433
|
languageSource(address: $address)
|
|
434
|
-
}`,variables:{address:e}}));return
|
|
434
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languageRemove(
|
|
435
435
|
$address: String!,
|
|
436
436
|
) {
|
|
437
437
|
languageRemove(address: $address)
|
|
438
|
-
}`,variables:{address:e}}));return
|
|
438
|
+
}`,variables:{address:e}}));return t}};Ht=new WeakMap;var E0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},lt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ht,Mn,Nu=class{constructor(e){ht.set(this,void 0),Mn.set(this,new Map),E0(this,ht,e,"f")}async publishFromPerspective(e,t,i){let{neighbourhoodPublishFromPerspective:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
|
|
439
439
|
$linkLanguage: String!,
|
|
440
440
|
$meta: PerspectiveInput!,
|
|
441
441
|
$perspectiveUUID: String!
|
|
@@ -445,7 +445,7 @@ neighbourhood {
|
|
|
445
445
|
meta: $meta,
|
|
446
446
|
perspectiveUUID: $perspectiveUUID
|
|
447
447
|
)
|
|
448
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:
|
|
448
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
449
449
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
450
450
|
uuid
|
|
451
451
|
name
|
|
@@ -467,11 +467,11 @@ neighbourhood {
|
|
|
467
467
|
author
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
}`,variables:{url:e}}));return
|
|
470
|
+
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
|
|
471
471
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
472
|
-
}`,variables:{perspectiveUUID:e}}));return
|
|
472
|
+
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
|
|
473
473
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
474
|
-
}`,variables:{perspectiveUUID:e}}));return
|
|
474
|
+
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
|
|
475
475
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
476
476
|
did
|
|
477
477
|
status {
|
|
@@ -488,7 +488,7 @@ neighbourhood {
|
|
|
488
488
|
proof { valid, invalid, signature, key }
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
}`,variables:{perspectiveUUID:e}}));return
|
|
491
|
+
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
|
|
492
492
|
$perspectiveUUID: String!,
|
|
493
493
|
$status: PerspectiveInput!
|
|
494
494
|
) {
|
|
@@ -496,7 +496,7 @@ neighbourhood {
|
|
|
496
496
|
perspectiveUUID: $perspectiveUUID,
|
|
497
497
|
status: $status
|
|
498
498
|
)
|
|
499
|
-
}`,variables:{perspectiveUUID:e,status:
|
|
499
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
|
|
500
500
|
$perspectiveUUID: String!,
|
|
501
501
|
$status: PerspectiveUnsignedInput!
|
|
502
502
|
) {
|
|
@@ -504,7 +504,7 @@ neighbourhood {
|
|
|
504
504
|
perspectiveUUID: $perspectiveUUID,
|
|
505
505
|
status: $status
|
|
506
506
|
)
|
|
507
|
-
}`,variables:{perspectiveUUID:e,status:
|
|
507
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
|
|
508
508
|
$perspectiveUUID: String!,
|
|
509
509
|
$remoteAgentDid: String!,
|
|
510
510
|
$payload: PerspectiveInput!
|
|
@@ -514,7 +514,7 @@ neighbourhood {
|
|
|
514
514
|
remoteAgentDid: $remoteAgentDid,
|
|
515
515
|
payload: $payload
|
|
516
516
|
)
|
|
517
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:
|
|
517
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
|
|
518
518
|
$perspectiveUUID: String!,
|
|
519
519
|
$remoteAgentDid: String!,
|
|
520
520
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -524,7 +524,7 @@ neighbourhood {
|
|
|
524
524
|
remoteAgentDid: $remoteAgentDid,
|
|
525
525
|
payload: $payload
|
|
526
526
|
)
|
|
527
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:
|
|
527
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
|
|
528
528
|
$perspectiveUUID: String!,
|
|
529
529
|
$payload: PerspectiveInput!,
|
|
530
530
|
$loopback: Boolean
|
|
@@ -534,7 +534,7 @@ neighbourhood {
|
|
|
534
534
|
payload: $payload,
|
|
535
535
|
loopback: $loopback
|
|
536
536
|
)
|
|
537
|
-
}`,variables:{perspectiveUUID:e,payload:
|
|
537
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
|
|
538
538
|
$perspectiveUUID: String!,
|
|
539
539
|
$payload: PerspectiveUnsignedInput!,
|
|
540
540
|
$loopback: Boolean
|
|
@@ -544,7 +544,7 @@ neighbourhood {
|
|
|
544
544
|
payload: $payload,
|
|
545
545
|
loopback: $loopback
|
|
546
546
|
)
|
|
547
|
-
}`,variables:{perspectiveUUID:e,payload:
|
|
547
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=lt(this,Mn,"f").get(e);i&&i.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await lt(this,ht,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
548
548
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
549
549
|
author
|
|
550
550
|
timestamp
|
|
@@ -559,7 +559,7 @@ neighbourhood {
|
|
|
559
559
|
}
|
|
560
560
|
proof { valid, invalid, signature, key }
|
|
561
561
|
}
|
|
562
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=k(i);
|
|
562
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=k(i);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let i=lt(this,Mn,"f").get(e);i||(i=[],lt(this,Mn,"f").set(e,i),await this.subscribeToSignals(e)),i.push(t)}removeSignalHandler(e,t){let i=lt(this,Mn,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};ht=new WeakMap,Mn=new WeakMap;var ws=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},W=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Z,Va,Qa,za,C1,Cs=`
|
|
563
563
|
author
|
|
564
564
|
timestamp
|
|
565
565
|
data {
|
|
@@ -571,7 +571,7 @@ data {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
proof { valid, invalid, signature, key }
|
|
574
|
-
`,
|
|
574
|
+
`,x0=`
|
|
575
575
|
description
|
|
576
576
|
appName
|
|
577
577
|
appUrl
|
|
@@ -580,72 +580,72 @@ trigger
|
|
|
580
580
|
perspectiveIds
|
|
581
581
|
webhookUrl
|
|
582
582
|
webhookAuth
|
|
583
|
-
`,
|
|
583
|
+
`,E1=`
|
|
584
584
|
id
|
|
585
585
|
granted
|
|
586
|
-
${
|
|
587
|
-
`,
|
|
588
|
-
notification { ${
|
|
586
|
+
${x0}
|
|
587
|
+
`,A0=`
|
|
588
|
+
notification { ${E1} }
|
|
589
589
|
perspectiveId
|
|
590
590
|
triggerMatch
|
|
591
|
-
`,
|
|
591
|
+
`,Ru=class{constructor(e,t=!0){Z.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),za.set(this,void 0),C1.set(this,void 0),ws(this,Z,e,"f"),ws(this,Va,[],"f"),ws(this,Qa,[],"f"),ws(this,za,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await W(this,Z,"f").query({query:E`query runtimeInfo {
|
|
592
592
|
runtimeInfo {
|
|
593
593
|
ad4mExecutorVersion,
|
|
594
594
|
isInitialized,
|
|
595
595
|
isUnlocked
|
|
596
596
|
}
|
|
597
|
-
}`}));return e}async quit(){return k(await
|
|
597
|
+
}`}));return e}async quit(){return k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
|
|
598
598
|
runtimeOpenLink(url: $url)
|
|
599
|
-
}`,variables:{url:e}}));return
|
|
599
|
+
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
|
|
600
600
|
addTrustedAgents(agents: $agents)
|
|
601
|
-
}`,variables:{agents:e}}));return
|
|
601
|
+
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
602
602
|
deleteTrustedAgents(agents: $agents)
|
|
603
|
-
}`,variables:{agents:e}}));return
|
|
603
|
+
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=k(await W(this,Z,"f").query({query:E`query getTrustedAgents {
|
|
604
604
|
getTrustedAgents
|
|
605
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:
|
|
605
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
606
606
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
607
|
-
}`,variables:{addresses:e}}));return
|
|
607
|
+
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
608
608
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
609
|
-
}`,variables:{addresses:e}}));return
|
|
609
|
+
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await W(this,Z,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
|
|
610
610
|
runtimeKnownLinkLanguageTemplates
|
|
611
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:
|
|
611
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
|
|
612
612
|
runtimeAddFriends(dids: $dids)
|
|
613
|
-
}`,variables:{dids:e}}));return
|
|
613
|
+
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
614
614
|
runtimeRemoveFriends(dids: $dids)
|
|
615
|
-
}`,variables:{dids:e}}));return
|
|
615
|
+
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=k(await W(this,Z,"f").query({query:E`query runtimeFriends {
|
|
616
616
|
runtimeFriends
|
|
617
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await
|
|
617
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await W(this,Z,"f").query({query:E`query runtimeHcAgentInfos {
|
|
618
618
|
runtimeHcAgentInfos
|
|
619
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await
|
|
619
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await W(this,Z,"f").query({query:E`query runtimeGetNetworkMetrics {
|
|
620
620
|
runtimeGetNetworkMetrics
|
|
621
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await
|
|
621
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
|
|
622
622
|
runtimeRestartHolochain
|
|
623
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:
|
|
623
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
624
624
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
625
|
-
}`,variables:{agentInfos:e}}));return
|
|
625
|
+
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i,n){let{runtimeVerifyStringSignedByDid:a}=k(await W(this,Z,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
626
626
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
627
|
-
}`,variables:{did:e,didSigningKeyId:
|
|
627
|
+
}`,variables:{did:e,didSigningKeyId:t,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
628
628
|
runtimeSetStatus(status: $status)
|
|
629
|
-
}`,variables:{status:e}}));return
|
|
630
|
-
runtimeFriendStatus(did: $did) { ${
|
|
631
|
-
}`,variables:{did:e}}));return
|
|
629
|
+
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=k(await W(this,Z,"f").query({query:E`query runtimeFriendStatus($did: String!) {
|
|
630
|
+
runtimeFriendStatus(did: $did) { ${Cs} }
|
|
631
|
+
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
632
632
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
633
|
-
}`,variables:{did:e,message:
|
|
634
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
635
|
-
}`,variables:{filter:e}}));return
|
|
633
|
+
}`,variables:{did:e,message:t}}));return i}async messageInbox(e){let{runtimeMessageInbox:t}=k(await W(this,Z,"f").query({query:E`query runtimeMessageInbox($filter: String) {
|
|
634
|
+
runtimeMessageInbox(filter: $filter) { ${Cs} }
|
|
635
|
+
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=k(await W(this,Z,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
|
|
636
636
|
runtimeMessageOutbox(filter: $filter) {
|
|
637
637
|
recipient,
|
|
638
638
|
message {
|
|
639
|
-
${
|
|
639
|
+
${Cs}
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
|
-
}`,variables:{filter:e}}));return
|
|
642
|
+
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
643
643
|
runtimeRequestInstallNotification(notification: $notification)
|
|
644
|
-
}`,variables:{notification:e}}));return
|
|
644
|
+
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
|
|
645
645
|
runtimeGrantNotification(id: $id)
|
|
646
|
-
}`,variables:{id:e}}));return
|
|
646
|
+
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
|
|
647
647
|
runtimeExportDb(filePath: $filePath)
|
|
648
|
-
}`,variables:{filePath:e}}));return
|
|
648
|
+
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
|
|
649
649
|
runtimeImportDb(filePath: $filePath) {
|
|
650
650
|
perspectives { total imported failed omitted errors }
|
|
651
651
|
links { total imported failed omitted errors }
|
|
@@ -659,51 +659,51 @@ triggerMatch
|
|
|
659
659
|
trustedAgents { total imported failed omitted errors }
|
|
660
660
|
knownLinkLanguages { total imported failed omitted errors }
|
|
661
661
|
}
|
|
662
|
-
}`,variables:{filePath:e}}));return
|
|
663
|
-
runtimeNotifications { ${
|
|
664
|
-
}`}));return e}async updateNotification(e,
|
|
662
|
+
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=k(await W(this,Z,"f").query({query:E`query runtimeNotifications {
|
|
663
|
+
runtimeNotifications { ${E1} }
|
|
664
|
+
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
665
665
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
666
|
-
}`,variables:{id:e,notification:
|
|
666
|
+
}`,variables:{id:e,notification:t}}));return i}async removeNotification(e){let{runtimeRemoveNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
|
|
667
667
|
runtimeRemoveNotification(id: $id)
|
|
668
|
-
}`,variables:{id:e}}));return
|
|
668
|
+
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
669
669
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
670
|
-
}`,variables:{perspectiveUuid:e,filePath:
|
|
670
|
+
}`,variables:{perspectiveUuid:e,filePath:t}}));return i}async importPerspective(e){let{runtimeImportPerspective:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
|
|
671
671
|
runtimeImportPerspective(filePath: $filePath)
|
|
672
|
-
}`,variables:{filePath:e}}));return
|
|
672
|
+
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await W(this,Z,"f").query({query:E`query runtimeMultiUserEnabled {
|
|
673
673
|
runtimeMultiUserEnabled
|
|
674
|
-
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:
|
|
674
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
675
675
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
676
|
-
}`,variables:{enabled:e}}));return
|
|
676
|
+
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=k(await W(this,Z,"f").query({query:E`query runtimeListUsers {
|
|
677
677
|
runtimeListUsers {
|
|
678
678
|
email
|
|
679
679
|
did
|
|
680
680
|
lastSeen
|
|
681
681
|
perspectiveCount
|
|
682
682
|
}
|
|
683
|
-
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await
|
|
683
|
+
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
|
|
684
684
|
runtimeEmailTestModeEnable
|
|
685
|
-
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await
|
|
685
|
+
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
|
|
686
686
|
runtimeEmailTestModeDisable
|
|
687
|
-
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:
|
|
687
|
+
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
|
|
688
688
|
runtimeEmailTestGetCode(email: $email)
|
|
689
|
-
}`,variables:{email:e}}));return
|
|
689
|
+
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
|
|
690
690
|
runtimeEmailTestClearCodes
|
|
691
|
-
}`}));return e}async emailTestSetExpiry(e,
|
|
691
|
+
}`}));return e}async emailTestSetExpiry(e,t,i){let{runtimeEmailTestSetExpiry:n}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
692
692
|
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
693
|
-
}`,variables:{email:e,verificationType:
|
|
694
|
-
runtimeNotificationTriggered { ${
|
|
693
|
+
}`,variables:{email:e,verificationType:t,expiresAt:i}}));return n}addNotificationTriggeredCallback(e){W(this,za,"f").push(e)}subscribeNotificationTriggered(){W(this,Z,"f").subscribe({query:E` subscription {
|
|
694
|
+
runtimeNotificationTriggered { ${A0} }
|
|
695
695
|
}
|
|
696
|
-
`}).subscribe({next:e=>{
|
|
697
|
-
runtimeMessageReceived { ${
|
|
696
|
+
`}).subscribe({next:e=>{W(this,za,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){W(this,Va,"f").push(e)}subscribeMessageReceived(){W(this,Z,"f").subscribe({query:E` subscription {
|
|
697
|
+
runtimeMessageReceived { ${Cs} }
|
|
698
698
|
}
|
|
699
|
-
`}).subscribe({next:e=>{
|
|
699
|
+
`}).subscribe({next:e=>{W(this,Va,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){W(this,Qa,"f").push(e)}subscribeExceptionOccurred(){W(this,Z,"f").subscribe({query:E` subscription {
|
|
700
700
|
exceptionOccurred {
|
|
701
701
|
title
|
|
702
702
|
message
|
|
703
703
|
type
|
|
704
704
|
addon
|
|
705
705
|
}
|
|
706
|
-
}`}).subscribe({next:e=>{
|
|
706
|
+
}`}).subscribe({next:e=>{W(this,Qa,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};Z=new WeakMap,Va=new WeakMap,Qa=new WeakMap,za=new WeakMap,C1=new WeakMap;var k0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Rn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Cr,$u=class{constructor(e){Cr.set(this,void 0),k0(this,Cr,e,"f")}async get(e,t=!1){if(!t)try{let n=ut.fromUrl(e).get();if(typeof n=="object"&&n!==null&&"author"in n&&"timestamp"in n&&"data"in n&&"proof"in n)return n}catch{}let{expression:i}=k(await Rn(this,Cr,"f").query({query:E`query expression($url: String!) {
|
|
707
707
|
expression(url: $url) {
|
|
708
708
|
author
|
|
709
709
|
timestamp
|
|
@@ -716,7 +716,7 @@ triggerMatch
|
|
|
716
716
|
invalid
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
|
-
}`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:
|
|
719
|
+
}`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionMany($urls: [String!]!) {
|
|
720
720
|
expressionMany(urls: $urls) {
|
|
721
721
|
author
|
|
722
722
|
timestamp
|
|
@@ -729,19 +729,19 @@ triggerMatch
|
|
|
729
729
|
invalid
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
|
-
}`,variables:{urls:e}}));return
|
|
732
|
+
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionRaw($url: String!) {
|
|
733
733
|
expressionRaw(url: $url)
|
|
734
|
-
}`,variables:{url:e}}));return
|
|
734
|
+
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:i}=k(await Rn(this,Cr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
|
|
735
735
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
736
|
-
}`,variables:{content:e,languageAddress:
|
|
736
|
+
}`,variables:{content:e,languageAddress:t}}));return i}async interactions(e){let{expressionInteractions:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionInteractions($url: String!) {
|
|
737
737
|
expressionInteractions(url: $url) {
|
|
738
738
|
label
|
|
739
739
|
name
|
|
740
740
|
parameters { name, type }
|
|
741
741
|
}
|
|
742
|
-
}`,variables:{url:e}}));return
|
|
742
|
+
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=k(await Rn(this,Cr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
743
743
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
744
|
-
}`,variables:{url:e,interactionCall:r}}));return i}};Er=new WeakMap;var yc={};yc.byteLength=T0;yc.toByteArray=O0;yc.fromByteArray=R0;var sr=[],Ft=[],k0=typeof Uint8Array<"u"?Uint8Array:Array,al="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Oi=0,ih=al.length;Oi<ih;++Oi)sr[Oi]=al[Oi],Ft[al.charCodeAt(Oi)]=Oi;var Oi,ih;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function E1(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function T0(t){var e=E1(t),r=e[0],i=e[1];return(r+i)*3/4-i}function I0(t,e,r){return(e+r)*3/4-r}function O0(t){var e,r=E1(t),i=r[0],n=r[1],a=new k0(I0(t,i,n)),o=0,s=n>0?i-4:i,u;for(u=0;u<s;u+=4)e=Ft[t.charCodeAt(u)]<<18|Ft[t.charCodeAt(u+1)]<<12|Ft[t.charCodeAt(u+2)]<<6|Ft[t.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Ft[t.charCodeAt(u)]<<2|Ft[t.charCodeAt(u+1)]>>4,a[o++]=e&255),n===1&&(e=Ft[t.charCodeAt(u)]<<10|Ft[t.charCodeAt(u+1)]<<4|Ft[t.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function D0(t){return sr[t>>18&63]+sr[t>>12&63]+sr[t>>6&63]+sr[t&63]}function N0(t,e,r){for(var i,n=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),n.push(D0(i));return n.join("")}function R0(t){for(var e,r=t.length,i=r%3,n=[],a=16383,o=0,s=r-i;o<s;o+=a)n.push(N0(t,o,o+a>s?s:o+a));return i===1?(e=t[r-1],n.push(sr[e>>2]+sr[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),n.join("")}var P0=4,nh=0,ah=1,$0=2;function Xn(t){let e=t.length;for(;--e>=0;)t[e]=0}var L0=0,x1=1,F0=2,M0=3,U0=258,Xl=29,vo=256,ao=vo+1+Xl,qn=30,ep=19,A1=2*ao+1,qi=15,ol=16,j0=7,tp=256,k1=16,T1=17,I1=18,Pl=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Us=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),q0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),O1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B0=512,xr=new Array((ao+2)*2);Xn(xr);var Ya=new Array(qn*2);Xn(Ya);var oo=new Array(B0);Xn(oo);var so=new Array(U0-M0+1);Xn(so);var rp=new Array(Xl);Xn(rp);var ac=new Array(qn);Xn(ac);function sl(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var D1,N1,R1;function cl(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var P1=t=>t<256?oo[t]:oo[256+(t>>>7)],co=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},St=(t,e,r)=>{t.bi_valid>ol-r?(t.bi_buf|=e<<t.bi_valid&65535,co(t,t.bi_buf),t.bi_buf=e>>ol-t.bi_valid,t.bi_valid+=r-ol):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},cr=(t,e,r)=>{St(t,r[e*2],r[e*2+1])},$1=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},V0=t=>{t.bi_valid===16?(co(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Q0=(t,e)=>{let r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,u=e.stat_desc.max_length,c,l,d,f,p,h,m=0;for(f=0;f<=qi;f++)t.bl_count[f]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<A1;c++)l=t.heap[c],f=r[r[l*2+1]*2+1]+1,f>u&&(f=u,m++),r[l*2+1]=f,!(l>i)&&(t.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=r[l*2],t.opt_len+=h*(f+p),a&&(t.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(f=u-1;t.bl_count[f]===0;)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[u]--,m-=2}while(m>0);for(f=u;f!==0;f--)for(l=t.bl_count[f];l!==0;)d=t.heap[--c],!(d>i)&&(r[d*2+1]!==f&&(t.opt_len+=(f-r[d*2+1])*r[d*2],r[d*2+1]=f),l--)}},L1=(t,e,r)=>{let i=new Array(qi+1),n=0,a,o;for(a=1;a<=qi;a++)n=n+r[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=$1(i[s]++,s))}},z0=()=>{let t,e,r,i,n,a=new Array(qi+1);for(r=0,i=0;i<Xl-1;i++)for(rp[i]=r,t=0;t<1<<Pl[i];t++)so[r++]=i;for(so[r-1]=i,n=0,i=0;i<16;i++)for(ac[i]=n,t=0;t<1<<Us[i];t++)oo[n++]=i;for(n>>=7;i<qn;i++)for(ac[i]=n<<7,t=0;t<1<<Us[i]-7;t++)oo[256+n++]=i;for(e=0;e<=qi;e++)a[e]=0;for(t=0;t<=143;)xr[t*2+1]=8,t++,a[8]++;for(;t<=255;)xr[t*2+1]=9,t++,a[9]++;for(;t<=279;)xr[t*2+1]=7,t++,a[7]++;for(;t<=287;)xr[t*2+1]=8,t++,a[8]++;for(L1(xr,ao+1,a),t=0;t<qn;t++)Ya[t*2+1]=5,Ya[t*2]=$1(t,5);D1=new sl(xr,Pl,vo+1,ao,qi),N1=new sl(Ya,Us,0,qn,qi),R1=new sl(new Array(0),q0,0,ep,j0)},F1=t=>{let e;for(e=0;e<ao;e++)t.dyn_ltree[e*2]=0;for(e=0;e<qn;e++)t.dyn_dtree[e*2]=0;for(e=0;e<ep;e++)t.bl_tree[e*2]=0;t.dyn_ltree[tp*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},M1=t=>{t.bi_valid>8?co(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},oh=(t,e,r,i)=>{let n=e*2,a=r*2;return t[n]<t[a]||t[n]===t[a]&&i[e]<=i[r]},ul=(t,e,r)=>{let i=t.heap[r],n=r<<1;for(;n<=t.heap_len&&(n<t.heap_len&&oh(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!oh(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i},sh=(t,e,r)=>{let i,n,a=0,o,s;if(t.sym_next!==0)do i=t.pending_buf[t.sym_buf+a++]&255,i+=(t.pending_buf[t.sym_buf+a++]&255)<<8,n=t.pending_buf[t.sym_buf+a++],i===0?cr(t,n,e):(o=so[n],cr(t,o+vo+1,e),s=Pl[o],s!==0&&(n-=rp[o],St(t,n,s)),i--,o=P1(i),cr(t,o,r),s=Us[o],s!==0&&(i-=ac[o],St(t,i,s)));while(a<t.sym_next);cr(t,tp,e)},$l=(t,e)=>{let r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,u=-1,c;for(t.heap_len=0,t.heap_max=A1,o=0;o<a;o++)r[o*2]!==0?(t.heap[++t.heap_len]=u=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=u<2?++u:0,r[c*2]=1,t.depth[c]=0,t.opt_len--,n&&(t.static_len-=i[c*2+1]);for(e.max_code=u,o=t.heap_len>>1;o>=1;o--)ul(t,r,o);c=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],ul(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[c*2]=r[o*2]+r[s*2],t.depth[c]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[o*2+1]=r[s*2+1]=c,t.heap[1]=c++,ul(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Q0(t,e),L1(r,u,t.bl_count)},ch=(t,e,r)=>{let i,n=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)a=o,o=e[(i+1)*2+1],!(++s<u&&a===o)&&(s<c?t.bl_tree[a*2]+=s:a!==0?(a!==n&&t.bl_tree[a*2]++,t.bl_tree[k1*2]++):s<=10?t.bl_tree[T1*2]++:t.bl_tree[I1*2]++,s=0,n=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},uh=(t,e,r)=>{let i,n=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),i=0;i<=r;i++)if(a=o,o=e[(i+1)*2+1],!(++s<u&&a===o)){if(s<c)do cr(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==n&&(cr(t,a,t.bl_tree),s--),cr(t,k1,t.bl_tree),St(t,s-3,2)):s<=10?(cr(t,T1,t.bl_tree),St(t,s-3,3)):(cr(t,I1,t.bl_tree),St(t,s-11,7));s=0,n=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4)}},W0=t=>{let e;for(ch(t,t.dyn_ltree,t.l_desc.max_code),ch(t,t.dyn_dtree,t.d_desc.max_code),$l(t,t.bl_desc),e=ep-1;e>=3&&t.bl_tree[O1[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},H0=(t,e,r,i)=>{let n;for(St(t,e-257,5),St(t,r-1,5),St(t,i-4,4),n=0;n<i;n++)St(t,t.bl_tree[O1[n]*2+1],3);uh(t,t.dyn_ltree,e-1),uh(t,t.dyn_dtree,r-1)},G0=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return nh;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return ah;for(r=32;r<vo;r++)if(t.dyn_ltree[r*2]!==0)return ah;return nh},lh=!1,K0=t=>{lh||(z0(),lh=!0),t.l_desc=new cl(t.dyn_ltree,D1),t.d_desc=new cl(t.dyn_dtree,N1),t.bl_desc=new cl(t.bl_tree,R1),t.bi_buf=0,t.bi_valid=0,F1(t)},U1=(t,e,r,i)=>{St(t,(L0<<1)+(i?1:0),3),M1(t),co(t,r),co(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},Z0=t=>{St(t,x1<<1,3),cr(t,tp,xr),V0(t)},J0=(t,e,r,i)=>{let n,a,o=0;t.level>0?(t.strm.data_type===$0&&(t.strm.data_type=G0(t)),$l(t,t.l_desc),$l(t,t.d_desc),o=W0(t),n=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=n&&(n=a)):n=a=r+5,r+4<=n&&e!==-1?U1(t,e,r,i):t.strategy===P0||a===n?(St(t,(x1<<1)+(i?1:0),3),sh(t,xr,Ya)):(St(t,(F0<<1)+(i?1:0),3),H0(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),sh(t,t.dyn_ltree,t.dyn_dtree)),F1(t),i&&M1(t)},Y0=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(so[r]+vo+1)*2]++,t.dyn_dtree[P1(e)*2]++),t.sym_next===t.sym_end),X0=K0,ev=U1,tv=J0,rv=Y0,iv=Z0,nv={_tr_init:X0,_tr_stored_block:ev,_tr_flush_block:tv,_tr_tally:rv,_tr_align:iv},av=(t,e,r,i)=>{let n=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},uo=av,ov=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},sv=new Uint32Array(ov()),cv=(t,e,r,i)=>{let n=sv,a=i+r;t^=-1;for(let o=i;o<a;o++)t=t>>>8^n[(t^e[o])&255];return t^-1},Ge=cv,Ji={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},sn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:uv,_tr_stored_block:Ll,_tr_flush_block:lv,_tr_tally:ti,_tr_align:pv}=nv,{Z_NO_FLUSH:ri,Z_PARTIAL_FLUSH:fv,Z_FULL_FLUSH:dv,Z_FINISH:Ut,Z_BLOCK:ph,Z_OK:rt,Z_STREAM_END:fh,Z_STREAM_ERROR:lr,Z_DATA_ERROR:hv,Z_BUF_ERROR:ll,Z_DEFAULT_COMPRESSION:mv,Z_FILTERED:gv,Z_HUFFMAN_ONLY:ws,Z_RLE:yv,Z_FIXED:vv,Z_DEFAULT_STRATEGY:bv,Z_UNKNOWN:_v,Z_DEFLATED:vc}=sn,Sv=9,wv=15,Cv=8,Ev=29,xv=256,Fl=xv+1+Ev,Av=30,kv=19,Tv=2*Fl+1,Iv=15,ue=3,Jr=258,pr=Jr+ue+1,Ov=32,zn=42,ip=57,Ml=69,Ul=73,jl=91,ql=103,Bi=113,Wa=666,dt=1,ea=2,Yi=3,ta=4,Dv=3,Vi=(t,e)=>(t.msg=Ji[e],e),dh=t=>t*2-(t>4?9:0),Zr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Nv=t=>{let e,r,i,n=t.w_size;e=t.hash_size,i=e;do r=t.head[--i],t.head[i]=r>=n?r-n:0;while(--e);e=n,i=e;do r=t.prev[--i],t.prev[i]=r>=n?r-n:0;while(--e)},Rv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,ii=Rv,At=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},Tt=(t,e)=>{lv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,At(t.strm)},ve=(t,e)=>{t.pending_buf[t.pending++]=e},Da=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Bl=(t,e,r,i)=>{let n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),r),t.state.wrap===1?t.adler=uo(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Ge(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)},j1=(t,e)=>{let r=t.max_chain_length,i=t.strstart,n,a,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-pr?t.strstart-(t.w_size-pr):0,c=t.window,l=t.w_mask,d=t.prev,f=t.strstart+Jr,p=c[i+o-1],h=c[i+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.lookahead);do if(n=e,!(c[n+o]!==h||c[n+o-1]!==p||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&i<f);if(a=Jr-(f-i),i=f-Jr,a>o){if(t.match_start=e,o=a,a>=s)break;p=c[i+o-1],h=c[i+o]}}while((e=d[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},Wn=t=>{let e=t.w_size,r,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pr)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Nv(t),i+=e),t.strm.avail_in===0)break;if(r=Bl(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=r,t.lookahead+t.insert>=ue)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=ii(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=ii(t,t.ins_h,t.window[n+ue-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<ue)););}while(t.lookahead<pr&&t.strm.avail_in!==0)},q1=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i,n,a,o=0,s=t.strm.avail_in;do{if(i=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,n=t.strstart-t.block_start,i>n+t.strm.avail_in&&(i=n+t.strm.avail_in),i>a&&(i=a),i<r&&(i===0&&e!==Ut||e===ri||i!==n+t.strm.avail_in)))break;o=e===Ut&&i===n+t.strm.avail_in?1:0,Ll(t,0,0,o),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,At(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(Bl(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?ta:e!==ri&&e!==Ut&&t.strm.avail_in===0&&t.strstart===t.block_start?ea:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Bl(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,r=a>t.w_size?t.w_size:a,n=t.strstart-t.block_start,(n>=r||(n||e===Ut)&&e!==ri&&t.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Ut&&t.strm.avail_in===0&&i===n?1:0,Ll(t,t.block_start,i,o),t.block_start+=i,At(t.strm)),o?Yi:dt)},pl=(t,e)=>{let r,i;for(;;){if(t.lookahead<pr){if(Wn(t),t.lookahead<pr&&e===ri)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=ue&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-pr&&(t.match_length=j1(t,r)),t.match_length>=ue)if(i=ti(t,t.strstart-t.match_start,t.match_length-ue),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ue){t.match_length--;do t.strstart++,t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ii(t,t.ins_h,t.window[t.strstart+1]);else i=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=t.strstart<ue-1?t.strstart:ue-1,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},$n=(t,e)=>{let r,i,n;for(;;){if(t.lookahead<pr){if(Wn(t),t.lookahead<pr&&e===ri)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=ue&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ue-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-pr&&(t.match_length=j1(t,r),t.match_length<=5&&(t.strategy===gv||t.match_length===ue&&t.strstart-t.match_start>4096)&&(t.match_length=ue-1)),t.prev_length>=ue&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-ue,i=ti(t,t.strstart-1-t.prev_match,t.prev_length-ue),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ue-1,t.strstart++,i&&(Tt(t,!1),t.strm.avail_out===0))return dt}else if(t.match_available){if(i=ti(t,0,t.window[t.strstart-1]),i&&Tt(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return dt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=ti(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ue-1?t.strstart:ue-1,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},Pv=(t,e)=>{let r,i,n,a,o=t.window;for(;;){if(t.lookahead<=Jr){if(Wn(t),t.lookahead<=Jr&&e===ri)return dt;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ue&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=t.strstart+Jr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);t.match_length=Jr-(a-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ue?(r=ti(t,1,t.match_length-ue),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},$v=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Wn(t),t.lookahead===0)){if(e===ri)return dt;break}if(t.match_length=0,r=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea};function rr(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var Ha=[new rr(0,0,0,0,q1),new rr(4,4,8,4,pl),new rr(4,5,16,8,pl),new rr(4,6,32,32,pl),new rr(4,4,16,16,$n),new rr(8,16,32,32,$n),new rr(8,16,128,128,$n),new rr(8,32,128,256,$n),new rr(32,128,258,1024,$n),new rr(32,258,258,4096,$n)],Lv=t=>{t.window_size=2*t.w_size,Zr(t.head),t.max_lazy_match=Ha[t.level].max_lazy,t.good_match=Ha[t.level].good_length,t.nice_match=Ha[t.level].nice_length,t.max_chain_length=Ha[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ue-1,t.match_available=0,t.ins_h=0};function Fv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=vc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Tv*2),this.dyn_dtree=new Uint16Array((2*Av+1)*2),this.bl_tree=new Uint16Array((2*kv+1)*2),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Iv+1),this.heap=new Uint16Array(2*Fl+1),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Fl+1),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var bo=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==zn&&e.status!==ip&&e.status!==Ml&&e.status!==Ul&&e.status!==jl&&e.status!==ql&&e.status!==Bi&&e.status!==Wa?1:0},B1=t=>{if(bo(t))return Vi(t,lr);t.total_in=t.total_out=0,t.data_type=_v;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ip:e.wrap?zn:Bi,t.adler=e.wrap===2?0:1,e.last_flush=-2,uv(e),rt},V1=t=>{let e=B1(t);return e===rt&&Lv(t.state),e},Mv=(t,e)=>bo(t)||t.state.wrap!==2?lr:(t.state.gzhead=e,rt),Q1=(t,e,r,i,n,a)=>{if(!t)return lr;let o=1;if(e===mv&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>Sv||r!==vc||i<8||i>15||e<0||e>9||a<0||a>vv||i===8&&o!==1)return Vi(t,lr);i===8&&(i=9);let s=new Fv;return t.state=s,s.strm=t,s.status=zn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ue-1)/ue),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=r,V1(t)},Uv=(t,e)=>Q1(t,e,vc,wv,Cv,bv),jv=(t,e)=>{if(bo(t)||e>ph||e<0)return t?Vi(t,lr):lr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===Wa&&e!==Ut)return Vi(t,t.avail_out===0?ll:lr);let i=r.last_flush;if(r.last_flush=e,r.pending!==0){if(At(t),t.avail_out===0)return r.last_flush=-1,rt}else if(t.avail_in===0&&dh(e)<=dh(i)&&e!==Ut)return Vi(t,ll);if(r.status===Wa&&t.avail_in!==0)return Vi(t,ll);if(r.status===zn&&r.wrap===0&&(r.status=Bi),r.status===zn){let n=vc+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=ws||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,n|=a<<6,r.strstart!==0&&(n|=Ov),n+=31-n%31,Da(r,n),r.strstart!==0&&(Da(r,t.adler>>>16),Da(r,t.adler&65535)),t.adler=1,r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===ip){if(t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead)ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=ws||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ge(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Ml;else if(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=ws||r.level<2?4:0),ve(r,Dv),r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===Ml){if(r.gzhead.extra){let n=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let s=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex+=s,At(t),r.pending!==0)return r.last_flush=-1,rt;n=0,a-=s}let o=new Uint8Array(r.gzhead.extra);r.pending_buf.set(o.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=Ul}if(r.status===Ul){if(r.gzhead.name){let n=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),At(t),r.pending!==0)return r.last_flush=-1,rt;n=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,ve(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=jl}if(r.status===jl){if(r.gzhead.comment){let n=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),At(t),r.pending!==0)return r.last_flush=-1,rt;n=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,ve(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n))}r.status=ql}if(r.status===ql){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(At(t),r.pending!==0))return r.last_flush=-1,rt;ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0}if(r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(t.avail_in!==0||r.lookahead!==0||e!==ri&&r.status!==Wa){let n=r.level===0?q1(r,e):r.strategy===ws?$v(r,e):r.strategy===yv?Pv(r,e):Ha[r.level].func(r,e);if((n===Yi||n===ta)&&(r.status=Wa),n===dt||n===Yi)return t.avail_out===0&&(r.last_flush=-1),rt;if(n===ea&&(e===fv?pv(r):e!==ph&&(Ll(r,0,0,!1),e===dv&&(Zr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),At(t),t.avail_out===0))return r.last_flush=-1,rt}return e!==Ut?rt:r.wrap<=0?fh:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Da(r,t.adler>>>16),Da(r,t.adler&65535)),At(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?rt:fh)},qv=t=>{if(bo(t))return lr;let e=t.state.status;return t.state=null,e===Bi?Vi(t,hv):rt},Bv=(t,e)=>{let r=e.length;if(bo(t))return lr;let i=t.state,n=i.wrap;if(n===2||n===1&&i.status!==zn||i.lookahead)return lr;if(n===1&&(t.adler=uo(t.adler,e,r,0)),i.wrap=0,r>=i.w_size){n===0&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let u=new Uint8Array(i.w_size);u.set(e.subarray(r-i.w_size,r),0),e=u,r=i.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Wn(i);i.lookahead>=ue;){let u=i.strstart,c=i.lookahead-(ue-1);do i.ins_h=ii(i,i.ins_h,i.window[u+ue-1]),i.prev[u&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=u,u++;while(--c);i.strstart=u,i.lookahead=ue-1,Wn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ue-1,i.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,i.wrap=n,rt},Vv=Uv,Qv=Q1,zv=V1,Wv=B1,Hv=Mv,Gv=jv,Kv=qv,Zv=Bv,Jv="pako deflate (from Nodeca project)",Xa={deflateInit:Vv,deflateInit2:Qv,deflateReset:zv,deflateResetKeep:Wv,deflateSetHeader:Hv,deflate:Gv,deflateEnd:Kv,deflateSetDictionary:Zv,deflateInfo:Jv},Yv=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Xv=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let i in r)Yv(r,i)&&(t[i]=r[i])}}return t},e2=t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;let r=new Uint8Array(e);for(let i=0,n=0,a=t.length;i<a;i++){let o=t[i];r.set(o,n),n+=o.length}return r},bc={assign:Xv,flattenChunks:e2},z1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){z1=!1}var lo=new Uint8Array(256);for(let t=0;t<256;t++)lo[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;lo[254]=lo[254]=1;var t2=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,i,n,a,o=t.length,s=0;for(n=0;n<o;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e},r2=(t,e)=>{if(e<65534&&t.subarray&&z1)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r},i2=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let i,n,a=new Array(r*2);for(n=0,i=0;i<r;){let o=t[i++];if(o<128){a[n++]=o;continue}let s=lo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<r;)o=o<<6|t[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return r2(a,n)},n2=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+lo[t[r]]>e?r:e},po={string2buf:t2,buf2string:i2,utf8border:n2};function a2(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var W1=a2,H1=Object.prototype.toString,{Z_NO_FLUSH:o2,Z_SYNC_FLUSH:s2,Z_FULL_FLUSH:c2,Z_FINISH:u2,Z_OK:oc,Z_STREAM_END:l2,Z_DEFAULT_COMPRESSION:p2,Z_DEFAULT_STRATEGY:f2,Z_DEFLATED:d2}=sn;function _o(t){this.options=bc.assign({level:p2,method:d2,chunkSize:16384,windowBits:15,memLevel:8,strategy:f2},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new W1,this.strm.avail_out=0;let r=Xa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==oc)throw new Error(Ji[r]);if(e.header&&Xa.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=po.string2buf(e.dictionary):H1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Xa.deflateSetDictionary(this.strm,i),r!==oc)throw new Error(Ji[r]);this._dict_set=!0}}_o.prototype.push=function(t,e){let r=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?u2:o2,typeof t=="string"?r.input=po.string2buf(t):H1.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(a===s2||a===c2)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(n=Xa.deflate(r,a),n===l2)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Xa.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===oc;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};_o.prototype.onData=function(t){this.chunks.push(t)};_o.prototype.onEnd=function(t){t===oc&&(this.result=bc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function np(t,e){let r=new _o(e);if(r.push(t,!0),r.err)throw r.msg||Ji[r.err];return r.result}function h2(t,e){return e=e||{},e.raw=!0,np(t,e)}function m2(t,e){return e=e||{},e.gzip=!0,np(t,e)}var g2=_o,y2=np,v2=h2,b2=m2,_2=sn,S2={Deflate:g2,deflate:y2,deflateRaw:v2,gzip:b2,constants:_2},Cs=16209,w2=16191,C2=function t(e,r){let i,n,a,o,s,u,c,l,d,f,p,h,m,b,_,S,w,v,D,N,A,R,F,P,j=e.state;i=e.next_in,F=e.input,n=i+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),u=j.dmax,c=j.wsize,l=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,b=j.distcode,_=(1<<j.lenbits)-1,S=(1<<j.distbits)-1;e:do{h<15&&(p+=F[i++]<<h,h+=8,p+=F[i++]<<h,h+=8),w=m[p&_];t:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v===0)P[a++]=w&65535;else if(v&16){D=w&65535,v&=15,v&&(h<v&&(p+=F[i++]<<h,h+=8),D+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=F[i++]<<h,h+=8,p+=F[i++]<<h,h+=8),w=b[p&S];r:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v&16){if(N=w&65535,v&=15,h<v&&(p+=F[i++]<<h,h+=8,h<v&&(p+=F[i++]<<h,h+=8)),N+=p&(1<<v)-1,N>u){e.msg="invalid distance too far back",j.mode=Cs;break e}if(p>>>=v,h-=v,v=a-o,N>v){if(v=N-v,v>l&&j.sane){e.msg="invalid distance too far back",j.mode=Cs;break e}if(A=0,R=f,d===0){if(A+=c-v,v<D){D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}}else if(d<v){if(A+=c+d-v,v-=d,v<D){D-=v;do P[a++]=f[A++];while(--v);if(A=0,d<D){v=d,D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}}}else if(A+=d-v,v<D){D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}for(;D>2;)P[a++]=R[A++],P[a++]=R[A++],P[a++]=R[A++],D-=3;D&&(P[a++]=R[A++],D>1&&(P[a++]=R[A++]))}else{A=a-N;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],D-=3;while(D>2);D&&(P[a++]=P[A++],D>1&&(P[a++]=P[A++]))}}else if((v&64)===0){w=b[(w&65535)+(p&(1<<v)-1)];continue r}else{e.msg="invalid distance code",j.mode=Cs;break e}break}}else if((v&64)===0){w=m[(w&65535)+(p&(1<<v)-1)];continue t}else if(v&32){j.mode=w2;break e}else{e.msg="invalid literal/length code",j.mode=Cs;break e}break}}while(i<n&&a<s);D=h>>3,i-=D,h-=D<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Ln=15,hh=852,mh=592,gh=0,fl=1,yh=2,E2=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),x2=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),A2=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),k2=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),T2=(t,e,r,i,n,a,o,s)=>{let u=s.bits,c=0,l=0,d=0,f=0,p=0,h=0,m=0,b=0,_=0,S=0,w,v,D,N,A,R=null,F,P=new Uint16Array(Ln+1),j=new Uint16Array(Ln+1),Je=null,je,H,we;for(c=0;c<=Ln;c++)P[c]=0;for(l=0;l<i;l++)P[e[r+l]]++;for(p=u,f=Ln;f>=1&&P[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&P[d]===0;d++);for(p<d&&(p=d),b=1,c=1;c<=Ln;c++)if(b<<=1,b-=P[c],b<0)return-1;if(b>0&&(t===gh||f!==1))return-1;for(j[1]=0,c=1;c<Ln;c++)j[c+1]=j[c]+P[c];for(l=0;l<i;l++)e[r+l]!==0&&(o[j[e[r+l]]++]=l);if(t===gh?(R=Je=o,F=20):t===fl?(R=E2,Je=x2,F=257):(R=A2,Je=k2,F=0),S=0,l=0,c=d,A=a,h=p,m=0,D=-1,_=1<<p,N=_-1,t===fl&&_>hh||t===yh&&_>mh)return 1;for(;;){je=c-m,o[l]+1<F?(H=0,we=o[l]):o[l]>=F?(H=Je[o[l]-F],we=R[o[l]-F]):(H=32+64,we=0),w=1<<c-m,v=1<<h,d=v;do v-=w,n[A+(S>>m)+v]=je<<24|H<<16|we|0;while(v!==0);for(w=1<<c-1;S&w;)w>>=1;if(w!==0?(S&=w-1,S+=w):S=0,l++,--P[c]===0){if(c===f)break;c=e[r+o[l]]}if(c>p&&(S&N)!==D){for(m===0&&(m=p),A+=d,h=c-m,b=1<<h;h+m<f&&(b-=P[h+m],!(b<=0));)h++,b<<=1;if(_+=1<<h,t===fl&&_>hh||t===yh&&_>mh)return 1;D=S&N,n[D]=p<<24|h<<16|A-a|0}}return S!==0&&(n[A+S]=c-m<<24|64<<16|0),s.bits=p,0},eo=T2,I2=0,G1=1,K1=2,{Z_FINISH:vh,Z_BLOCK:O2,Z_TREES:Es,Z_OK:Xi,Z_STREAM_END:D2,Z_NEED_DICT:N2,Z_STREAM_ERROR:jt,Z_DATA_ERROR:Z1,Z_MEM_ERROR:J1,Z_BUF_ERROR:R2,Z_DEFLATED:bh}=sn,_c=16180,_h=16181,Sh=16182,wh=16183,Ch=16184,Eh=16185,xh=16186,Ah=16187,kh=16188,Th=16189,sc=16190,Sr=16191,dl=16192,Ih=16193,hl=16194,Oh=16195,Dh=16196,Nh=16197,Rh=16198,xs=16199,As=16200,Ph=16201,$h=16202,Lh=16203,Fh=16204,Mh=16205,ml=16206,Uh=16207,jh=16208,Te=16209,Y1=16210,X1=16211,P2=852,$2=592,L2=15,F2=L2,qh=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function M2(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var cn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<_c||e.mode>X1?1:0},em=t=>{if(cn(t))return jt;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=_c,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(P2),e.distcode=e.distdyn=new Int32Array($2),e.sane=1,e.back=-1,Xi},tm=t=>{if(cn(t))return jt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,em(t)},rm=(t,e)=>{let r;if(cn(t))return jt;let i=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,tm(t))},im=(t,e)=>{if(!t)return jt;let r=new M2;t.state=r,r.strm=t,r.window=null,r.mode=_c;let i=rm(t,e);return i!==Xi&&(t.state=null),i},U2=t=>im(t,F2),Bh=!0,gl,yl,j2=t=>{if(Bh){gl=new Int32Array(512),yl=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(eo(G1,t.lens,0,288,gl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;eo(K1,t.lens,0,32,yl,0,t.work,{bits:5}),Bh=!1}t.lencode=gl,t.lenbits=9,t.distcode=yl,t.distbits=5},nm=(t,e,r,i)=>{let n,a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(r-i,r-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(r-i,r),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},q2=(t,e)=>{let r,i,n,a,o,s,u,c,l,d,f,p,h,m,b=0,_,S,w,v,D,N,A,R,F=new Uint8Array(4),P,j,Je=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cn(t)||!t.output||!t.input&&t.avail_in!==0)return jt;r=t.state,r.mode===Sr&&(r.mode=dl),o=t.next_out,n=t.output,u=t.avail_out,a=t.next_in,i=t.input,s=t.avail_in,c=r.hold,l=r.bits,d=s,f=u,R=Xi;e:for(;;)switch(r.mode){case _c:if(r.wrap===0){r.mode=dl;break}for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&2&&c===35615){r.wbits===0&&(r.wbits=15),r.check=0,F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0),c=0,l=0,r.mode=_h;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=Te;break}if((c&15)!==bh){t.msg="unknown compression method",r.mode=Te;break}if(c>>>=4,l-=4,A=(c&15)+8,r.wbits===0&&(r.wbits=A),A>15||A>r.wbits){t.msg="invalid window size",r.mode=Te;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?Th:Sr,c=0,l=0;break;case _h:for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==bh){t.msg="unknown compression method",r.mode=Te;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Te;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0,r.mode=Sh;case Sh:for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.head&&(r.head.time=c),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,F[2]=c>>>16&255,F[3]=c>>>24&255,r.check=Ge(r.check,F,4,0)),c=0,l=0,r.mode=wh;case wh:for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0,r.mode=Ch;case Ch:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=Eh;case Eh:if(r.flags&1024&&(p=r.length,p>s&&(p=s),p&&(r.head&&(A=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(a,a+p),A)),r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=xh;case xh:if(r.flags&2048){if(s===0)break e;p=0;do A=i[a+p++],r.head&&A&&r.length<65536&&(r.head.name+=String.fromCharCode(A));while(A&&p<s);if(r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Ah;case Ah:if(r.flags&4096){if(s===0)break e;p=0;do A=i[a+p++],r.head&&A&&r.length<65536&&(r.head.comment+=String.fromCharCode(A));while(A&&p<s);if(r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.comment=null);r.mode=kh;case kh:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Te;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Sr;break;case Th:for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}t.adler=r.check=qh(c),c=0,l=0,r.mode=sc;case sc:if(r.havedict===0)return t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,N2;t.adler=r.check=1,r.mode=Sr;case Sr:if(e===O2||e===Es)break e;case dl:if(r.last){c>>>=l&7,l-=l&7,r.mode=ml;break}for(;l<3;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}switch(r.last=c&1,c>>>=1,l-=1,c&3){case 0:r.mode=Ih;break;case 1:if(j2(r),r.mode=xs,e===Es){c>>>=2,l-=2;break e}break;case 2:r.mode=Dh;break;case 3:t.msg="invalid block type",r.mode=Te}c>>>=2,l-=2;break;case Ih:for(c>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Te;break}if(r.length=c&65535,c=0,l=0,r.mode=hl,e===Es)break e;case hl:r.mode=Oh;case Oh:if(p=r.length,p){if(p>s&&(p=s),p>u&&(p=u),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,u-=p,o+=p,r.length-=p;break}r.mode=Sr;break;case Dh:for(;l<14;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.nlen=(c&31)+257,c>>>=5,l-=5,r.ndist=(c&31)+1,c>>>=5,l-=5,r.ncode=(c&15)+4,c>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Te;break}r.have=0,r.mode=Nh;case Nh:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.lens[Je[r.have++]]=c&7,c>>>=3,l-=3}for(;r.have<19;)r.lens[Je[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},R=eo(I2,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid code lengths set",r.mode=Te;break}r.have=0,r.mode=Rh;case Rh:for(;r.have<r.nlen+r.ndist;){for(;b=r.lencode[c&(1<<r.lenbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(w<16)c>>>=_,l-=_,r.lens[r.have++]=w;else{if(w===16){for(j=_+2;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(c>>>=_,l-=_,r.have===0){t.msg="invalid bit length repeat",r.mode=Te;break}A=r.lens[r.have-1],p=3+(c&3),c>>>=2,l-=2}else if(w===17){for(j=_+3;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=_,l-=_,A=0,p=3+(c&7),c>>>=3,l-=3}else{for(j=_+7;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=_,l-=_,A=0,p=11+(c&127),c>>>=7,l-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Te;break}for(;p--;)r.lens[r.have++]=A}}if(r.mode===Te)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Te;break}if(r.lenbits=9,P={bits:r.lenbits},R=eo(G1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid literal/lengths set",r.mode=Te;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},R=eo(K1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,R){t.msg="invalid distances set",r.mode=Te;break}if(r.mode=xs,e===Es)break e;case xs:r.mode=As;case As:if(s>=6&&u>=258){t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,C2(t,f),o=t.next_out,n=t.output,u=t.avail_out,a=t.next_in,i=t.input,s=t.avail_in,c=r.hold,l=r.bits,r.mode===Sr&&(r.back=-1);break}for(r.back=0;b=r.lencode[c&(1<<r.lenbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(S&&(S&240)===0){for(v=_,D=S,N=w;b=r.lencode[N+((c&(1<<v+D)-1)>>v)],_=b>>>24,S=b>>>16&255,w=b&65535,!(v+_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=v,l-=v,r.back+=v}if(c>>>=_,l-=_,r.back+=_,r.length=w,S===0){r.mode=Mh;break}if(S&32){r.back=-1,r.mode=Sr;break}if(S&64){t.msg="invalid literal/length code",r.mode=Te;break}r.extra=S&15,r.mode=Ph;case Ph:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=$h;case $h:for(;b=r.distcode[c&(1<<r.distbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if((S&240)===0){for(v=_,D=S,N=w;b=r.distcode[N+((c&(1<<v+D)-1)>>v)],_=b>>>24,S=b>>>16&255,w=b&65535,!(v+_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=v,l-=v,r.back+=v}if(c>>>=_,l-=_,r.back+=_,S&64){t.msg="invalid distance code",r.mode=Te;break}r.offset=w,r.extra=S&15,r.mode=Lh;case Lh:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Te;break}r.mode=Fh;case Fh:if(u===0)break e;if(p=f-u,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Te;break}p>r.wnext?(p-=r.wnext,h=r.wsize-p):h=r.wnext-p,p>r.length&&(p=r.length),m=r.window}else m=n,h=o-r.offset,p=r.length;p>u&&(p=u),u-=p,r.length-=p;do n[o++]=m[h++];while(--p);r.length===0&&(r.mode=As);break;case Mh:if(u===0)break e;n[o++]=r.length,u--,r.mode=As;break;case ml:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=i[a++]<<l,l+=8}if(f-=u,t.total_out+=f,r.total+=f,r.wrap&4&&f&&(t.adler=r.check=r.flags?Ge(r.check,n,f,o-f):uo(r.check,n,f,o-f)),f=u,r.wrap&4&&(r.flags?c:qh(c))!==r.check){t.msg="incorrect data check",r.mode=Te;break}c=0,l=0}r.mode=Uh;case Uh:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Te;break}c=0,l=0}r.mode=jh;case jh:R=D2;break e;case Te:R=Z1;break e;case Y1:return J1;case X1:default:return jt}return t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<Te&&(r.mode<ml||e!==vh))&&nm(t,t.output,t.next_out,f-t.avail_out),d-=t.avail_in,f-=t.avail_out,t.total_in+=d,t.total_out+=f,r.total+=f,r.wrap&4&&f&&(t.adler=r.check=r.flags?Ge(r.check,n,f,t.next_out-f):uo(r.check,n,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Sr?128:0)+(r.mode===xs||r.mode===hl?256:0),(d===0&&f===0||e===vh)&&R===Xi&&(R=R2),R},B2=t=>{if(cn(t))return jt;let e=t.state;return e.window&&(e.window=null),t.state=null,Xi},V2=(t,e)=>{if(cn(t))return jt;let r=t.state;return(r.wrap&2)===0?jt:(r.head=e,e.done=!1,Xi)},Q2=(t,e)=>{let r=e.length,i,n,a;return cn(t)||(i=t.state,i.wrap!==0&&i.mode!==sc)?jt:i.mode===sc&&(n=1,n=uo(n,e,r,0),n!==i.check)?Z1:(a=nm(t,e,r,r),a?(i.mode=Y1,J1):(i.havedict=1,Xi))},z2=tm,W2=rm,H2=em,G2=U2,K2=im,Z2=q2,J2=B2,Y2=V2,X2=Q2,e3="pako inflate (from Nodeca project)",Ar={inflateReset:z2,inflateReset2:W2,inflateResetKeep:H2,inflateInit:G2,inflateInit2:K2,inflate:Z2,inflateEnd:J2,inflateGetHeader:Y2,inflateSetDictionary:X2,inflateInfo:e3};function t3(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var r3=t3,am=Object.prototype.toString,{Z_NO_FLUSH:i3,Z_FINISH:n3,Z_OK:fo,Z_STREAM_END:vl,Z_NEED_DICT:bl,Z_STREAM_ERROR:a3,Z_DATA_ERROR:Vh,Z_MEM_ERROR:o3}=sn;function So(t){this.options=bc.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new W1,this.strm.avail_out=0;let r=Ar.inflateInit2(this.strm,e.windowBits);if(r!==fo)throw new Error(Ji[r]);if(this.header=new r3,Ar.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=po.string2buf(e.dictionary):am.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Ar.inflateSetDictionary(this.strm,e.dictionary),r!==fo)))throw new Error(Ji[r])}So.prototype.push=function(t,e){let r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?n3:i3,am.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),a=Ar.inflate(r,o),a===bl&&n&&(a=Ar.inflateSetDictionary(r,n),a===fo?a=Ar.inflate(r,o):a===Vh&&(a=bl));r.avail_in>0&&a===vl&&r.state.wrap>0&&t[r.next_in]!==0;)Ar.inflateReset(r),a=Ar.inflate(r,o);switch(a){case a3:case Vh:case bl:case o3:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===vl))if(this.options.to==="string"){let u=po.utf8border(r.output,r.next_out),c=r.next_out-u,l=po.buf2string(r.output,u);r.next_out=c,r.avail_out=i-c,c&&r.output.set(r.output.subarray(u,u+c),0),this.onData(l)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===fo&&s===0)){if(a===vl)return a=Ar.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};So.prototype.onData=function(t){this.chunks.push(t)};So.prototype.onEnd=function(t){t===fo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=bc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ap(t,e){let r=new So(e);if(r.push(t),r.err)throw r.msg||Ji[r.err];return r.result}function s3(t,e){return e=e||{},e.raw=!0,ap(t,e)}var c3=So,u3=ap,l3=s3,p3=ap,f3=sn,d3={Inflate:c3,inflate:u3,inflateRaw:l3,ungzip:p3,constants:f3},{Deflate:h3,deflate:m3,deflateRaw:g3,gzip:y3}=S2,{Inflate:v3,inflate:b3,inflateRaw:_3,ungzip:S3}=d3,w3=h3,C3=m3,E3=g3,x3=y3,A3=v3,k3=b3,T3=_3,I3=S3,O3=sn,D3={Deflate:w3,deflate:C3,deflateRaw:E3,gzip:x3,Inflate:A3,inflate:k3,inflateRaw:T3,ungzip:I3,constants:O3},xe=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Ae=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},cc=class{constructor(e,r){this.input=e,this.output=r}};xe([g(),Ae("design:type",String)],cc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],cc.prototype,"output",void 0);cc=xe([Ze(),Ae("design:paramtypes",[String,String])],cc);var uc=class{constructor(e,r){this.input=e,this.output=r}};xe([g(),Ae("design:type",String)],uc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],uc.prototype,"output",void 0);uc=xe([G(),Ae("design:paramtypes",[String,String])],uc);var si=class{constructor(e,r,i,n,a){this.name=e,this.modelId=r,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};xe([g(),Ae("design:type",String)],si.prototype,"name",void 0);xe([g(),Ae("design:type",String)],si.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],si.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],si.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],si.prototype,"metaData",void 0);si=xe([Ze(),Ae("design:paramtypes",[String,String,String,Array,String])],si);var hr=class{constructor(e,r,i,n,a,o,s,u){this.name=e,this.modelId=r,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=u}};xe([g(),Ae("design:type",String)],hr.prototype,"name",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"taskId",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],hr.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"metaData",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"createdAt",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"updatedAt",void 0);hr=xe([G(),Ae("design:paramtypes",[String,String,String,String,Array,String,String,String])],hr);var en=class{constructor(e,r,i,n,a){this.model=e,this.status=r,this.progress=i,this.downloaded=n,this.loaded=a}};xe([g(),Ae("design:type",String)],en.prototype,"model",void 0);xe([g(),Ae("design:type",String)],en.prototype,"status",void 0);xe([g(),Ae("design:type",Number)],en.prototype,"progress",void 0);xe([g(),Ae("design:type",Boolean)],en.prototype,"downloaded",void 0);xe([g(),Ae("design:type",Boolean)],en.prototype,"loaded",void 0);en=xe([G(),Ae("design:paramtypes",[String,String,Number,Boolean,Boolean])],en);var N3=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},ze=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ve,js,Vl=class{constructor(e,r=!0){Ve.set(this,void 0),js.set(this,new Map),N3(this,Ve,e,"f")}async getModels(){let e=await ze(this,Ve,"f").query({query:E`
|
|
744
|
+
}`,variables:{url:e,interactionCall:t}}));return i}};Cr=new WeakMap;var vc={};vc.byteLength=I0;vc.toByteArray=D0;vc.fromByteArray=$0;var or=[],Ft=[],T0=typeof Uint8Array<"u"?Uint8Array:Array,ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ii=0,nh=ou.length;Ii<nh;++Ii)or[Ii]=ou[Ii],Ft[ou.charCodeAt(Ii)]=Ii;var Ii,nh;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function x1(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function I0(r){var e=x1(r),t=e[0],i=e[1];return(t+i)*3/4-i}function O0(r,e,t){return(e+t)*3/4-t}function D0(r){var e,t=x1(r),i=t[0],n=t[1],a=new T0(O0(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Ft[r.charCodeAt(c)]<<18|Ft[r.charCodeAt(c+1)]<<12|Ft[r.charCodeAt(c+2)]<<6|Ft[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Ft[r.charCodeAt(c)]<<2|Ft[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Ft[r.charCodeAt(c)]<<10|Ft[r.charCodeAt(c+1)]<<4|Ft[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function N0(r){return or[r>>18&63]+or[r>>12&63]+or[r>>6&63]+or[r&63]}function R0(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(N0(i));return n.join("")}function $0(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(R0(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(or[e>>2]+or[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(or[e>>10]+or[e>>4&63]+or[e<<2&63]+"=")),n.join("")}var P0=4,ah=0,oh=1,L0=2;function Xn(r){let e=r.length;for(;--e>=0;)r[e]=0}var F0=0,A1=1,M0=2,U0=3,j0=258,ep=29,_o=256,so=_o+1+ep,qn=30,tp=19,k1=2*so+1,ji=15,su=16,q0=7,rp=256,T1=16,I1=17,O1=18,Pu=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),qs=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),B0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),D1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),V0=512,Er=new Array((so+2)*2);Xn(Er);var Xa=new Array(qn*2);Xn(Xa);var co=new Array(V0);Xn(co);var lo=new Array(j0-U0+1);Xn(lo);var ip=new Array(ep);Xn(ip);var oc=new Array(qn);Xn(oc);function cu(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var N1,R1,$1;function lu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var P1=r=>r<256?co[r]:co[256+(r>>>7)],uo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},wt=(r,e,t)=>{r.bi_valid>su-t?(r.bi_buf|=e<<r.bi_valid&65535,uo(r,r.bi_buf),r.bi_buf=e>>su-r.bi_valid,r.bi_valid+=t-su):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},sr=(r,e,t)=>{wt(r,t[e*2],t[e*2+1])},L1=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Q0=r=>{r.bi_valid===16?(uo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},z0=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,u,d,f,p,h,m=0;for(f=0;f<=ji;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;l<k1;l++)u=r.heap[l],f=t[t[u*2+1]*2+1]+1,f>c&&(f=c,m++),t[u*2+1]=f,!(u>i)&&(r.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),h=t[u*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[u*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(u=r.bl_count[f];u!==0;)d=r.heap[--l],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),u--)}},F1=(r,e,t)=>{let i=new Array(ji+1),n=0,a,o;for(a=1;a<=ji;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=L1(i[s]++,s))}},W0=()=>{let r,e,t,i,n,a=new Array(ji+1);for(t=0,i=0;i<ep-1;i++)for(ip[i]=t,r=0;r<1<<Pu[i];r++)lo[t++]=i;for(lo[t-1]=i,n=0,i=0;i<16;i++)for(oc[i]=n,r=0;r<1<<qs[i];r++)co[n++]=i;for(n>>=7;i<qn;i++)for(oc[i]=n<<7,r=0;r<1<<qs[i]-7;r++)co[256+n++]=i;for(e=0;e<=ji;e++)a[e]=0;for(r=0;r<=143;)Er[r*2+1]=8,r++,a[8]++;for(;r<=255;)Er[r*2+1]=9,r++,a[9]++;for(;r<=279;)Er[r*2+1]=7,r++,a[7]++;for(;r<=287;)Er[r*2+1]=8,r++,a[8]++;for(F1(Er,so+1,a),r=0;r<qn;r++)Xa[r*2+1]=5,Xa[r*2]=L1(r,5);N1=new cu(Er,Pu,_o+1,so,ji),R1=new cu(Xa,qs,0,qn,ji),$1=new cu(new Array(0),B0,0,tp,q0)},M1=r=>{let e;for(e=0;e<so;e++)r.dyn_ltree[e*2]=0;for(e=0;e<qn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<tp;e++)r.bl_tree[e*2]=0;r.dyn_ltree[rp*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},U1=r=>{r.bi_valid>8?uo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},sh=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},uu=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&sh(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!sh(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},ch=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?sr(r,n,e):(o=lo[n],sr(r,o+_o+1,e),s=Pu[o],s!==0&&(n-=ip[o],wt(r,n,s)),i--,o=P1(i),sr(r,o,t),s=qs[o],s!==0&&(i-=oc[o],wt(r,i,s)));while(a<r.sym_next);sr(r,rp,e)},Lu=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,l;for(r.heap_len=0,r.heap_max=k1,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=c<2?++c:0,t[l*2]=1,r.depth[l]=0,r.opt_len--,n&&(r.static_len-=i[l*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)uu(r,t,o);l=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],uu(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[l*2]=t[o*2]+t[s*2],r.depth[l]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=l,r.heap[1]=l++,uu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],z0(r,e),F1(t,c,r.bl_count)},lh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[T1*2]++):s<=10?r.bl_tree[I1*2]++:r.bl_tree[O1*2]++,s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},uh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do sr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(sr(r,a,r.bl_tree),s--),sr(r,T1,r.bl_tree),wt(r,s-3,2)):s<=10?(sr(r,I1,r.bl_tree),wt(r,s-3,3)):(sr(r,O1,r.bl_tree),wt(r,s-11,7));s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},H0=r=>{let e;for(lh(r,r.dyn_ltree,r.l_desc.max_code),lh(r,r.dyn_dtree,r.d_desc.max_code),Lu(r,r.bl_desc),e=tp-1;e>=3&&r.bl_tree[D1[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},G0=(r,e,t,i)=>{let n;for(wt(r,e-257,5),wt(r,t-1,5),wt(r,i-4,4),n=0;n<i;n++)wt(r,r.bl_tree[D1[n]*2+1],3);uh(r,r.dyn_ltree,e-1),uh(r,r.dyn_dtree,t-1)},K0=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return ah;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return oh;for(t=32;t<_o;t++)if(r.dyn_ltree[t*2]!==0)return oh;return ah},ph=!1,Z0=r=>{ph||(W0(),ph=!0),r.l_desc=new lu(r.dyn_ltree,N1),r.d_desc=new lu(r.dyn_dtree,R1),r.bl_desc=new lu(r.bl_tree,$1),r.bi_buf=0,r.bi_valid=0,M1(r)},j1=(r,e,t,i)=>{wt(r,(F0<<1)+(i?1:0),3),U1(r),uo(r,t),uo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},J0=r=>{wt(r,A1<<1,3),sr(r,rp,Er),Q0(r)},Y0=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===L0&&(r.strm.data_type=K0(r)),Lu(r,r.l_desc),Lu(r,r.d_desc),o=H0(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?j1(r,e,t,i):r.strategy===P0||a===n?(wt(r,(A1<<1)+(i?1:0),3),ch(r,Er,Xa)):(wt(r,(M0<<1)+(i?1:0),3),G0(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),ch(r,r.dyn_ltree,r.dyn_dtree)),M1(r),i&&U1(r)},X0=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(lo[t]+_o+1)*2]++,r.dyn_dtree[P1(e)*2]++),r.sym_next===r.sym_end),ev=Z0,tv=j1,rv=Y0,iv=X0,nv=J0,av={_tr_init:ev,_tr_stored_block:tv,_tr_flush_block:rv,_tr_tally:iv,_tr_align:nv},ov=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},po=ov,sv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},cv=new Uint32Array(sv()),lv=(r,e,t,i)=>{let n=cv,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ke=lv,Zi={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},on={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:uv,_tr_stored_block:Fu,_tr_flush_block:pv,_tr_tally:ei,_tr_align:fv}=av,{Z_NO_FLUSH:ti,Z_PARTIAL_FLUSH:dv,Z_FULL_FLUSH:hv,Z_FINISH:Ut,Z_BLOCK:fh,Z_OK:at,Z_STREAM_END:dh,Z_STREAM_ERROR:lr,Z_DATA_ERROR:mv,Z_BUF_ERROR:pu,Z_DEFAULT_COMPRESSION:gv,Z_FILTERED:yv,Z_HUFFMAN_ONLY:Es,Z_RLE:vv,Z_FIXED:bv,Z_DEFAULT_STRATEGY:_v,Z_UNKNOWN:Sv,Z_DEFLATED:bc}=on,wv=9,Cv=15,Ev=8,xv=29,Av=256,Mu=Av+1+xv,kv=30,Tv=19,Iv=2*Mu+1,Ov=15,ce=3,Kr=258,ur=Kr+ce+1,Dv=32,zn=42,np=57,Uu=69,ju=73,qu=91,Bu=103,qi=113,Wa=666,mt=1,ea=2,Ji=3,ta=4,Nv=3,Bi=(r,e)=>(r.msg=Zi[e],e),hh=r=>r*2-(r>4?9:0),Gr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Rv=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},$v=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ri=$v,At=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Tt=(r,e)=>{pv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,At(r.strm)},be=(r,e)=>{r.pending_buf[r.pending++]=e},Da=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Vu=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=po(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ke(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},q1=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-ur?r.strstart-(r.w_size-ur):0,l=r.window,u=r.w_mask,d=r.prev,f=r.strstart+Kr,p=l[i+o-1],h=l[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(l[n+o]!==h||l[n+o-1]!==p||l[n]!==l[i]||l[++n]!==l[i+1])){i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<f);if(a=Kr-(f-i),i=f-Kr,a>o){if(r.match_start=e,o=a,a>=s)break;p=l[i+o-1],h=l[i+o]}}while((e=d[e&u])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Wn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-ur)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Rv(r),i+=e),r.strm.avail_in===0)break;if(t=Vu(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=ce)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ri(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ri(r,r.ins_h,r.window[n+ce-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<ce)););}while(r.lookahead<ur&&r.strm.avail_in!==0)},B1=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Ut||e===ti||i!==n+r.strm.avail_in)))break;o=e===Ut&&i===n+r.strm.avail_in?1:0,Fu(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,At(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Vu(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?ta:e!==ti&&e!==Ut&&r.strm.avail_in===0&&r.strstart===r.block_start?ea:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Vu(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Ut)&&e!==ti&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Ut&&r.strm.avail_in===0&&i===n?1:0,Fu(r,r.block_start,i,o),r.block_start+=i,At(r.strm)),o?Ji:mt)},fu=(r,e)=>{let t,i;for(;;){if(r.lookahead<ur){if(Wn(r),r.lookahead<ur&&e===ti)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-ur&&(r.match_length=q1(r,t)),r.match_length>=ce)if(i=ei(r,r.strstart-r.match_start,r.match_length-ce),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ce){r.match_length--;do r.strstart++,r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ri(r,r.ins_h,r.window[r.strstart+1]);else i=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},$n=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<ur){if(Wn(r),r.lookahead<ur&&e===ti)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ce-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-ur&&(r.match_length=q1(r,t),r.match_length<=5&&(r.strategy===yv||r.match_length===ce&&r.strstart-r.match_start>4096)&&(r.match_length=ce-1)),r.prev_length>=ce&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-ce,i=ei(r,r.strstart-1-r.prev_match,r.prev_length-ce),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ce-1,r.strstart++,i&&(Tt(r,!1),r.strm.avail_out===0))return mt}else if(r.match_available){if(i=ei(r,0,r.window[r.strstart-1]),i&&Tt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return mt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ei(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},Pv=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Kr){if(Wn(r),r.lookahead<=Kr&&e===ti)return mt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ce&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Kr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Kr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ce?(t=ei(r,1,r.match_length-ce),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},Lv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Wn(r),r.lookahead===0)){if(e===ti)return mt;break}if(r.match_length=0,t=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea};function rr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Ha=[new rr(0,0,0,0,B1),new rr(4,4,8,4,fu),new rr(4,5,16,8,fu),new rr(4,6,32,32,fu),new rr(4,4,16,16,$n),new rr(8,16,32,32,$n),new rr(8,16,128,128,$n),new rr(8,32,128,256,$n),new rr(32,128,258,1024,$n),new rr(32,258,258,4096,$n)],Fv=r=>{r.window_size=2*r.w_size,Gr(r.head),r.max_lazy_match=Ha[r.level].max_lazy,r.good_match=Ha[r.level].good_length,r.nice_match=Ha[r.level].nice_length,r.max_chain_length=Ha[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ce-1,r.match_available=0,r.ins_h=0};function Mv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=bc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Iv*2),this.dyn_dtree=new Uint16Array((2*kv+1)*2),this.bl_tree=new Uint16Array((2*Tv+1)*2),Gr(this.dyn_ltree),Gr(this.dyn_dtree),Gr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Ov+1),this.heap=new Uint16Array(2*Mu+1),Gr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Mu+1),Gr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var So=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==zn&&e.status!==np&&e.status!==Uu&&e.status!==ju&&e.status!==qu&&e.status!==Bu&&e.status!==qi&&e.status!==Wa?1:0},V1=r=>{if(So(r))return Bi(r,lr);r.total_in=r.total_out=0,r.data_type=Sv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?np:e.wrap?zn:qi,r.adler=e.wrap===2?0:1,e.last_flush=-2,uv(e),at},Q1=r=>{let e=V1(r);return e===at&&Fv(r.state),e},Uv=(r,e)=>So(r)||r.state.wrap!==2?lr:(r.state.gzhead=e,at),z1=(r,e,t,i,n,a)=>{if(!r)return lr;let o=1;if(e===gv&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>wv||t!==bc||i<8||i>15||e<0||e>9||a<0||a>bv||i===8&&o!==1)return Bi(r,lr);i===8&&(i=9);let s=new Mv;return r.state=s,s.strm=r,s.status=zn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ce-1)/ce),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,Q1(r)},jv=(r,e)=>z1(r,e,bc,Cv,Ev,_v),qv=(r,e)=>{if(So(r)||e>fh||e<0)return r?Bi(r,lr):lr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Wa&&e!==Ut)return Bi(r,r.avail_out===0?pu:lr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(At(r),r.avail_out===0)return t.last_flush=-1,at}else if(r.avail_in===0&&hh(e)<=hh(i)&&e!==Ut)return Bi(r,pu);if(t.status===Wa&&r.avail_in!==0)return Bi(r,pu);if(t.status===zn&&t.wrap===0&&(t.status=qi),t.status===zn){let n=bc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Es||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Dv),n+=31-n%31,Da(t,n),t.strstart!==0&&(Da(t,r.adler>>>16),Da(t,r.adler&65535)),r.adler=1,t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===np){if(r.adler=0,be(t,31),be(t,139),be(t,8),t.gzhead)be(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),be(t,t.gzhead.time&255),be(t,t.gzhead.time>>8&255),be(t,t.gzhead.time>>16&255),be(t,t.gzhead.time>>24&255),be(t,t.level===9?2:t.strategy>=Es||t.level<2?4:0),be(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(be(t,t.gzhead.extra.length&255),be(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ke(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Uu;else if(be(t,0),be(t,0),be(t,0),be(t,0),be(t,0),be(t,t.level===9?2:t.strategy>=Es||t.level<2?4:0),be(t,Nv),t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===Uu){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,At(r),t.pending!==0)return t.last_flush=-1,at;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ju}if(t.status===ju){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),At(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=qu}if(t.status===qu){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),At(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n))}t.status=Bu}if(t.status===Bu){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(At(r),t.pending!==0))return t.last_flush=-1,at;be(t,r.adler&255),be(t,r.adler>>8&255),r.adler=0}if(t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(r.avail_in!==0||t.lookahead!==0||e!==ti&&t.status!==Wa){let n=t.level===0?B1(t,e):t.strategy===Es?Lv(t,e):t.strategy===vv?Pv(t,e):Ha[t.level].func(t,e);if((n===Ji||n===ta)&&(t.status=Wa),n===mt||n===Ji)return r.avail_out===0&&(t.last_flush=-1),at;if(n===ea&&(e===dv?fv(t):e!==fh&&(Fu(t,0,0,!1),e===hv&&(Gr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),At(r),r.avail_out===0))return t.last_flush=-1,at}return e!==Ut?at:t.wrap<=0?dh:(t.wrap===2?(be(t,r.adler&255),be(t,r.adler>>8&255),be(t,r.adler>>16&255),be(t,r.adler>>24&255),be(t,r.total_in&255),be(t,r.total_in>>8&255),be(t,r.total_in>>16&255),be(t,r.total_in>>24&255)):(Da(t,r.adler>>>16),Da(t,r.adler&65535)),At(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?at:dh)},Bv=r=>{if(So(r))return lr;let e=r.state.status;return r.state=null,e===qi?Bi(r,mv):at},Vv=(r,e)=>{let t=e.length;if(So(r))return lr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==zn||i.lookahead)return lr;if(n===1&&(r.adler=po(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Gr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Wn(i);i.lookahead>=ce;){let c=i.strstart,l=i.lookahead-(ce-1);do i.ins_h=ri(i,i.ins_h,i.window[c+ce-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--l);i.strstart=c,i.lookahead=ce-1,Wn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ce-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,at},Qv=jv,zv=z1,Wv=Q1,Hv=V1,Gv=Uv,Kv=qv,Zv=Bv,Jv=Vv,Yv="pako deflate (from Nodeca project)",eo={deflateInit:Qv,deflateInit2:zv,deflateReset:Wv,deflateResetKeep:Hv,deflateSetHeader:Gv,deflate:Kv,deflateEnd:Zv,deflateSetDictionary:Jv,deflateInfo:Yv},Xv=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),e2=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Xv(t,i)&&(r[i]=t[i])}}return r},t2=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},_c={assign:e2,flattenChunks:t2},W1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){W1=!1}var fo=new Uint8Array(256);for(let r=0;r<256;r++)fo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;fo[254]=fo[254]=1;var r2=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},i2=(r,e)=>{if(e<65534&&r.subarray&&W1)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},n2=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=fo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return i2(a,n)},a2=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+fo[r[t]]>e?t:e},ho={string2buf:r2,buf2string:n2,utf8border:a2};function o2(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var H1=o2,G1=Object.prototype.toString,{Z_NO_FLUSH:s2,Z_SYNC_FLUSH:c2,Z_FULL_FLUSH:l2,Z_FINISH:u2,Z_OK:sc,Z_STREAM_END:p2,Z_DEFAULT_COMPRESSION:f2,Z_DEFAULT_STRATEGY:d2,Z_DEFLATED:h2}=on;function wo(r){this.options=_c.assign({level:f2,method:h2,chunkSize:16384,windowBits:15,memLevel:8,strategy:d2},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new H1,this.strm.avail_out=0;let t=eo.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==sc)throw new Error(Zi[t]);if(e.header&&eo.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=ho.string2buf(e.dictionary):G1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=eo.deflateSetDictionary(this.strm,i),t!==sc)throw new Error(Zi[t]);this._dict_set=!0}}wo.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?u2:s2,typeof r=="string"?t.input=ho.string2buf(r):G1.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===c2||a===l2)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=eo.deflate(t,a),n===p2)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=eo.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===sc;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};wo.prototype.onData=function(r){this.chunks.push(r)};wo.prototype.onEnd=function(r){r===sc&&(this.result=_c.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ap(r,e){let t=new wo(e);if(t.push(r,!0),t.err)throw t.msg||Zi[t.err];return t.result}function m2(r,e){return e=e||{},e.raw=!0,ap(r,e)}function g2(r,e){return e=e||{},e.gzip=!0,ap(r,e)}var y2=wo,v2=ap,b2=m2,_2=g2,S2=on,w2={Deflate:y2,deflate:v2,deflateRaw:b2,gzip:_2,constants:S2},xs=16209,C2=16191,E2=function r(e,t){let i,n,a,o,s,c,l,u,d,f,p,h,m,v,w,b,S,_,T,R,A,N,L,P,j=e.state;i=e.next_in,L=e.input,n=i+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,l=j.wsize,u=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,v=j.distcode,w=(1<<j.lenbits)-1,b=(1<<j.distbits)-1;e:do{h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=m[p&w];t:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_===0)P[a++]=S&65535;else if(_&16){T=S&65535,_&=15,_&&(h<_&&(p+=L[i++]<<h,h+=8),T+=p&(1<<_)-1,p>>>=_,h-=_),h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=v[p&b];r:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_&16){if(R=S&65535,_&=15,h<_&&(p+=L[i++]<<h,h+=8,h<_&&(p+=L[i++]<<h,h+=8)),R+=p&(1<<_)-1,R>c){e.msg="invalid distance too far back",j.mode=xs;break e}if(p>>>=_,h-=_,_=a-o,R>_){if(_=R-_,_>u&&j.sane){e.msg="invalid distance too far back",j.mode=xs;break e}if(A=0,N=f,d===0){if(A+=l-_,_<T){T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}}else if(d<_){if(A+=l+d-_,_-=d,_<T){T-=_;do P[a++]=f[A++];while(--_);if(A=0,d<T){_=d,T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}}}else if(A+=d-_,_<T){T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}for(;T>2;)P[a++]=N[A++],P[a++]=N[A++],P[a++]=N[A++],T-=3;T&&(P[a++]=N[A++],T>1&&(P[a++]=N[A++]))}else{A=a-R;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],T-=3;while(T>2);T&&(P[a++]=P[A++],T>1&&(P[a++]=P[A++]))}}else if((_&64)===0){S=v[(S&65535)+(p&(1<<_)-1)];continue r}else{e.msg="invalid distance code",j.mode=xs;break e}break}}else if((_&64)===0){S=m[(S&65535)+(p&(1<<_)-1)];continue t}else if(_&32){j.mode=C2;break e}else{e.msg="invalid literal/length code",j.mode=xs;break e}break}}while(i<n&&a<s);T=h>>3,i-=T,h-=T<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Pn=15,mh=852,gh=592,yh=0,du=1,vh=2,x2=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),A2=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),k2=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),T2=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),I2=(r,e,t,i,n,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,h=0,m=0,v=0,w=0,b=0,S,_,T,R,A,N=null,L,P=new Uint16Array(Pn+1),j=new Uint16Array(Pn+1),ye=null,je,G,Ce;for(l=0;l<=Pn;l++)P[l]=0;for(u=0;u<i;u++)P[e[t+u]]++;for(p=c,f=Pn;f>=1&&P[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&P[d]===0;d++);for(p<d&&(p=d),v=1,l=1;l<=Pn;l++)if(v<<=1,v-=P[l],v<0)return-1;if(v>0&&(r===yh||f!==1))return-1;for(j[1]=0,l=1;l<Pn;l++)j[l+1]=j[l]+P[l];for(u=0;u<i;u++)e[t+u]!==0&&(o[j[e[t+u]]++]=u);if(r===yh?(N=ye=o,L=20):r===du?(N=x2,ye=A2,L=257):(N=k2,ye=T2,L=0),b=0,u=0,l=d,A=a,h=p,m=0,T=-1,w=1<<p,R=w-1,r===du&&w>mh||r===vh&&w>gh)return 1;for(;;){je=l-m,o[u]+1<L?(G=0,Ce=o[u]):o[u]>=L?(G=ye[o[u]-L],Ce=N[o[u]-L]):(G=32+64,Ce=0),S=1<<l-m,_=1<<h,d=_;do _-=S,n[A+(b>>m)+_]=je<<24|G<<16|Ce|0;while(_!==0);for(S=1<<l-1;b&S;)S>>=1;if(S!==0?(b&=S-1,b+=S):b=0,u++,--P[l]===0){if(l===f)break;l=e[t+o[u]]}if(l>p&&(b&R)!==T){for(m===0&&(m=p),A+=d,h=l-m,v=1<<h;h+m<f&&(v-=P[h+m],!(v<=0));)h++,v<<=1;if(w+=1<<h,r===du&&w>mh||r===vh&&w>gh)return 1;T=b&R,n[T]=p<<24|h<<16|A-a|0}}return b!==0&&(n[A+b]=l-m<<24|64<<16|0),s.bits=p,0},to=I2,O2=0,K1=1,Z1=2,{Z_FINISH:bh,Z_BLOCK:D2,Z_TREES:As,Z_OK:Yi,Z_STREAM_END:N2,Z_NEED_DICT:R2,Z_STREAM_ERROR:jt,Z_DATA_ERROR:J1,Z_MEM_ERROR:Y1,Z_BUF_ERROR:$2,Z_DEFLATED:_h}=on,Sc=16180,Sh=16181,wh=16182,Ch=16183,Eh=16184,xh=16185,Ah=16186,kh=16187,Th=16188,Ih=16189,cc=16190,_r=16191,hu=16192,Oh=16193,mu=16194,Dh=16195,Nh=16196,Rh=16197,$h=16198,ks=16199,Ts=16200,Ph=16201,Lh=16202,Fh=16203,Mh=16204,Uh=16205,gu=16206,jh=16207,qh=16208,Oe=16209,X1=16210,em=16211,P2=852,L2=592,F2=15,M2=F2,Bh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function U2(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var sn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Sc||e.mode>em?1:0},tm=r=>{if(sn(r))return jt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Sc,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(P2),e.distcode=e.distdyn=new Int32Array(L2),e.sane=1,e.back=-1,Yi},rm=r=>{if(sn(r))return jt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,tm(r)},im=(r,e)=>{let t;if(sn(r))return jt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,rm(r))},nm=(r,e)=>{if(!r)return jt;let t=new U2;r.state=t,t.strm=r,t.window=null,t.mode=Sc;let i=im(r,e);return i!==Yi&&(r.state=null),i},j2=r=>nm(r,M2),Vh=!0,yu,vu,q2=r=>{if(Vh){yu=new Int32Array(512),vu=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(to(K1,r.lens,0,288,yu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;to(Z1,r.lens,0,32,vu,0,r.work,{bits:5}),Vh=!1}r.lencode=yu,r.lenbits=9,r.distcode=vu,r.distbits=5},am=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},B2=(r,e)=>{let t,i,n,a,o,s,c,l,u,d,f,p,h,m,v=0,w,b,S,_,T,R,A,N,L=new Uint8Array(4),P,j,ye=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(sn(r)||!r.output||!r.input&&r.avail_in!==0)return jt;t=r.state,t.mode===_r&&(t.mode=hu),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,d=s,f=c,N=Yi;e:for(;;)switch(t.mode){case Sc:if(t.wrap===0){t.mode=hu;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0),l=0,u=0,t.mode=Sh;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=Oe;break}if((l&15)!==_h){r.msg="unknown compression method",t.mode=Oe;break}if(l>>>=4,u-=4,A=(l&15)+8,t.wbits===0&&(t.wbits=A),A>15||A>t.wbits){r.msg="invalid window size",t.mode=Oe;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=l&512?Ih:_r,l=0,u=0;break;case Sh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==_h){r.msg="unknown compression method",t.mode=Oe;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Oe;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0,t.mode=wh;case wh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,L[2]=l>>>16&255,L[3]=l>>>24&255,t.check=Ke(t.check,L,4,0)),l=0,u=0,t.mode=Ch;case Ch:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0,t.mode=Eh;case Eh:if(t.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=xh;case xh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(A=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),A)),t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Ah;case Ah:if(t.flags&2048){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.name+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=kh;case kh:if(t.flags&4096){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.comment+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.comment=null);t.mode=Th;case Th:if(t.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Oe;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=_r;break;case Ih:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}r.adler=t.check=Bh(l),l=0,u=0,t.mode=cc;case cc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,R2;r.adler=t.check=1,t.mode=_r;case _r:if(e===D2||e===As)break e;case hu:if(t.last){l>>>=u&7,u-=u&7,t.mode=gu;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Oh;break;case 1:if(q2(t),t.mode=ks,e===As){l>>>=2,u-=2;break e}break;case 2:t.mode=Nh;break;case 3:r.msg="invalid block type",t.mode=Oe}l>>>=2,u-=2;break;case Oh:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Oe;break}if(t.length=l&65535,l=0,u=0,t.mode=mu,e===As)break e;case mu:t.mode=Dh;case Dh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=_r;break;case Nh:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.nlen=(l&31)+257,l>>>=5,u-=5,t.ndist=(l&31)+1,l>>>=5,u-=5,t.ncode=(l&15)+4,l>>>=4,u-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Oe;break}t.have=0,t.mode=Rh;case Rh:for(;t.have<t.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.lens[ye[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[ye[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},N=to(O2,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,N){r.msg="invalid code lengths set",t.mode=Oe;break}t.have=0,t.mode=$h;case $h:for(;t.have<t.nlen+t.ndist;){for(;v=t.lencode[l&(1<<t.lenbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(S<16)l>>>=w,u-=w,t.lens[t.have++]=S;else{if(S===16){for(j=w+2;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=w,u-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=Oe;break}A=t.lens[t.have-1],p=3+(l&3),l>>>=2,u-=2}else if(S===17){for(j=w+3;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=w,u-=w,A=0,p=3+(l&7),l>>>=3,u-=3}else{for(j=w+7;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=w,u-=w,A=0,p=11+(l&127),l>>>=7,u-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Oe;break}for(;p--;)t.lens[t.have++]=A}}if(t.mode===Oe)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Oe;break}if(t.lenbits=9,P={bits:t.lenbits},N=to(K1,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,N){r.msg="invalid literal/lengths set",t.mode=Oe;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},N=to(Z1,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,N){r.msg="invalid distances set",t.mode=Oe;break}if(t.mode=ks,e===As)break e;case ks:t.mode=Ts;case Ts:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,E2(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,t.mode===_r&&(t.back=-1);break}for(t.back=0;v=t.lencode[l&(1<<t.lenbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(b&&(b&240)===0){for(_=w,T=b,R=S;v=t.lencode[R+((l&(1<<_+T)-1)>>_)],w=v>>>24,b=v>>>16&255,S=v&65535,!(_+w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,t.back+=_}if(l>>>=w,u-=w,t.back+=w,t.length=S,b===0){t.mode=Uh;break}if(b&32){t.back=-1,t.mode=_r;break}if(b&64){r.msg="invalid literal/length code",t.mode=Oe;break}t.extra=b&15,t.mode=Ph;case Ph:if(t.extra){for(j=t.extra;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Lh;case Lh:for(;v=t.distcode[l&(1<<t.distbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((b&240)===0){for(_=w,T=b,R=S;v=t.distcode[R+((l&(1<<_+T)-1)>>_)],w=v>>>24,b=v>>>16&255,S=v&65535,!(_+w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,t.back+=_}if(l>>>=w,u-=w,t.back+=w,b&64){r.msg="invalid distance code",t.mode=Oe;break}t.offset=S,t.extra=b&15,t.mode=Fh;case Fh:if(t.extra){for(j=t.extra;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Oe;break}t.mode=Mh;case Mh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Oe;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Ts);break;case Uh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Ts;break;case gu:if(t.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ke(t.check,n,f,o-f):po(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?l:Bh(l))!==t.check){r.msg="incorrect data check",t.mode=Oe;break}l=0,u=0}t.mode=jh;case jh:if(t.wrap&&t.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Oe;break}l=0,u=0}t.mode=qh;case qh:N=N2;break e;case Oe:N=J1;break e;case X1:return Y1;case em:default:return jt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,(t.wsize||f!==r.avail_out&&t.mode<Oe&&(t.mode<gu||e!==bh))&&am(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ke(t.check,n,f,r.next_out-f):po(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===_r?128:0)+(t.mode===ks||t.mode===mu?256:0),(d===0&&f===0||e===bh)&&N===Yi&&(N=$2),N},V2=r=>{if(sn(r))return jt;let e=r.state;return e.window&&(e.window=null),r.state=null,Yi},Q2=(r,e)=>{if(sn(r))return jt;let t=r.state;return(t.wrap&2)===0?jt:(t.head=e,e.done=!1,Yi)},z2=(r,e)=>{let t=e.length,i,n,a;return sn(r)||(i=r.state,i.wrap!==0&&i.mode!==cc)?jt:i.mode===cc&&(n=1,n=po(n,e,t,0),n!==i.check)?J1:(a=am(r,e,t,t),a?(i.mode=X1,Y1):(i.havedict=1,Yi))},W2=rm,H2=im,G2=tm,K2=j2,Z2=nm,J2=B2,Y2=V2,X2=Q2,e3=z2,t3="pako inflate (from Nodeca project)",xr={inflateReset:W2,inflateReset2:H2,inflateResetKeep:G2,inflateInit:K2,inflateInit2:Z2,inflate:J2,inflateEnd:Y2,inflateGetHeader:X2,inflateSetDictionary:e3,inflateInfo:t3};function r3(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var i3=r3,om=Object.prototype.toString,{Z_NO_FLUSH:n3,Z_FINISH:a3,Z_OK:mo,Z_STREAM_END:bu,Z_NEED_DICT:_u,Z_STREAM_ERROR:o3,Z_DATA_ERROR:Qh,Z_MEM_ERROR:s3}=on;function Co(r){this.options=_c.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new H1,this.strm.avail_out=0;let t=xr.inflateInit2(this.strm,e.windowBits);if(t!==mo)throw new Error(Zi[t]);if(this.header=new i3,xr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ho.string2buf(e.dictionary):om.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=xr.inflateSetDictionary(this.strm,e.dictionary),t!==mo)))throw new Error(Zi[t])}Co.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?a3:n3,om.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=xr.inflate(t,o),a===_u&&n&&(a=xr.inflateSetDictionary(t,n),a===mo?a=xr.inflate(t,o):a===Qh&&(a=_u));t.avail_in>0&&a===bu&&t.state.wrap>0&&r[t.next_in]!==0;)xr.inflateReset(t),a=xr.inflate(t,o);switch(a){case o3:case Qh:case _u:case s3:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===bu))if(this.options.to==="string"){let c=ho.utf8border(t.output,t.next_out),l=t.next_out-c,u=ho.buf2string(t.output,c);t.next_out=l,t.avail_out=i-l,l&&t.output.set(t.output.subarray(c,c+l),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===mo&&s===0)){if(a===bu)return a=xr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Co.prototype.onData=function(r){this.chunks.push(r)};Co.prototype.onEnd=function(r){r===mo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=_c.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function op(r,e){let t=new Co(e);if(t.push(r),t.err)throw t.msg||Zi[t.err];return t.result}function c3(r,e){return e=e||{},e.raw=!0,op(r,e)}var l3=Co,u3=op,p3=c3,f3=op,d3=on,h3={Inflate:l3,inflate:u3,inflateRaw:p3,ungzip:f3,constants:d3},{Deflate:m3,deflate:g3,deflateRaw:y3,gzip:v3}=w2,{Inflate:b3,inflate:_3,inflateRaw:S3,ungzip:w3}=h3,C3=m3,E3=g3,x3=y3,A3=v3,k3=b3,T3=_3,I3=S3,O3=w3,D3=on,N3={Deflate:C3,deflate:E3,deflateRaw:x3,gzip:A3,Inflate:k3,inflate:T3,inflateRaw:I3,ungzip:O3,constants:D3},Ae=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ke=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},lc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],lc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],lc.prototype,"output",void 0);lc=Ae([Je(),ke("design:paramtypes",[String,String])],lc);var uc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],uc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],uc.prototype,"output",void 0);uc=Ae([K(),ke("design:paramtypes",[String,String])],uc);var oi=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Ae([g(),ke("design:type",String)],oi.prototype,"name",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],oi.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"metaData",void 0);oi=Ae([Je(),ke("design:paramtypes",[String,String,String,Array,String])],oi);var dr=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Ae([g(),ke("design:type",String)],dr.prototype,"name",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"taskId",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],dr.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"metaData",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"createdAt",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"updatedAt",void 0);dr=Ae([K(),ke("design:paramtypes",[String,String,String,String,Array,String,String,String])],dr);var Xi=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Ae([g(),ke("design:type",String)],Xi.prototype,"model",void 0);Ae([g(),ke("design:type",String)],Xi.prototype,"status",void 0);Ae([g(),ke("design:type",Number)],Xi.prototype,"progress",void 0);Ae([g(),ke("design:type",Boolean)],Xi.prototype,"downloaded",void 0);Ae([g(),ke("design:type",Boolean)],Xi.prototype,"loaded",void 0);Xi=Ae([K(),ke("design:paramtypes",[String,String,Number,Boolean,Boolean])],Xi);var R3=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},We=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ve,Bs,Qu=class{constructor(e,t=!0){Ve.set(this,void 0),Bs.set(this,new Map),R3(this,Ve,e,"f")}async getModels(){let e=await We(this,Ve,"f").query({query:E`
|
|
745
745
|
query {
|
|
746
746
|
aiGetModels {
|
|
747
747
|
id
|
|
@@ -765,23 +765,23 @@ triggerMatch
|
|
|
765
765
|
modelType
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
`});return k(e).aiGetModels}async addModel(e){let
|
|
768
|
+
`});return k(e).aiGetModels}async addModel(e){let t=await We(this,Ve,"f").mutate({mutation:E`
|
|
769
769
|
mutation($model: ModelInput!) {
|
|
770
770
|
aiAddModel(model: $model)
|
|
771
771
|
}
|
|
772
|
-
`,variables:{model:e}});return k(
|
|
772
|
+
`,variables:{model:e}});return k(t).aiAddModel}async updateModel(e,t){let i=await We(this,Ve,"f").mutate({mutation:E`
|
|
773
773
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
774
774
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
775
775
|
}
|
|
776
|
-
`,variables:{modelId:e,model:
|
|
776
|
+
`,variables:{modelId:e,model:t}});return k(i).aiUpdateModel}async removeModel(e){let t=await We(this,Ve,"f").mutate({mutation:E`
|
|
777
777
|
mutation($modelId: String!) {
|
|
778
778
|
aiRemoveModel(modelId: $modelId)
|
|
779
779
|
}
|
|
780
|
-
`,variables:{modelId:e}});return k(
|
|
780
|
+
`,variables:{modelId:e}});return k(t).aiRemoveModel}async setDefaultModel(e,t){let i=await We(this,Ve,"f").mutate({mutation:E`
|
|
781
781
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
782
782
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
783
783
|
}
|
|
784
|
-
`,variables:{modelId:
|
|
784
|
+
`,variables:{modelId:t,modelType:e}});return k(i).aiSetDefaultModel}async getDefaultModel(e){let t=await We(this,Ve,"f").query({query:E`
|
|
785
785
|
query($modelType: ModelType!) {
|
|
786
786
|
aiGetDefaultModel(modelType: $modelType) {
|
|
787
787
|
id
|
|
@@ -805,7 +805,7 @@ triggerMatch
|
|
|
805
805
|
modelType
|
|
806
806
|
}
|
|
807
807
|
}
|
|
808
|
-
`,variables:{modelType:e}});return k(
|
|
808
|
+
`,variables:{modelType:e}});return k(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await We(this,Ve,"f").query({query:E`
|
|
809
809
|
query {
|
|
810
810
|
aiTasks {
|
|
811
811
|
name
|
|
@@ -821,7 +821,7 @@ triggerMatch
|
|
|
821
821
|
updatedAt
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
|
-
`}));return e}async addTask(e,
|
|
824
|
+
`}));return e}async addTask(e,t,i,n,a){let o=new oi(e,t,i,n,a),{aiAddTask:s}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
825
825
|
mutation AiAddTask($task: AITaskInput!) {
|
|
826
826
|
aiAddTask(task: $task) {
|
|
827
827
|
name
|
|
@@ -837,7 +837,7 @@ triggerMatch
|
|
|
837
837
|
updatedAt
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:
|
|
840
|
+
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
841
841
|
mutation AiRemoveTask($taskId: String!) {
|
|
842
842
|
aiRemoveTask(taskId: $taskId) {
|
|
843
843
|
name
|
|
@@ -853,7 +853,7 @@ triggerMatch
|
|
|
853
853
|
updatedAt
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
-
`,variables:{taskId:e}}));return
|
|
856
|
+
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:i}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
857
857
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
858
858
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
859
859
|
name
|
|
@@ -869,7 +869,7 @@ triggerMatch
|
|
|
869
869
|
updatedAt
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
|
-
`,variables:{taskId:e,task:{name:
|
|
872
|
+
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=k(await We(this,Ve,"f").query({query:E`
|
|
873
873
|
query AiModelLoadingStatus($model: String!) {
|
|
874
874
|
aiModelLoadingStatus(model: $model) {
|
|
875
875
|
model
|
|
@@ -879,51 +879,51 @@ triggerMatch
|
|
|
879
879
|
downloaded
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
`,variables:{model:e}}));return
|
|
882
|
+
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:i}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
883
883
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
884
884
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
885
885
|
}
|
|
886
|
-
`,variables:{taskId:e,prompt:
|
|
886
|
+
`,variables:{taskId:e,prompt:t}}));return i}async embed(e,t){let{aiEmbed:i}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
887
887
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
888
888
|
aiEmbed(modelId: $modelId, text: $text)
|
|
889
889
|
}
|
|
890
|
-
`,variables:{modelId:e,text:
|
|
890
|
+
`,variables:{modelId:e,text:t}})),n=vc.toByteArray(i);return JSON.parse(N3.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i){let{aiOpenTranscriptionStream:n}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
891
891
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
892
892
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
893
893
|
}
|
|
894
|
-
`,variables:{modelId:e,params:i}})),a=
|
|
894
|
+
`,variables:{modelId:e,params:i}})),a=We(this,Ve,"f").subscribe({query:E` subscription {
|
|
895
895
|
aiTranscriptionText(streamId: "${n}")
|
|
896
|
-
}`}).subscribe({next(o){return
|
|
896
|
+
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return We(this,Bs,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
897
897
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
898
898
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
899
899
|
}
|
|
900
|
-
`,variables:{streamId:e}})),i=
|
|
900
|
+
`,variables:{streamId:e}})),i=We(this,Bs,"f").get(e);return i.closed||i.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:i}=k(await We(this,Ve,"f").mutate({mutation:E`
|
|
901
901
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
902
902
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
903
903
|
}
|
|
904
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return i}};Ve=new WeakMap,js=new WeakMap;var Hr=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Be=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},ar,qs,Ga,Bs,Ka,Mi,Vs,Za,ho=class{constructor(e,r=!0){ar.set(this,void 0),qs.set(this,void 0),Ga.set(this,void 0),Bs.set(this,void 0),Ka.set(this,void 0),Mi.set(this,void 0),Vs.set(this,void 0),Za.set(this,void 0),Hr(this,ar,e,"f"),Hr(this,qs,new no(Be(this,ar,"f"),r),"f"),Hr(this,Ga,new Rl(Be(this,ar,"f")),"f"),Hr(this,Bs,new Ol(Be(this,ar,"f")),"f"),Hr(this,Ka,new Dl(Be(this,ar,"f")),"f"),Hr(this,Za,new Vl(Be(this,ar,"f"),r),"f"),Hr(this,Mi,new nc(Be(this,ar,"f"),r),"f"),Be(this,Mi,"f").setExpressionClient(Be(this,Ga,"f")),Be(this,Mi,"f").setNeighbourhoodClient(Be(this,Ka,"f")),Be(this,Mi,"f").setAIClient(Be(this,Za,"f")),Hr(this,Vs,new Nl(Be(this,ar,"f"),r),"f")}get agent(){return Be(this,qs,"f")}get expression(){return Be(this,Ga,"f")}get languages(){return Be(this,Bs,"f")}get neighbourhood(){return Be(this,Ka,"f")}get perspective(){return Be(this,Mi,"f")}get runtime(){return Be(this,Vs,"f")}get ai(){return Be(this,Za,"f")}};ar=new WeakMap,qs=new WeakMap,Ga=new WeakMap,Bs=new WeakMap,Ka=new WeakMap,Mi=new WeakMap,Vs=new WeakMap,Za=new WeakMap;var Ql;(function(t){t.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",t.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",t.AgentIsUntrusted="AGENT_IS_UNTRUSTED",t.CapabilityRequested="CAPABILITY_REQUESTED",t.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Ql||(Ql={}));var op=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},sp=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Qi=class{constructor(e,r){this.language=e,this.expression=r}};op([g(),sp("design:type",ur)],Qi.prototype,"language",void 0);op([g(),sp("design:type",String)],Qi.prototype,"expression",void 0);Qi=op([G(),sp("design:paramtypes",[ur,String])],Qi);function X8(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function e7(t){if(t.startsWith("literal://")){let a=new ur;a.address="literal",a.name="literal";let o=t.substring(10);return new Qi(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new ur;return s.address=a,new Qi(s,o)}let n=/^did:([^\s]+)$/.exec(t);if(n&&n.length==2){let a=new ur;return a.address="did",new Qi(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Nt=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},mr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},lc=class{};Nt([g(),mr("design:type",String)],lc.prototype,"name",void 0);Nt([g(),mr("design:type",String)],lc.prototype,"type",void 0);lc=Nt([G()],lc);var mo=class{};Nt([g(),mr("design:type",String)],mo.prototype,"label",void 0);Nt([g(),mr("design:type",String)],mo.prototype,"name",void 0);Nt([g(),mr("design:type",Array)],mo.prototype,"parameters",void 0);mo=Nt([G()],mo);var pc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Nt([g(),mr("design:type",String)],pc.prototype,"name",void 0);Nt([g(),mr("design:type",String)],pc.prototype,"parametersStringified",void 0);pc=Nt([Ze(),mr("design:paramtypes",[String,Object])],pc);var fc=class{};Nt([g(),mr("design:type",String)],fc.prototype,"did",void 0);Nt([g(),mr("design:type",Ki)],fc.prototype,"status",void 0);fc=Nt([G()],fc);var Qh=class{},un=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},ra=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ci=class{};un([g(),ra("design:type",String)],ci.prototype,"name",void 0);un([g(),ra("design:type",String)],ci.prototype,"address",void 0);un([g(),ra("design:type",String)],ci.prototype,"settings",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"icon",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"constructorIcon",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"settingsIcon",void 0);ci=un([G()],ci);var ht=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Ct=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gt=class{};ht([g(),Ct("design:type",String)],Gt.prototype,"name",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"address",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"description",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"author",void 0);ht([g(),Ct("design:type",Boolean)],Gt.prototype,"templated",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"templateSourceLanguageAddress",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"templateAppliedParams",void 0);ht([g(),Ct("design:type",Array)],Gt.prototype,"possibleTemplateParams",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"sourceCodeLink",void 0);Gt=ht([G()],Gt);var Hn=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ht([g(),Ct("design:type",String)],Hn.prototype,"name",void 0);ht([g(),Ct("design:type",String)],Hn.prototype,"description",void 0);ht([g(),Ct("design:type",Array)],Hn.prototype,"possibleTemplateParams",void 0);ht([g(),Ct("design:type",String)],Hn.prototype,"sourceCodeLink",void 0);Hn=ht([Ze(),Ct("design:paramtypes",[String,String])],Hn);var zh=class{},Wh=class extends pi(){},Hh=class{},Sc=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},cp=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},dc=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Sc([g(),cp("design:type",String)],dc.prototype,"linkLanguage",void 0);Sc([g(),cp("design:type",fr)],dc.prototype,"meta",void 0);dc=Sc([G(),cp("design:paramtypes",[String,fr])],dc);var zl=class extends pi(){};zl=Sc([G()],zl);var ln=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},pn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Wl;(function(t){t.Private="PRIVATE",t.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",t.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",t.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",t.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",t.Synced="SYNCED"})(Wl||(Wl={}));var ui=class{constructor(e,r,i){this.uuid=e,this.name=r,i?this.state=i:this.state=Wl.Private}};ln([g(),pn("design:type",String)],ui.prototype,"uuid",void 0);ln([g(),pn("design:type",String)],ui.prototype,"name",void 0);ln([g(),pn("design:type",String)],ui.prototype,"state",void 0);ln([g(),pn("design:type",String)],ui.prototype,"sharedUrl",void 0);ln([g(),pn("design:type",zl)],ui.prototype,"neighbourhood",void 0);ln([g(),pn("design:type",Array)],ui.prototype,"owners",void 0);ui=ln([G(),pn("design:paramtypes",[String,String,String])],ui);var wc=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},om=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},hc=class{};wc([g(),om("design:type",Array)],hc.prototype,"additions",void 0);wc([g(),om("design:type",Array)],hc.prototype,"removals",void 0);hc=wc([G()],hc);var Gh=class extends pi(){};Gh=wc([G()],Gh);var Kh=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Fn=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ja,Ui,ks="smart_literal://content";function R3(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}var go=class{constructor(e,r){Ja.set(this,void 0),Ui.set(this,void 0),Kh(this,Ja,e,"f"),Kh(this,Ui,r,"f")}get base(){return Fn(this,Ui,"f")}static async create(e,r){let i=wt.from(R3(10)).toUrl(),n=new go(e,i);return await n.set(r),n}static async isSmartLiteralBase(e,r){return(await e.get(new ot({source:r,predicate:ks}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ot({predicate:ks}))).map(i=>new go(e,i.data.source))}async get(){let e=await Fn(this,Ja,"f").getSingleTarget(new ot({source:Fn(this,Ui,"f"),predicate:ks}));if(!e)throw`No content for smart literal ${Fn(this,Ui,"f")}`;return wt.fromUrl(e).get()}async set(e){let r=wt.from(e);await Fn(this,Ja,"f").setSingleTarget(new Gi({source:Fn(this,Ui,"f"),predicate:ks,target:r.toUrl()}))}};Ja=new WeakMap,Ui=new WeakMap;var Zh=class{};function d7(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function h7(t){return`triple(this, "${t}", _)`}function m7(t){return function(e,r,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,u=`subject_class("${s}", C), instance(C, Instance)`;if(t&&t.where)for(let l in t.where){let d=t.where[l];u+=`, property_getter(C, Instance, "${l}", "${d}")`}t&&t.condition&&(u+=", "+t.condition);let c=await a.infer(u);if(c==!1)return o;if(typeof c=="string")throw c;for(let l of c){let d=l.Instance,f=new rc(a,d,s);await f.init(),o.push(f)}return o}}}function sm(t){return function(e,r){if(typeof t.writable>"u"&&t.through&&(t.writable=!0),t.required&&!t.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!t.through&&!t.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},t.writable){let i=r;e[`set${ei(i)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function g7(t){return function(e,r){if(!t.through&&!t.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!t.through)throw new Error("SubjectFlag requires a 'through' option");if(!t.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],through:t.through,required:!0,initial:t.value,flag:!0},e[r]=t.value,Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function y7(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let i=r;e[`add${ei(i)}`]=()=>{},e[`remove${ei(i)}`]=()=>{},e[`setCollection${ei(i)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function cm(t){let e="",r="abcdefghijklmnopqrstuvwxyz",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}function P3(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",i=t.name,n=e.prototype,a=cm(8);r+=`subject_class("${i}", ${a}).
|
|
905
|
-
`;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let
|
|
906
|
-
`,{through:
|
|
907
|
-
`,m+=`property_resolve_language(${a}, "${h}", "${
|
|
908
|
-
`),
|
|
909
|
-
`:
|
|
910
|
-
`,
|
|
911
|
-
`;else if(v&&
|
|
912
|
-
`}
|
|
913
|
-
`,{through:
|
|
914
|
-
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${
|
|
915
|
-
`;let
|
|
916
|
-
`,m+=`collection_remover(${a}, "${
|
|
917
|
-
`,m+=`collection_setter(${a}, "${
|
|
918
|
-
`}d.push(m)}let p=
|
|
919
|
-
`,
|
|
920
|
-
`,
|
|
921
|
-
`}return
|
|
922
|
-
`,
|
|
923
|
-
`,
|
|
924
|
-
`),
|
|
925
|
-
`,
|
|
926
|
-
`),{sdna:
|
|
904
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Ve=new WeakMap,Bs=new WeakMap;var zr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ar,Vs,Ga,Qs,Ka,Fi,zs,Za,go=class{constructor(e,t=!0){ar.set(this,void 0),Vs.set(this,void 0),Ga.set(this,void 0),Qs.set(this,void 0),Ka.set(this,void 0),Fi.set(this,void 0),zs.set(this,void 0),Za.set(this,void 0),zr(this,ar,e,"f"),zr(this,Vs,new oo(Be(this,ar,"f"),t),"f"),zr(this,Ga,new $u(Be(this,ar,"f")),"f"),zr(this,Qs,new Du(Be(this,ar,"f")),"f"),zr(this,Ka,new Nu(Be(this,ar,"f")),"f"),zr(this,Za,new Qu(Be(this,ar,"f"),t),"f"),zr(this,Fi,new ac(Be(this,ar,"f"),t),"f"),Be(this,Fi,"f").setExpressionClient(Be(this,Ga,"f")),Be(this,Fi,"f").setNeighbourhoodClient(Be(this,Ka,"f")),Be(this,Fi,"f").setAIClient(Be(this,Za,"f")),zr(this,zs,new Ru(Be(this,ar,"f"),t),"f")}get agent(){return Be(this,Vs,"f")}get expression(){return Be(this,Ga,"f")}get languages(){return Be(this,Qs,"f")}get neighbourhood(){return Be(this,Ka,"f")}get perspective(){return Be(this,Fi,"f")}get runtime(){return Be(this,zs,"f")}get ai(){return Be(this,Za,"f")}};ar=new WeakMap,Vs=new WeakMap,Ga=new WeakMap,Qs=new WeakMap,Ka=new WeakMap,Fi=new WeakMap,zs=new WeakMap,Za=new WeakMap;var zu;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(zu||(zu={}));var sp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},cp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vi=class{constructor(e,t){this.language=e,this.expression=t}};sp([g(),cp("design:type",cr)],Vi.prototype,"language",void 0);sp([g(),cp("design:type",String)],Vi.prototype,"expression",void 0);Vi=sp([K(),cp("design:paramtypes",[cr,String])],Vi);function e7(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function t7(r){if(r.startsWith("literal://")){let a=new cr;a.address="literal",a.name="literal";let o=r.substring(10);return new Vi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new cr;return s.address=a,new Vi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new cr;return a.address="did",new Vi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Nt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},hr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},pc=class{};Nt([g(),hr("design:type",String)],pc.prototype,"name",void 0);Nt([g(),hr("design:type",String)],pc.prototype,"type",void 0);pc=Nt([K()],pc);var yo=class{};Nt([g(),hr("design:type",String)],yo.prototype,"label",void 0);Nt([g(),hr("design:type",String)],yo.prototype,"name",void 0);Nt([g(),hr("design:type",Array)],yo.prototype,"parameters",void 0);yo=Nt([K()],yo);var fc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Nt([g(),hr("design:type",String)],fc.prototype,"name",void 0);Nt([g(),hr("design:type",String)],fc.prototype,"parametersStringified",void 0);fc=Nt([Je(),hr("design:paramtypes",[String,Object])],fc);var dc=class{};Nt([g(),hr("design:type",String)],dc.prototype,"did",void 0);Nt([g(),hr("design:type",Gi)],dc.prototype,"status",void 0);dc=Nt([K()],dc);var zh=class{},cn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ra=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},si=class{};cn([g(),ra("design:type",String)],si.prototype,"name",void 0);cn([g(),ra("design:type",String)],si.prototype,"address",void 0);cn([g(),ra("design:type",String)],si.prototype,"settings",void 0);cn([g(),ra("design:type",zi)],si.prototype,"icon",void 0);cn([g(),ra("design:type",zi)],si.prototype,"constructorIcon",void 0);cn([g(),ra("design:type",zi)],si.prototype,"settingsIcon",void 0);si=cn([K()],si);var gt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ct=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Gt=class{};gt([g(),Ct("design:type",String)],Gt.prototype,"name",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"address",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"description",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"author",void 0);gt([g(),Ct("design:type",Boolean)],Gt.prototype,"templated",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"templateSourceLanguageAddress",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"templateAppliedParams",void 0);gt([g(),Ct("design:type",Array)],Gt.prototype,"possibleTemplateParams",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"sourceCodeLink",void 0);Gt=gt([K()],Gt);var Hn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};gt([g(),Ct("design:type",String)],Hn.prototype,"name",void 0);gt([g(),Ct("design:type",String)],Hn.prototype,"description",void 0);gt([g(),Ct("design:type",Array)],Hn.prototype,"possibleTemplateParams",void 0);gt([g(),Ct("design:type",String)],Hn.prototype,"sourceCodeLink",void 0);Hn=gt([Je(),Ct("design:paramtypes",[String,String])],Hn);var Wh=class{},Hh=class extends ui(){},Gh=class{},wc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},lp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},hc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};wc([g(),lp("design:type",String)],hc.prototype,"linkLanguage",void 0);wc([g(),lp("design:type",pr)],hc.prototype,"meta",void 0);hc=wc([K(),lp("design:paramtypes",[String,pr])],hc);var Wu=class extends ui(){};Wu=wc([K()],Wu);var ln=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},un=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hu;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Hu||(Hu={}));var ci=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=Hu.Private}};ln([g(),un("design:type",String)],ci.prototype,"uuid",void 0);ln([g(),un("design:type",String)],ci.prototype,"name",void 0);ln([g(),un("design:type",String)],ci.prototype,"state",void 0);ln([g(),un("design:type",String)],ci.prototype,"sharedUrl",void 0);ln([g(),un("design:type",Wu)],ci.prototype,"neighbourhood",void 0);ln([g(),un("design:type",Array)],ci.prototype,"owners",void 0);ci=ln([K(),un("design:paramtypes",[String,String,String])],ci);var Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},sm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mc=class{};Cc([g(),sm("design:type",Array)],mc.prototype,"additions",void 0);Cc([g(),sm("design:type",Array)],mc.prototype,"removals",void 0);mc=Cc([K()],mc);var Kh=class extends ui(){};Kh=Cc([K()],Kh);var Zh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ln=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ja,Mi,Is="smart_literal://content";function $3(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var vo=class{constructor(e,t){Ja.set(this,void 0),Mi.set(this,void 0),Zh(this,Ja,e,"f"),Zh(this,Mi,t,"f")}get base(){return Ln(this,Mi,"f")}static async create(e,t){let i=ut.from($3(10)).toUrl(),n=new vo(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new ot({source:t,predicate:Is}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ot({predicate:Is}))).map(i=>new vo(e,i.data.source))}async get(){let e=await Ln(this,Ja,"f").getSingleTarget(new ot({source:Ln(this,Mi,"f"),predicate:Is}));if(!e)throw`No content for smart literal ${Ln(this,Mi,"f")}`;return ut.fromUrl(e).get()}async set(e){let t=ut.from(e);await Ln(this,Ja,"f").setSingleTarget(new Hi({source:Ln(this,Mi,"f"),predicate:Is,target:t.toUrl()}))}};Ja=new WeakMap,Mi=new WeakMap;var Jh=class{};function h7(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function m7(r){return`triple(this, "${r}", _)`}function g7(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let u in r.where){let d=r.where[u];c+=`, property_getter(C, Instance, "${u}", "${d}")`}r&&r.condition&&(c+=", "+r.condition);try{let u=await a.infer(c);if(u&&u!==!1&&typeof u!="string"&&u.length>0){for(let d of u){let f=d.Instance,p=new ao(a,f,s);await p.init(),o.push(p)}return o}}catch{}let l=await a.getAllSubjectInstances(s);if(r&&r.where){let u=[];for(let d of l){let f=!0;for(let p in r.where){let h=r.where[p];if(await d[p]!==h){f=!1;break}}f&&u.push(d)}return u}return l}}}function cm(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${Xr(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function y7(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function v7(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${Xr(i)}`]=()=>{},e[`remove${Xr(i)}`]=()=>{},e[`setCollection${Xr(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function lm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function P3(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=lm(8);t+=`subject_class("${i}", ${a}).
|
|
905
|
+
`;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let l=[],u=n.__properties||{};for(let h in u){let m=`property(${a}, "${h}").
|
|
906
|
+
`,{through:v,initial:w,required:b,resolveLanguage:S,writable:_,flag:T,getter:R,setter:A,local:N}=u[h];if(S&&(m+=`property_resolve(${a}, "${h}").
|
|
907
|
+
`,m+=`property_resolve_language(${a}, "${h}", "${S}").
|
|
908
|
+
`),R?m+=`property_getter(${a}, Base, "${h}", Value) :- ${R}.
|
|
909
|
+
`:v&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${v}", Value).
|
|
910
|
+
`,b&&(T?c.push(`triple(Base, "${v}", "${w}")`):c.push(`triple(Base, "${v}", _)`))),A)m+=`property_setter(${a}, "${h}", Actions) :- ${A}.
|
|
911
|
+
`;else if(_&&v&&typeof n[Yu(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:v,target:"value",...N&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${Oi(P)}').
|
|
912
|
+
`}l.push(m),w&&(s.push({action:"addLink",source:"this",predicate:v,target:w}),o.push({action:"removeLink",source:"this",predicate:v,target:"*"}))}let d=[],f=n.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
|
|
913
|
+
`,{through:v,where:w,local:b}=f[h];if(v){if(w){if(!w.isInstance&&!w.condition)throw"'where' needs one of 'isInstance' or 'condition'";let R=[];if(w.isInstance){let N;w.isInstance.name?N=w.isInstance.name:N=w.isInstance,R.push(`instance(OtherClass, Target), subject_class("${N}", OtherClass)`)}w.condition&&R.push(w.condition);let A=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${v}", Target), ${A}), List).
|
|
914
|
+
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${v}", C), List).
|
|
915
|
+
`;let S=[{action:"addLink",source:"this",predicate:v,target:"value",...b&&{local:!0}}],_=[{action:"removeLink",source:"this",predicate:v,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:v,target:"value",...b&&{local:!0}}];m+=`collection_adder(${a}, "${jn(h)}", '${Oi(S)}').
|
|
916
|
+
`,m+=`collection_remover(${a}, "${jn(h)}", '${Oi(_)}').
|
|
917
|
+
`,m+=`collection_setter(${a}, "${jn(h)}", '${Oi(T)}').
|
|
918
|
+
`}d.push(m)}let p=Oi(s);if(t+=`constructor(${a}, '${p}').
|
|
919
|
+
`,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
|
|
920
|
+
`,t+=`
|
|
921
|
+
`}return t+=`destructor(${a}, '${Oi(o)}').
|
|
922
|
+
`,t+=`
|
|
923
|
+
`,t+=l.join(`
|
|
924
|
+
`),t+=`
|
|
925
|
+
`,t+=d.join(`
|
|
926
|
+
`),{sdna:t,name:i}},Object.defineProperty(e,"type",{configurable:!0})}}function b7(r){return cm({...r,required:!0,writable:!0,initial:r.initial||"literal://string:uninitialized"})}function _7(r){return cm({...r,writable:!1})}var S7=`
|
|
927
927
|
type AIModelLoadingStatus {
|
|
928
928
|
downloaded: Boolean!
|
|
929
929
|
loaded: Boolean!
|
|
@@ -1509,7 +1509,7 @@ input VoiceActivityParamsInput {
|
|
|
1509
1509
|
startWindow: Float
|
|
1510
1510
|
timeBeforeSpeech: Float
|
|
1511
1511
|
}
|
|
1512
|
-
`;function Jh(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function um(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,i=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Jh(e)} your ${r} actions, with access to ${Jh(i)}`}var O=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},y=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},X=function(t,e){return function(r,i){e(r,i,t)}},wo=new ni;wo.author="did:ad4m:test";wo.timestamp=Date.now();wo.data={source:"root",target:"neighbourhood://Qm12345"};wo.proof={signature:"",key:"",valid:!0};var Yr=new Ki;Yr.author="did:ad4m:test";Yr.timestamp=Date.now().toString();Yr.proof=new Tr("","");Yr.data=new fr([wo]);var mc=class{};O([g(),y("design:type",String)],mc.prototype,"recipient",void 0);O([g(),y("design:type",Ki)],mc.prototype,"message",void 0);mc=O([G()],mc);var Gn=class{};O([g(),y("design:type",String)],Gn.prototype,"ad4mExecutorVersion",void 0);O([g(),y("design:type",Boolean)],Gn.prototype,"isInitialized",void 0);O([g(),y("design:type",Boolean)],Gn.prototype,"isUnlocked",void 0);Gn=O([G()],Gn);var tn=class{};O([g(),y("design:type",String)],tn.prototype,"title",void 0);O([g(),y("design:type",String)],tn.prototype,"message",void 0);O([g(),y("design:type",String)],tn.prototype,"type",void 0);O([g(),y("design:type",String)],tn.prototype,"addon",void 0);tn=O([G()],tn);var qt=class{};O([g(),y("design:type",String)],qt.prototype,"description",void 0);O([g(),y("design:type",String)],qt.prototype,"appName",void 0);O([g(),y("design:type",String)],qt.prototype,"appUrl",void 0);O([g(),y("design:type",String)],qt.prototype,"appIconPath",void 0);O([g(),y("design:type",String)],qt.prototype,"trigger",void 0);O([g(),y("design:type",Array)],qt.prototype,"perspectiveIds",void 0);O([g(),y("design:type",String)],qt.prototype,"webhookUrl",void 0);O([g(),y("design:type",String)],qt.prototype,"webhookAuth",void 0);qt=O([Ze()],qt);var It=class{};O([g(),y("design:type",String)],It.prototype,"id",void 0);O([g(),y("design:type",Boolean)],It.prototype,"granted",void 0);O([g(),y("design:type",String)],It.prototype,"description",void 0);O([g(),y("design:type",String)],It.prototype,"appName",void 0);O([g(),y("design:type",String)],It.prototype,"appUrl",void 0);O([g(),y("design:type",String)],It.prototype,"appIconPath",void 0);O([g(),y("design:type",String)],It.prototype,"trigger",void 0);O([g(),y("design:type",Array)],It.prototype,"perspectiveIds",void 0);O([g(),y("design:type",String)],It.prototype,"webhookUrl",void 0);O([g(),y("design:type",String)],It.prototype,"webhookAuth",void 0);It=O([G()],It);var Kn=class{};O([g(),y("design:type",It)],Kn.prototype,"notification",void 0);O([g(),y("design:type",String)],Kn.prototype,"perspectiveId",void 0);O([g(),y("design:type",String)],Kn.prototype,"triggerMatch",void 0);Kn=O([G()],Kn);var Ke=class{};O([g(),y("design:type",Number)],Ke.prototype,"total",void 0);O([g(),y("design:type",Number)],Ke.prototype,"imported",void 0);O([g(),y("design:type",Number)],Ke.prototype,"failed",void 0);O([g(),y("design:type",Number)],Ke.prototype,"omitted",void 0);O([g(),y("design:type",Array)],Ke.prototype,"errors",void 0);Ke=O([G()],Ke);var Ot=class{};O([g(),y("design:type",Ke)],Ot.prototype,"perspectives",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"links",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"expressions",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"perspectiveDiffs",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"notifications",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"models",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"defaultModels",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"tasks",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"friends",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"trustedAgents",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"knownLinkLanguages",void 0);Ot=O([G()],Ot);var Zn=class{};O([g(),y("design:type",String)],Zn.prototype,"email",void 0);O([g(),y("design:type",String)],Zn.prototype,"did",void 0);O([g(),y("design:type",String)],Zn.prototype,"lastSeen",void 0);O([g(),y("design:type",Number)],Zn.prototype,"perspectiveCount",void 0);Zn=O([G()],Zn);var rn=class{};O([g(),y("design:type",Boolean)],rn.prototype,"success",void 0);O([g(),y("design:type",String)],rn.prototype,"message",void 0);O([g(),y("design:type",Boolean)],rn.prototype,"requiresPassword",void 0);O([g(),y("design:type",Boolean)],rn.prototype,"isExistingUser",void 0);rn=O([G()],rn);var V=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,r,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Yr}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[Yr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Yr}]}runtimeMessageReceived(){return Yr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Ql.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,r){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,r){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,r){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,r,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,r,i){return new Zi("did:key:test123",!0)}runtimeLoginUser(e,r){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,r,i){return!0}};O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeQuit",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeOpenLink",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gn)],V.prototype,"runtimeInfo",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"addTrustedAgents",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"deleteTrustedAgents",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"getTrustedAgents",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeKnownLinkLanguageTemplates",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeAddKnownLinkLanguageTemplates",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeFriends",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeAddFriends",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeRemoveFriends",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],V.prototype,"runtimeHcAgentInfos",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],V.prototype,"runtimeGetNetworkMetrics",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeRestartHolochain",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",Boolean)],V.prototype,"runtimeHcAddAgentInfos",null);O([Dt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String,String]),y("design:returntype",void 0)],V.prototype,"runtimeVerifyStringSignedByDid",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[fr]),y("design:returntype",Boolean)],V.prototype,"runtimeSetStatus",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Ki)],V.prototype,"runtimeFriendStatus",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,Ys]),y("design:returntype",Boolean)],V.prototype,"runtimeFriendSendMessage",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],V.prototype,"runtimeMessageInbox",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],V.prototype,"runtimeMessageOutbox",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Ki)],V.prototype,"runtimeMessageReceived",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",tn)],V.prototype,"exceptionOccurred",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[qt]),y("design:returntype",String)],V.prototype,"runtimeRequestInstallNotification",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeNotifications",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,qt]),y("design:returntype",Boolean)],V.prototype,"runtimeUpdateNotification",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeRemoveNotification",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeGrantNotification",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Kn)],V.prototype,"runtimeNotificationTriggered",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeExportDb",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeImportDb",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Boolean)],V.prototype,"runtimeExportPerspective",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeImportPerspective",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeMultiUserEnabled",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Boolean]),y("design:returntype",Boolean)],V.prototype,"runtimeSetMultiUserEnabled",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeListUsers",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,dr]),y("design:returntype",rn)],V.prototype,"runtimeRequestLoginVerification",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String]),y("design:returntype",String)],V.prototype,"runtimeVerifyEmailCode",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeTestEmail",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,dr]),y("design:returntype",Zi)],V.prototype,"runtimeCreateUser",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],V.prototype,"runtimeLoginUser",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeEnable",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeDisable",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",String)],V.prototype,"runtimeEmailTestGetCode",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestClearCodes",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,Number]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestSetExpiry",null);V=O([d0()],V);var Na=function(t,e,r,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},ne=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},_t,or,Qs,Ne;function zs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Yh(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function _l(){return`
|
|
1512
|
+
`;function Yh(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function um(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Yh(e)} your ${t} actions, with access to ${Yh(i)}`}var D=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},y=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},X=function(r,e){return function(t,i){e(t,i,r)}},Eo=new ii;Eo.author="did:ad4m:test";Eo.timestamp=Date.now();Eo.data={source:"root",target:"neighbourhood://Qm12345"};Eo.proof={signature:"",key:"",valid:!0};var Zr=new Gi;Zr.author="did:ad4m:test";Zr.timestamp=Date.now().toString();Zr.proof=new Ar("","");Zr.data=new pr([Eo]);var gc=class{};D([g(),y("design:type",String)],gc.prototype,"recipient",void 0);D([g(),y("design:type",Gi)],gc.prototype,"message",void 0);gc=D([K()],gc);var Gn=class{};D([g(),y("design:type",String)],Gn.prototype,"ad4mExecutorVersion",void 0);D([g(),y("design:type",Boolean)],Gn.prototype,"isInitialized",void 0);D([g(),y("design:type",Boolean)],Gn.prototype,"isUnlocked",void 0);Gn=D([K()],Gn);var en=class{};D([g(),y("design:type",String)],en.prototype,"title",void 0);D([g(),y("design:type",String)],en.prototype,"message",void 0);D([g(),y("design:type",String)],en.prototype,"type",void 0);D([g(),y("design:type",String)],en.prototype,"addon",void 0);en=D([K()],en);var qt=class{};D([g(),y("design:type",String)],qt.prototype,"description",void 0);D([g(),y("design:type",String)],qt.prototype,"appName",void 0);D([g(),y("design:type",String)],qt.prototype,"appUrl",void 0);D([g(),y("design:type",String)],qt.prototype,"appIconPath",void 0);D([g(),y("design:type",String)],qt.prototype,"trigger",void 0);D([g(),y("design:type",Array)],qt.prototype,"perspectiveIds",void 0);D([g(),y("design:type",String)],qt.prototype,"webhookUrl",void 0);D([g(),y("design:type",String)],qt.prototype,"webhookAuth",void 0);qt=D([Je()],qt);var It=class{};D([g(),y("design:type",String)],It.prototype,"id",void 0);D([g(),y("design:type",Boolean)],It.prototype,"granted",void 0);D([g(),y("design:type",String)],It.prototype,"description",void 0);D([g(),y("design:type",String)],It.prototype,"appName",void 0);D([g(),y("design:type",String)],It.prototype,"appUrl",void 0);D([g(),y("design:type",String)],It.prototype,"appIconPath",void 0);D([g(),y("design:type",String)],It.prototype,"trigger",void 0);D([g(),y("design:type",Array)],It.prototype,"perspectiveIds",void 0);D([g(),y("design:type",String)],It.prototype,"webhookUrl",void 0);D([g(),y("design:type",String)],It.prototype,"webhookAuth",void 0);It=D([K()],It);var Kn=class{};D([g(),y("design:type",It)],Kn.prototype,"notification",void 0);D([g(),y("design:type",String)],Kn.prototype,"perspectiveId",void 0);D([g(),y("design:type",String)],Kn.prototype,"triggerMatch",void 0);Kn=D([K()],Kn);var Ze=class{};D([g(),y("design:type",Number)],Ze.prototype,"total",void 0);D([g(),y("design:type",Number)],Ze.prototype,"imported",void 0);D([g(),y("design:type",Number)],Ze.prototype,"failed",void 0);D([g(),y("design:type",Number)],Ze.prototype,"omitted",void 0);D([g(),y("design:type",Array)],Ze.prototype,"errors",void 0);Ze=D([K()],Ze);var Ot=class{};D([g(),y("design:type",Ze)],Ot.prototype,"perspectives",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"links",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"expressions",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"perspectiveDiffs",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"notifications",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"models",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"defaultModels",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"tasks",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"friends",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"trustedAgents",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"knownLinkLanguages",void 0);Ot=D([K()],Ot);var Zn=class{};D([g(),y("design:type",String)],Zn.prototype,"email",void 0);D([g(),y("design:type",String)],Zn.prototype,"did",void 0);D([g(),y("design:type",String)],Zn.prototype,"lastSeen",void 0);D([g(),y("design:type",Number)],Zn.prototype,"perspectiveCount",void 0);Zn=D([K()],Zn);var tn=class{};D([g(),y("design:type",Boolean)],tn.prototype,"success",void 0);D([g(),y("design:type",String)],tn.prototype,"message",void 0);D([g(),y("design:type",Boolean)],tn.prototype,"requiresPassword",void 0);D([g(),y("design:type",Boolean)],tn.prototype,"isExistingUser",void 0);tn=D([K()],tn);var Q=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Zr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Zr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Zr}]}runtimeMessageReceived(){return Zr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:zu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Ki("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}};D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeQuit",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeOpenLink",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gn)],Q.prototype,"runtimeInfo",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"addTrustedAgents",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"deleteTrustedAgents",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"getTrustedAgents",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeFriends",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeAddFriends",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeRemoveFriends",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],Q.prototype,"runtimeHcAgentInfos",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],Q.prototype,"runtimeGetNetworkMetrics",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeRestartHolochain",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",Boolean)],Q.prototype,"runtimeHcAddAgentInfos",null);D([Dt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String,String]),y("design:returntype",void 0)],Q.prototype,"runtimeVerifyStringSignedByDid",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[pr]),y("design:returntype",Boolean)],Q.prototype,"runtimeSetStatus",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Gi)],Q.prototype,"runtimeFriendStatus",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,ec]),y("design:returntype",Boolean)],Q.prototype,"runtimeFriendSendMessage",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],Q.prototype,"runtimeMessageInbox",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],Q.prototype,"runtimeMessageOutbox",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gi)],Q.prototype,"runtimeMessageReceived",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",en)],Q.prototype,"exceptionOccurred",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[qt]),y("design:returntype",String)],Q.prototype,"runtimeRequestInstallNotification",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeNotifications",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,qt]),y("design:returntype",Boolean)],Q.prototype,"runtimeUpdateNotification",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeRemoveNotification",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeGrantNotification",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Kn)],Q.prototype,"runtimeNotificationTriggered",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeExportDb",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeImportDb",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Boolean)],Q.prototype,"runtimeExportPerspective",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeImportPerspective",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeMultiUserEnabled",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Boolean]),y("design:returntype",Boolean)],Q.prototype,"runtimeSetMultiUserEnabled",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeListUsers",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,fr]),y("design:returntype",tn)],Q.prototype,"runtimeRequestLoginVerification",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String]),y("design:returntype",String)],Q.prototype,"runtimeVerifyEmailCode",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeTestEmail",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,fr]),y("design:returntype",Ki)],Q.prototype,"runtimeCreateUser",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],Q.prototype,"runtimeLoginUser",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeEnable",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeDisable",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",String)],Q.prototype,"runtimeEmailTestGetCode",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestClearCodes",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,Number]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestSetExpiry",null);Q=D([h0()],Q);var Na=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},nt,Ya,Ws,Qe;function Hs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Xh(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function Su(){return`
|
|
1513
1513
|
findall(
|
|
1514
1514
|
[T, A],
|
|
1515
1515
|
link(Base, _, _, T, A),
|
|
@@ -1517,52 +1517,57 @@ input VoiceActivityParamsInput {
|
|
|
1517
1517
|
),
|
|
1518
1518
|
sort(AllLinks, SortedLinks),
|
|
1519
1519
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1520
|
-
`}function
|
|
1520
|
+
`}function e1(r){return`
|
|
1521
1521
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1522
1522
|
% Constrain to specified properties if provided
|
|
1523
|
-
${
|
|
1523
|
+
${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1524
1524
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1525
1525
|
), Properties)
|
|
1526
|
-
`}function
|
|
1526
|
+
`}function t1(r){return`
|
|
1527
1527
|
findall([CollectionName, CollectionValues], (
|
|
1528
1528
|
% Constrain to specified collections if provided
|
|
1529
|
-
${
|
|
1529
|
+
${r?`member(CollectionName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1530
1530
|
|
|
1531
1531
|
collection(SubjectClass, CollectionName),
|
|
1532
1532
|
collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
|
|
1533
1533
|
), Collections)
|
|
1534
|
-
`}function
|
|
1535
|
-
Base = "${
|
|
1536
|
-
subject_class("${
|
|
1537
|
-
${
|
|
1538
|
-
|
|
1534
|
+
`}function r1(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=Hs(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:l,lte:u,gt:d,gte:f}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function i1(r){return r?"length(UnsortedInstances, TotalCount)":""}function n1(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function a1(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function o1(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function s1(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function up(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function pm(r,e){return up(r.type)===e}function c1(r){return pm(r,"array")}function l1(r){return pm(r,"object")}function L3(r){let e=up(r.type);return e==="number"||e==="integer"}var Jr=class{static async getClassName(e){if(this===Jr)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[u,d]of Object.entries(n)){let f=d;i[u]={name:u,predicate:f.through||"",required:f.required||!1,writable:f.writable||!1,...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.getter!==void 0&&{getter:f.getter},...f.setter!==void 0&&{setter:f.setter},...f.local!==void 0&&{local:f.local},...f.transform!==void 0&&{transform:f.transform},...f.flag!==void 0&&{flag:f.flag}}}let a={},o=e.__collections||{};for(let[u,d]of Object.entries(o)){let f=d;a[u]={name:u,predicate:f.through||"",...f.where!==void 0&&{where:f.where},...f.local!==void 0&&{local:f.local}}}let s=Object.keys(i).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let u=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(u.properties)for(let[f,p]of Object.entries(u.properties)){let h=c1(p),m=this.determinePredicate(u,f,p,this.determineNamespace(u,d),d);if(h)a[f]={name:f,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let v=u.required?.includes(f)||!1;i[f]={name:f,predicate:m,required:v,writable:p["x-ad4m"]?.writable!==!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:i,collections:a}}constructor(e,t,i){nt.set(this,void 0),Ya.set(this,void 0),Ws.set(this,void 0),Qe.set(this,void 0),Na(this,nt,t||ut.from(lm(24)).toUrl(),"f"),Na(this,Qe,e,"f"),Na(this,Ws,i||"ad4m://self","f")}get baseExpression(){return fe(this,nt,"f")}get perspective(){return fe(this,Qe,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let i=this.getCollectionMetadata(e);if(!i)throw new Error(`Collection "${e}" has no metadata defined`);if(!i.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.through,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){let n=Object.fromEntries(await Promise.all(i.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let u=Array.from(o,p=>p.codePointAt(0)),d=u.every(p=>p<=255),f=u.some(p=>p>=128);if(d&&f)try{let p=Uint8Array.from(u),h=new TextDecoder("utf-8",{fatal:!0}).decode(p);h!==o&&(c=h)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:p})}}if(s){let u=await e.getExpression(o);if(u)try{c=JSON.parse(u.data)}catch{c=u.data}}let l=t.__properties?.[a]?.transform;return l&&typeof l=="function"&&(c=l(c)),[a,c]})));Object.assign(t,n)}async getData(){let e=[Su(),e1(),t1()],t=`
|
|
1535
|
+
Base = "${fe(this,nt,"f")}",
|
|
1536
|
+
subject_class("${fe(this,Ya,"f")}", SubjectClass),
|
|
1537
|
+
${e.join(", ")}
|
|
1538
|
+
`;try{let i=await fe(this,Qe,"f").infer(t);if(i?.[0]&&i[0].Properties&&i[0].Properties.length>0){let{Properties:n,Collections:a,Timestamp:o,Author:s}=i[0],c=[...n,...a,["timestamp",o],["author",s]];return await Jr.assignValuesToInstance(fe(this,Qe,"f"),this,c),this}}catch{console.log(`Prolog getData failed for ${fe(this,nt,"f")}, falling back to SurrealDB`)}try{let n=this.constructor.getModelMetadata(),a=`
|
|
1539
|
+
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1540
|
+
FROM link
|
|
1541
|
+
WHERE in.uri = '${fe(this,nt,"f")}'
|
|
1542
|
+
ORDER BY timestamp ASC
|
|
1543
|
+
`,o=await fe(this,Qe,"f").querySurrealDB(a);if(o&&o.length>0){let s=null,c=null;for(let[l,u]of Object.entries(n.properties)){let d=o.filter(f=>f.predicate===u.predicate);if(d.length>0){let f=d[0],p=f.target;if(f.timestamp&&(!s||f.timestamp>s)&&(s=f.timestamp,c=f.author),u.resolveLanguage&&u.resolveLanguage!=="literal")try{let h=await fe(this,Qe,"f").getExpression(p);if(h)try{p=JSON.parse(h.data)}catch{p=h.data}}catch(h){console.warn(`Failed to resolve expression for ${l}:`,h)}else if(typeof p=="string"&&p.startsWith("literal://"))try{let h=ut.fromUrl(p).get();p=h.data!==void 0?h.data:h}catch{}u.transform&&typeof u.transform=="function"&&(p=u.transform(p)),this[l]=p}}for(let[l,u]of Object.entries(n.collections)){let d=o.filter(f=>f.predicate===u.predicate);this[l]=d.map(f=>f.target)}c&&(this.author=c),s&&(this.timestamp=s)}}catch(i){console.error(`SurrealDB getData also failed for ${fe(this,nt,"f")}:`,i)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:l,limit:u,count:d}=t,f=i||await this.getClassName(e),p=[Su(),Xh(n),e1(a),t1(o),r1(s)],h=[i1(d),n1(c),a1(l),o1(u)];return`
|
|
1539
1544
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1540
|
-
subject_class("${
|
|
1545
|
+
subject_class("${f}", SubjectClass),
|
|
1541
1546
|
instance(SubjectClass, Base),
|
|
1542
|
-
${
|
|
1547
|
+
${p.filter(v=>v).join(", ")}
|
|
1543
1548
|
), UnsortedInstances),
|
|
1544
|
-
${
|
|
1545
|
-
`}static async queryToSurrealQL(t
|
|
1549
|
+
${h.filter(v=>v).join(", ")}
|
|
1550
|
+
`}static async queryToSurrealQL(e,t){let i=this.getModelMetadata(),{source:n,where:a,order:o,offset:s,limit:c}=t,l=[];n&&l.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} AND predicate = 'ad4m://has_child']) > 0`);for(let[p,h]of Object.entries(i.properties))h.required&&(h.flag&&h.initial?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}' AND out.uri = '${h.initial}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}']) > 0`));if(l.length===0){for(let[p,h]of Object.entries(i.properties))if(h.initial){h.flag?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}' AND out.uri = '${h.initial}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}']) > 0`);break}}let u=this.buildGraphTraversalWhereClause(i,a),d=[];return d.push(...l),u&&d.push(u),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
|
|
1546
1551
|
SELECT
|
|
1547
1552
|
id AS source,
|
|
1548
1553
|
uri AS source_uri,
|
|
1549
1554
|
->link[WHERE perspective = $perspective] AS links
|
|
1550
1555
|
FROM node
|
|
1551
|
-
WHERE ${
|
|
1552
|
-
`.trim()}static buildGraphTraversalWhereClause(t
|
|
1553
|
-
`)}static buildSurrealSelectFieldsWithAggregation(t,
|
|
1554
|
-
`)}static formatSurrealValue(
|
|
1556
|
+
WHERE ${d.join(" AND ")}
|
|
1557
|
+
`.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} NOT IN [${l}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=s.predicate,l=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let u=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} IN [${u}]]) > 0`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} IN [${f}]]) = 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} = ${this.formatSurrealValue(u.not)}]) = 0`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)}]) > 0`)}return i.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} NOT IN [${l}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=s.predicate,l=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${u}])`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${f}])`)}else i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(u.not)})`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)})`)}return i.join(" AND ")}static buildSurrealSelectFields(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];!c||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c.predicate}' LIMIT 1) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];!c||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c.predicate}') AS ${s}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
|
|
1558
|
+
`)}static buildSurrealSelectFieldsWithAggregation(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];!c||n.push(`array::first(target[WHERE predicate = '${c.predicate}']) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];!c||n.push(`target[WHERE predicate = '${c.predicate}'] AS ${s}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS timestamp"),n.join(`,
|
|
1559
|
+
`)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(i[0].AllInstances.map(async([o,s,c,l,u])=>{try{let d=new this(e,o);n.length&&Object.keys(d).forEach(p=>{n.includes(p)||delete d[p]});let f=[...s,...c,["timestamp",l],["author",u]];return await Jr.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:i[0].TotalCount}}static async instancesFromSurrealResult(e,t,i){if(!i||i.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],o=t?.collections||[],s=[];for(let f of i){let p;try{if(p=f.source_uri,!p)continue;let h=f.links||[],m=new this(e,p),v=null,w=null;for(let b=0;b<h.length;b++){let S=h[b],_=S.predicate,T=S.target;if(T==="None")continue;S.timestamp&&(!v||S.timestamp>v)&&(v=S.timestamp,w=S.author);let R=!1;for(let[A,N]of Object.entries(n.properties))if(N.predicate===_){let L=m[A],P=typeof L=="object"&&L!==null&&!Array.isArray(L)&&Object.keys(L).length===0;if(!L||L===""||L===0||P){let j=T;if(T!=null&&T!==""){if(N.resolveLanguage!=null&&N.resolveLanguage!=="literal"&&typeof T=="string")try{let ye=await e.getExpression(T);if(ye)try{j=JSON.parse(ye.data)}catch{j=ye.data}}catch(ye){console.warn(`Failed to resolve expression for ${A} with target "${T}":`,ye),console.warn("Falling back to raw value"),j=T}else if(typeof T=="string"&&T.startsWith("literal://"))try{let ye=ut.fromUrl(T).get();ye.data!==void 0?j=ye.data:j=ye}catch{j=T}else if(typeof T=="string"){let ye=typeof m[A];ye==="number"?j=Number(T):ye==="boolean"&&(j=T==="true"||T==="1")}}N.transform&&typeof N.transform=="function"&&(j=N.transform(j)),m[A]=j}R=!0;break}if(!R){for(let[A,N]of Object.entries(n.collections))if(N.predicate===_){m[A]||(m[A]=[]);let L=`__${A}_timestamps`,P=`__${A}_indices`;m[L]||(m[L]=[]),m[P]||(m[P]=[]),m[A].includes(T)||(m[A].push(T),m[L].push(S.timestamp||""),m[P].push(b));break}}}if(w&&v)if(m.author=w,typeof v=="string"&&v.includes("T"))m.timestamp=new Date(v).getTime();else if(typeof v=="string"){let b=parseInt(v,10);m.timestamp=isNaN(b)?v:b}else m.timestamp=v;for(let[b,S]of Object.entries(n.collections)){let _=`__${b}_timestamps`,T=`__${b}_indices`;if(m[b]&&m[_]){let R=m[b].map((A,N)=>({value:A,timestamp:m[_][N]||"",originalIndex:m[T]?.[N]??N}));R.sort((A,N)=>{let L=String(A.timestamp||""),P=String(N.timestamp||""),j=L.localeCompare(P);return j!==0?j:A.originalIndex-N.originalIndex}),m[b]=R.map(A=>A.value),delete m[_],delete m[T]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(S=>{!b.includes(S)&&S!=="timestamp"&&S!=="author"&&S!=="baseExpression"&&delete m[S]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${p}:`,h)}}let c=s;t.where&&(c=s.filter(f=>{for(let[p,h]of Object.entries(t.where))if(p!=="base"){if(p==="author"||p==="timestamp"){if(!this.matchesCondition(f[p],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(f[p],h))return!1}}return!0}));let l=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(l){let f=Object.keys(l)[0],p=Object.values(l)[0];c.sort((h,m)=>{let v=h[f],w=m[f];if(v===void 0&&w===void 0)return 0;if(v===void 0)return p==="ASC"?1:-1;if(w===void 0)return p==="ASC"?-1:1;let b=0;return typeof v=="number"&&typeof w=="number"?b=v-w:typeof v=="string"&&typeof w=="string"?b=v.localeCompare(w):b=String(v).localeCompare(String(w)),p==="DESC"?-b:b})}let u=c.length,d=c;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,p=t.limit?f+t.limit:void 0;d=c.slice(f,p)}return{results:d,totalCount:u}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let i=t;if(i.not!==void 0)return Array.isArray(i.not)?!i.not.includes(e):e!==i.not;if(i.between!==void 0&&Array.isArray(i.between)&&i.between.length===2)return e>=i.between[0]&&e<=i.between[1];let n=!0;return i.gt!==void 0&&(n=n&&e>i.gt),i.gte!==void 0&&(n=n&&e>=i.gte),i.lt!==void 0&&(n=n&&e<i.lt),i.lte!==void 0&&(n=n&&e<=i.lte),i.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(i.contains)):Array.isArray(e)?n=n&&e.includes(i.contains):n=!1),n}return e===t}static async findAll(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findAllAndCount(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,i,n,a=!0){let o={...n||{},limit:t,offset:t*(i-1),count:!0};if(a){let s=await this.queryToSurrealQL(e,o),c=await e.querySurrealDB(s),{results:l,totalCount:u}=await this.instancesFromSurrealResult(e,o,c);return{results:l,totalCount:u,pageSize:t,pageNumber:i}}else{let s=await this.queryToProlog(e,o),c=await e.infer(s),{results:l,totalCount:u}=await this.instancesFromPrologResult(e,o,c);return{results:l,totalCount:u,pageSize:t,pageNumber:i}}}static async countQueryToProlog(e,t={},i){let{source:n,where:a}=t,o=i||await this.getClassName(e),s=[Su(),Xh(n),r1(a)],c=[i1(!0),n1(),a1(),o1()];return`
|
|
1555
1560
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1556
|
-
subject_class("${
|
|
1561
|
+
subject_class("${o}", SubjectClass),
|
|
1557
1562
|
instance(SubjectClass, Base),
|
|
1558
|
-
${
|
|
1563
|
+
${s.filter(u=>u).join(", ")}
|
|
1559
1564
|
), UnsortedInstances),
|
|
1560
|
-
${
|
|
1561
|
-
`}static async countQueryToSurrealQL(t
|
|
1565
|
+
${c.filter(u=>u).join(", ")}
|
|
1566
|
+
`}static async countQueryToSurrealQL(e,t){let i={...t};return delete i.limit,delete i.offset,await this.queryToSurrealQL(e,i)}static async count(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;o&&(t=await fe(this,Qe,"f").createExpression(t,o)),await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i)}async setCollectionSetter(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t&&(Array.isArray(t)?await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),t.map(o=>({name:"value",value:o})),i):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async setCollectionAdder(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:o}],i))):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async setCollectionRemover(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:o}],i))):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let i={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(i[n]=a);await this.perspective.createSubject(this,fe(this,nt,"f"),i,e),await fe(this,Qe,"f").add(new Hi({source:fe(this,Ws,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[i,n]of t)n!=null&&i!=="author"&&i!=="timestamp"&&(e[i]=n);return e}async innerUpdate(e=!0,t){Na(this,Ya,await fe(this,Qe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let i=Object.entries(this);for(let[n,a]of i)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))a.length>0&&await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Na(this,Ya,await fe(this,Qe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await fe(this,Qe,"f").removeSubject(this,fe(this,nt,"f"),e)}static query(e,t){return new Gu(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let i=this.determineNamespace(e,t),n=class extends Jr{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},o={};if(e.properties)for(let[l,u]of Object.entries(e.properties)){let d=this.determinePredicate(e,l,u,i,t),f=e.required?.includes(l)||!1,p=up(u.type);if(c1(u)){o[l]={through:d,local:this.getPropertyOption(l,u,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let m=`add${Hs(l)}`,v=`remove${Hs(l)}`,w=`setCollection${Hs(l)}`;n.prototype[m]=function(){},n.prototype[v]=function(){},n.prototype[w]=function(){}}else{let m=this.getPropertyOption(l,u,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let v=this.getPropertyOption(l,u,t,"local"),w=this.getPropertyOption(l,u,t,"writable",!0),b=this.getPropertyOption(l,u,t,"initial");if(l1(u)&&!m&&(m="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&L3(u)&&(m="literal"),f&&!b&&(l1(u)?b="literal://json:{}":b="ad4m://undefined"),a[l]={through:d,required:f,writable:w,...m&&{resolveLanguage:m},...v!==void 0&&{local:v},...b&&{initial:b}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),w){let S=Yu(l);n.prototype[S]=function(){}}}}if(!Object.values(a).some(l=>l.initial)){let l="ad4m://type",u;if(i.includes("://")){let[d,f]=i.split("://"),p=(f||"").replace(/\/+$/,"");p?u=`${d}://${p}/instance`:u=`${d}://instance`}else u=`${i.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:l,required:!0,writable:!1,initial:u,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:u}),console.warn(`No properties with initial values found. Added automatic type flag: ${l} = ${u}`)}return n.prototype.__properties=a,n.prototype.__collections=o,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,P3({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
|
|
1562
1567
|
- options.namespace
|
|
1563
1568
|
- schema["x-ad4m"].namespace
|
|
1564
1569
|
- schema.title
|
|
1565
|
-
- valid schema.$id`)}static determinePredicate(t,e,r,i,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(n.predicateTemplate){let o=o1(i),[s,u]=o.includes("://")?o.split("://"):["",o],c=u||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",s).replace("${ns}",c).replace("${title}",t.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(t.title||"",e);let a=o1(i);return a.includes("://")?`${a}${e}`:`${a}://${e}`}static getPropertyOption(t,e,r,i,n){return r.propertyOptions?.[t]?.[i]!==void 0?r.propertyOptions[t][i]:e["x-ad4m"]?.[i]!==void 0?e["x-ad4m"][i]:r[i]!==void 0?r[i]:n}static getDefaultValueForType(t){switch(t){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};_t=new WeakMap,or=new WeakMap,Qs=new WeakMap,Ne=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var Hl=class{constructor(e,r,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let i={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}}async paginateSubscribe(e,r,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async c=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,c);i({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async c=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,c);i({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}}};var Cc="0.11.2-dev-multi-user-email-2";var Or=12e3;function F3(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function fi(t,e=1e4){return re(this,null,function*(){return Promise.race([new Promise((r,i)=>{let n;try{n=new WebSocket(t,"graphql-transport-ws"),n.onopen=()=>{n.close(),r(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((r,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function lp(t){return re(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:F3().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return t;throw new Error(`Could not connect to port ${t}`)}catch(e){throw new Error(`Could not connect to port ${t}`)}})}function M3(){return new Promise((t,e)=>{let r=document.querySelector("ad4m-connect"),i=r==null?void 0:r.getAd4mClient();i?t(i):e("No Ad4mClient found")})}function pp(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Ec(t,e){pp()&&localStorage.setItem(`${Cc}/${t}`,e)}function Kt(t){return pp()?localStorage.getItem(`${Cc}/${t}`):null}function fp(t){pp()&&localStorage.removeItem(`${Cc}/${t}`)}var U3=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function Co(t,{include:e,exclude:r}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):r?!r.some(a):!0};for(let[n,a]of U3(t.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var Eo=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Or;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};Co(this);this.options=e,this.appName=e.appName,this.appDesc=e.appDesc,this.appDomain=e.appDomain,this.appUrl=e.appUrl,this.appIconPath=e.appIconPath,this.capabilities=e.capabilities,this.port=e.port||this.port,this.url=e.url||`ws://localhost:${this.port}/graphql`,this.token=e.token||this.token,this.isHosting=e.hosting||!1}notifyConfigChange(e,r){this.listeners.configstatechange.forEach(i=>{i(e,r)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(r=>{r(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(r=>{r(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,r){this.listeners[e].push(r)}buildTempClient(e){let r=Xu({url:e,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:""}}})}),i=new ds({link:new el(r),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new ho(i)}connect(e){return re(this,null,function*(){try{if(e){yield fi(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{let r=`ws://localhost:${this.port}/graphql`;yield fi(r),this.setUrl(r);let i=this.buildClient();return yield this.checkAuth(),i}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return re(this,null,function*(){console.warn("[Ad4m Connect] connectMultiUser() is deprecated. The new email verification flow is handled automatically by the UI.");try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield fi(e),this.setUrl(e);let r=this.buildClient();console.debug("[Ad4m Connect] Built client:",r);let i;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),i=yield r.agent.loginUser(this.options.userEmail,this.options.userPassword),console.debug("[Ad4m Connect] Login successful")}catch(a){console.debug("[Ad4m Connect] Login error:",a),console.debug("[Ad4m Connect] User does not exist, trying to create user:",this.options.userEmail);try{console.debug("[Ad4m Connect] Creating user:",this.options.userEmail);let o=yield r.agent.createUser(this.options.userEmail,this.options.userPassword);if(console.debug("[Ad4m Connect] Create result:",o),!o.success)throw new Error(o.error||"Failed to create user. Server may require email verification.");console.debug("[Ad4m Connect] Logging in user after creation:",this.options.userEmail),i=yield r.agent.loginUser(this.options.userEmail,this.options.userPassword),console.log("[Ad4m Connect] Successfully created and logged in user")}catch(o){throw new Error(`Failed to create/login user: ${o.message}. If email verification is enabled, please use the UI-driven flow instead.`)}}this.setToken(i);let n=this.buildClient();return yield n.agent.status(),this.ad4mClient=n,this.notifyAuthChange("authenticated"),this.notifyConnectionChange("connected"),n}catch(e){throw this.notifyConnectionChange("error"),this.notifyAuthChange("unauthenticated"),e}})}loginToHosting(e,r){return re(this,null,function*(){try{let i=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(i.status===200){let n=yield i.json();localStorage.setItem("hosting_token",n.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,Ec("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield i.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(i){throw console.log(i),new Error(`Error logging in ${i}`)}})}checkEmail(e){return re(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(r){console.log(r)}})}connectToPort(e){return re(this,null,function*(){try{if(e){let r=yield lp(e);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return re(this,null,function*(){var r,i;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((i=this.activeSocket)==null?void 0:i.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield fi(this.url),this.buildClient()}catch(n){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return re(this,null,function*(){let e=[...Array(10).keys()].map((n,a)=>lp(Or+a)),i=(yield Promise.allSettled(e)).find(n=>n.status==="fulfilled");if(i)return i.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url,"graphql-transport-ws")}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=Xu({url:this.url,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>re(this,null,function*(){if(!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new ds({link:new el(this.wsClient),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new ho(this.apolloClient),this.ad4mClient}checkAuth(){return re(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return re(this,null,function*(){var r;if(e&&this.setToken(null),this.isHosting){let i=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+i}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return re(this,null,function*(){var r;try{let i=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);return this.setToken(i),yield this.buildClient(),yield this.checkAuth(),this.token}catch(i){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Or),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function dp({unlockAgent:t,reconnect:e}){return L`
|
|
1570
|
+
- valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=s1(n),[c,l]=s.includes("://")?s.split("://"):["",s],u=l||"";return a.predicateTemplate.replace("${namespace}",u).replace("${scheme}",c).replace("${ns}",u).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=s1(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};nt=new WeakMap,Ya=new WeakMap,Ws=new WeakMap,Qe=new WeakMap;Jr.classNamesByClass=new WeakMap;var Gu=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async l=>{let{results:u,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,l);i({results:u,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:u,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);i({results:u,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var Ec="0.11.2-dev-sdna-only-prolog";var Tr=12e3;function M3(){let r=new AbortController;return setTimeout(()=>r.abort(),20),r}function pi(r,e=1e4){return re(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function pp(r){return re(this,null,function*(){try{let e=yield fetch(`http://localhost:${r}/graphql/`,{signal:M3().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return r;throw new Error(`Could not connect to port ${r}`)}catch(e){throw new Error(`Could not connect to port ${r}`)}})}function U3(){return new Promise((r,e)=>{let t=document.querySelector("ad4m-connect"),i=t==null?void 0:t.getAd4mClient();i?r(i):e("No Ad4mClient found")})}function fp(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function xc(r,e){fp()&&localStorage.setItem(`${Ec}/${r}`,e)}function Kt(r){return fp()?localStorage.getItem(`${Ec}/${r}`):null}function dp(r){fp()&&localStorage.removeItem(`${Ec}/${r}`)}var j3=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function xo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of j3(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var Ao=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Tr;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};xo(this);this.options=e,this.appName=e.appName,this.appDesc=e.appDesc,this.appDomain=e.appDomain,this.appUrl=e.appUrl,this.appIconPath=e.appIconPath,this.capabilities=e.capabilities,this.port=e.port||this.port,this.url=e.url||`ws://localhost:${this.port}/graphql`,this.token=e.token||this.token,this.isHosting=e.hosting||!1}notifyConfigChange(e,t){this.listeners.configstatechange.forEach(i=>{i(e,t)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(t=>{t(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(t=>{t(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,t){this.listeners[e].push(t)}buildTempClient(e){let t=eu({url:e,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:""}}})}),i=new ms({link:new tu(t),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new go(i)}connect(e){return re(this,null,function*(){try{if(e){yield pi(e),this.setUrl(e);let t=this.buildClient();return yield this.checkAuth(),t}else{let t=`ws://localhost:${this.port}/graphql`;yield pi(t),this.setUrl(t);let i=this.buildClient();return yield this.checkAuth(),i}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return re(this,null,function*(){console.warn("[Ad4m Connect] connectMultiUser() is deprecated. The new email verification flow is handled automatically by the UI.");try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield pi(e),this.setUrl(e);let t=this.buildClient();console.debug("[Ad4m Connect] Built client:",t);let i;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.debug("[Ad4m Connect] Login successful")}catch(a){console.debug("[Ad4m Connect] Login error:",a),console.debug("[Ad4m Connect] User does not exist, trying to create user:",this.options.userEmail);try{console.debug("[Ad4m Connect] Creating user:",this.options.userEmail);let o=yield t.agent.createUser(this.options.userEmail,this.options.userPassword);if(console.debug("[Ad4m Connect] Create result:",o),!o.success)throw new Error(o.error||"Failed to create user. Server may require email verification.");console.debug("[Ad4m Connect] Logging in user after creation:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.log("[Ad4m Connect] Successfully created and logged in user")}catch(o){throw new Error(`Failed to create/login user: ${o.message}. If email verification is enabled, please use the UI-driven flow instead.`)}}this.setToken(i);let n=this.buildClient();return yield n.agent.status(),this.ad4mClient=n,this.notifyAuthChange("authenticated"),this.notifyConnectionChange("connected"),n}catch(e){throw this.notifyConnectionChange("error"),this.notifyAuthChange("unauthenticated"),e}})}loginToHosting(e,t){return re(this,null,function*(){try{let i=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(i.status===200){let n=yield i.json();localStorage.setItem("hosting_token",n.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,xc("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield i.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(i){throw console.log(i),new Error(`Error logging in ${i}`)}})}checkEmail(e){return re(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(t){console.log(t)}})}connectToPort(e){return re(this,null,function*(){try{if(e){let t=yield pp(e);return this.setPort(t),this.buildClient()}else if(this.url.includes("localhost")){let t=yield this.findPort();return this.setPort(t),this.buildClient()}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return re(this,null,function*(){var t,i;if(((t=this.activeSocket)==null?void 0:t.readyState)===WebSocket.OPEN&&((i=this.activeSocket)==null?void 0:i.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield pi(this.url),this.buildClient()}catch(n){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return re(this,null,function*(){let e=[...Array(10).keys()].map((n,a)=>pp(Tr+a)),i=(yield Promise.allSettled(e)).find(n=>n.status==="fulfilled");if(i)return i.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url,"graphql-transport-ws")}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=eu({url:this.url,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>re(this,null,function*(){if(!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let t=yield this.connect();t?this.ad4mClient=t:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new ms({link:new tu(this.wsClient),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new go(this.apolloClient),this.ad4mClient}checkAuth(){return re(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return re(this,null,function*(){var t;if(e&&this.setToken(null),this.isHosting){let i=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+i}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(t=this.ad4mClient)==null?void 0:t.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return re(this,null,function*(){var t;try{let i=yield(t=this.ad4mClient)==null?void 0:t.agent.generateJwt(this.requestId,e);return this.setToken(i),yield this.buildClient(),yield this.checkAuth(),this.token}catch(i){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Tr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function hp({unlockAgent:r,reconnect:e}){return F`
|
|
1566
1571
|
<div class="text-center">
|
|
1567
1572
|
<div class="items">
|
|
1568
1573
|
<div>
|
|
@@ -1574,22 +1579,22 @@ WHERE ${l.join(" AND ")}
|
|
|
1574
1579
|
<button class="button" @click=${e}>Reconnect</button>
|
|
1575
1580
|
</div>
|
|
1576
1581
|
</div>
|
|
1577
|
-
`}function
|
|
1582
|
+
`}function mp({localDetected:r,multiUserConfigured:e,backendUrl:t,configuredUrl:i,isMobile:n,onConnectLocal:a,onConnectRemote:o,onScanQR:s,onDownloadAd4m:c}){let l=!n&&r,u=!0,d=n,f=!r&&!e,p=t||i;return F`
|
|
1578
1583
|
<div class="items">
|
|
1579
1584
|
<div class="text-center">
|
|
1580
1585
|
<h3 class="heading">Connect to AD4M</h3>
|
|
1581
|
-
${
|
|
1586
|
+
${r?F`
|
|
1582
1587
|
<p class="body">Choose how you want to connect:</p>
|
|
1583
|
-
`:
|
|
1588
|
+
`:F`
|
|
1584
1589
|
<p class="body" style="color: var(--body-color); opacity: 0.8;">
|
|
1585
1590
|
No local AD4M detected.
|
|
1586
|
-
${n?
|
|
1591
|
+
${n?F`Connect to a remote executor or scan a QR code.`:F`Download AD4M or connect to a remote executor.`}
|
|
1587
1592
|
</p>
|
|
1588
1593
|
`}
|
|
1589
1594
|
</div>
|
|
1590
1595
|
|
|
1591
1596
|
<div class="items items--small">
|
|
1592
|
-
${
|
|
1597
|
+
${l?F`
|
|
1593
1598
|
<div class="connection-option connection-option--primary">
|
|
1594
1599
|
<div class="connection-option__header">
|
|
1595
1600
|
<svg
|
|
@@ -1616,9 +1621,9 @@ WHERE ${l.join(" AND ")}
|
|
|
1616
1621
|
</div>
|
|
1617
1622
|
`:""}
|
|
1618
1623
|
|
|
1619
|
-
${
|
|
1624
|
+
${u?F`
|
|
1620
1625
|
<div
|
|
1621
|
-
class="connection-option ${
|
|
1626
|
+
class="connection-option ${l?"":"connection-option--primary"}"
|
|
1622
1627
|
>
|
|
1623
1628
|
<div class="connection-option__header">
|
|
1624
1629
|
<svg
|
|
@@ -1638,7 +1643,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1638
1643
|
${p?"Configured AD4M Node":"Remote AD4M"}
|
|
1639
1644
|
</h4>
|
|
1640
1645
|
</div>
|
|
1641
|
-
${p?
|
|
1646
|
+
${p?F`
|
|
1642
1647
|
<p
|
|
1643
1648
|
class="body"
|
|
1644
1649
|
style="margin: 10px 0 5px 0; font-size: 13px;"
|
|
@@ -1651,7 +1656,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1651
1656
|
>
|
|
1652
1657
|
${p}
|
|
1653
1658
|
</p>
|
|
1654
|
-
`:
|
|
1659
|
+
`:F`
|
|
1655
1660
|
<p
|
|
1656
1661
|
class="body"
|
|
1657
1662
|
style="margin: 10px 0 15px 0; font-size: 13px;"
|
|
@@ -1660,7 +1665,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1660
1665
|
</p>
|
|
1661
1666
|
`}
|
|
1662
1667
|
<button
|
|
1663
|
-
class="button ${
|
|
1668
|
+
class="button ${l?"button--secondary":""} button--full"
|
|
1664
1669
|
@click=${o}
|
|
1665
1670
|
>
|
|
1666
1671
|
${p?"Connect to Configured Node":"Enter Remote URL"}
|
|
@@ -1668,7 +1673,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1668
1673
|
</div>
|
|
1669
1674
|
`:""}
|
|
1670
1675
|
|
|
1671
|
-
${d?
|
|
1676
|
+
${d?F`
|
|
1672
1677
|
<div class="connection-option">
|
|
1673
1678
|
<div class="connection-option__header">
|
|
1674
1679
|
<svg
|
|
@@ -1697,7 +1702,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1697
1702
|
</div>
|
|
1698
1703
|
`:""}
|
|
1699
1704
|
|
|
1700
|
-
${f?
|
|
1705
|
+
${f?F`
|
|
1701
1706
|
<div class="connection-option connection-option--download">
|
|
1702
1707
|
<div class="connection-option__header">
|
|
1703
1708
|
<svg
|
|
@@ -1718,7 +1723,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1718
1723
|
</p>
|
|
1719
1724
|
<button
|
|
1720
1725
|
class="button button--full"
|
|
1721
|
-
@click=${
|
|
1726
|
+
@click=${c}
|
|
1722
1727
|
>
|
|
1723
1728
|
Download AD4M
|
|
1724
1729
|
</button>
|
|
@@ -1772,7 +1777,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1772
1777
|
opacity: 1;
|
|
1773
1778
|
}
|
|
1774
1779
|
</style>
|
|
1775
|
-
`}function
|
|
1780
|
+
`}function gp(){return F`
|
|
1776
1781
|
<div class="items">
|
|
1777
1782
|
<div class="text-center">
|
|
1778
1783
|
<h1 class="heading">Request to AD4M blocked</h1>
|
|
@@ -1793,16 +1798,16 @@ WHERE ${l.join(" AND ")}
|
|
|
1793
1798
|
</button>
|
|
1794
1799
|
</div>
|
|
1795
1800
|
</div>
|
|
1796
|
-
`}function
|
|
1801
|
+
`}function yp({reconnect:r}){return F`
|
|
1797
1802
|
<div class="items items--small">
|
|
1798
1803
|
<div class="text-center">
|
|
1799
1804
|
<h1 class="heading">Could not connect to AD4M</h1>
|
|
1800
1805
|
</div>
|
|
1801
1806
|
<div class="text-center">
|
|
1802
|
-
<button class="button" @click=${()=>
|
|
1807
|
+
<button class="button" @click=${()=>r()}>Try again</button>
|
|
1803
1808
|
</div>
|
|
1804
1809
|
</div>
|
|
1805
|
-
`}function
|
|
1810
|
+
`}function vp(){return F`<header class="dialog__header">
|
|
1806
1811
|
<div class="dialog__logo">
|
|
1807
1812
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 37" fill="none">
|
|
1808
1813
|
<path
|
|
@@ -1811,7 +1816,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1811
1816
|
/>
|
|
1812
1817
|
</svg>
|
|
1813
1818
|
</div>
|
|
1814
|
-
</header>`}function
|
|
1819
|
+
</header>`}function bp({step:r,email:e,changeEmail:t,changeState:i,password:n,changePassword:a,login:o,checkEmail:s,passwordError:c,setHostingStep:l,isHostingRunning:u,setIsHostingRunning:d}){if(u)return F`
|
|
1815
1820
|
<div class="text-center">
|
|
1816
1821
|
<p>
|
|
1817
1822
|
Hosted executor does not seem to be running. Please check the logs in your <a href="https://hosting.ad4m.dev/dashboard">ADAM hosting dashboard</a> and potentially restart your executor there.
|
|
@@ -1823,13 +1828,13 @@ WHERE ${l.join(" AND ")}
|
|
|
1823
1828
|
Back
|
|
1824
1829
|
</button>
|
|
1825
1830
|
</div>
|
|
1826
|
-
`;if(
|
|
1831
|
+
`;if(r===0)return F`
|
|
1827
1832
|
<div class="input">
|
|
1828
1833
|
<label class="input__label">EMAIL</label>
|
|
1829
1834
|
<input
|
|
1830
1835
|
class="input__field"
|
|
1831
1836
|
value=${e}
|
|
1832
|
-
@input=${f=>
|
|
1837
|
+
@input=${f=>t(f.target.value)}
|
|
1833
1838
|
/>
|
|
1834
1839
|
<div class="buttons">
|
|
1835
1840
|
<button
|
|
@@ -1846,7 +1851,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1846
1851
|
</button>
|
|
1847
1852
|
</div>
|
|
1848
1853
|
</div>
|
|
1849
|
-
`;if(
|
|
1854
|
+
`;if(r===1)return F`
|
|
1850
1855
|
<div class="input">
|
|
1851
1856
|
<label class="input__label">PASSWORD</label>
|
|
1852
1857
|
<input
|
|
@@ -1857,7 +1862,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1857
1862
|
errortext={passwordError}
|
|
1858
1863
|
error={passwordError}
|
|
1859
1864
|
/>
|
|
1860
|
-
${
|
|
1865
|
+
${c?F`<p class="error">${c}</p>`:""}
|
|
1861
1866
|
<div class="buttons">
|
|
1862
1867
|
<button
|
|
1863
1868
|
class="button button--full button-secondary"
|
|
@@ -1874,19 +1879,19 @@ WHERE ${l.join(" AND ")}
|
|
|
1874
1879
|
</button>
|
|
1875
1880
|
</div>
|
|
1876
1881
|
</div>
|
|
1877
|
-
`;if(
|
|
1882
|
+
`;if(r===2)return F`
|
|
1878
1883
|
<div class="text-center">
|
|
1879
1884
|
<p>
|
|
1880
1885
|
Email is not registered. Please follow the <a target="_blank" href="https://hosting.ad4m.dev/">link</a> to register.
|
|
1881
1886
|
</p>
|
|
1882
1887
|
<button
|
|
1883
1888
|
class="button button--full button-secondary"
|
|
1884
|
-
@click=${()=>{
|
|
1889
|
+
@click=${()=>{l(0),i("start")}}
|
|
1885
1890
|
>
|
|
1886
1891
|
Back
|
|
1887
1892
|
</button>
|
|
1888
1893
|
</div>
|
|
1889
|
-
`}function
|
|
1894
|
+
`}function _p(){return F`
|
|
1890
1895
|
<div>
|
|
1891
1896
|
<div class="lds-ring">
|
|
1892
1897
|
<div></div>
|
|
@@ -1895,20 +1900,20 @@ WHERE ${l.join(" AND ")}
|
|
|
1895
1900
|
<div></div>
|
|
1896
1901
|
</div>
|
|
1897
1902
|
</div>
|
|
1898
|
-
`}function
|
|
1903
|
+
`}function ko(){return F`
|
|
1899
1904
|
<svg width="44" height="40" viewBox="0 0 70 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1900
1905
|
<path d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" fill="#91E3FD"/>
|
|
1901
1906
|
</svg>
|
|
1902
|
-
`}function
|
|
1903
|
-
<div class="mainlogo" @click=${
|
|
1904
|
-
${
|
|
1907
|
+
`}function Sp({openModal:r}){return F`
|
|
1908
|
+
<div class="mainlogo" @click=${r}>
|
|
1909
|
+
${ko()}
|
|
1905
1910
|
</div>
|
|
1906
|
-
`}function
|
|
1911
|
+
`}function wp({email:r,password:e,verificationCode:t,error:i,isLoading:n,backendUrl:a,step:o,verificationType:s,changeEmail:c,changePassword:l,changeVerificationCode:u,onEmailSubmit:d,onPasswordSubmit:f,onCodeSubmit:p,onBackToEmail:h}){return o==="email"?F`
|
|
1907
1912
|
<div class="items">
|
|
1908
1913
|
<div class="text-center">
|
|
1909
1914
|
<h3 class="heading">Sign in or Sign up</h3>
|
|
1910
1915
|
<p class="body">Enter your email to continue</p>
|
|
1911
|
-
${a?
|
|
1916
|
+
${a?F`
|
|
1912
1917
|
<p
|
|
1913
1918
|
class="body"
|
|
1914
1919
|
style="margin-top: 10px; font-size: 12px; opacity: 0.7; font-family: monospace;"
|
|
@@ -1918,7 +1923,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1918
1923
|
`:""}
|
|
1919
1924
|
</div>
|
|
1920
1925
|
|
|
1921
|
-
${i?
|
|
1926
|
+
${i?F`
|
|
1922
1927
|
<div class="error-message">
|
|
1923
1928
|
<p>${i}</p>
|
|
1924
1929
|
</div>
|
|
@@ -1932,9 +1937,9 @@ WHERE ${l.join(" AND ")}
|
|
|
1932
1937
|
type="email"
|
|
1933
1938
|
class="input__field"
|
|
1934
1939
|
placeholder="your@email.com"
|
|
1935
|
-
.value=${
|
|
1936
|
-
@input=${m=>
|
|
1937
|
-
@keypress=${m=>{m.key==="Enter"&&
|
|
1940
|
+
.value=${r}
|
|
1941
|
+
@input=${m=>c(m.target.value)}
|
|
1942
|
+
@keypress=${m=>{m.key==="Enter"&&r&&!n&&d()}}
|
|
1938
1943
|
?disabled=${n}
|
|
1939
1944
|
autofocus
|
|
1940
1945
|
/>
|
|
@@ -1945,7 +1950,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1945
1950
|
<button
|
|
1946
1951
|
class="button button--full"
|
|
1947
1952
|
@click=${d}
|
|
1948
|
-
?disabled=${n||!
|
|
1953
|
+
?disabled=${n||!r}
|
|
1949
1954
|
>
|
|
1950
1955
|
${n?"Checking...":"Continue"}
|
|
1951
1956
|
</button>
|
|
@@ -1966,17 +1971,17 @@ WHERE ${l.join(" AND ")}
|
|
|
1966
1971
|
margin: 0;
|
|
1967
1972
|
}
|
|
1968
1973
|
</style>
|
|
1969
|
-
`:o==="password"?
|
|
1974
|
+
`:o==="password"?F`
|
|
1970
1975
|
<div class="items">
|
|
1971
1976
|
<div class="text-center">
|
|
1972
1977
|
<h3 class="heading">${s==="signup"?"Create your account":"Sign in to your account"}</h3>
|
|
1973
|
-
<p class="body">Email: <strong>${
|
|
1978
|
+
<p class="body">Email: <strong>${r}</strong></p>
|
|
1974
1979
|
<p class="body" style="margin-top: 10px;">
|
|
1975
1980
|
${s==="signup"?"Choose a password to create your account":"Enter your password to sign in"}
|
|
1976
1981
|
</p>
|
|
1977
1982
|
</div>
|
|
1978
1983
|
|
|
1979
|
-
${i?
|
|
1984
|
+
${i?F`
|
|
1980
1985
|
<div class="error-message">
|
|
1981
1986
|
<p>${i}</p>
|
|
1982
1987
|
</div>
|
|
@@ -1991,7 +1996,7 @@ WHERE ${l.join(" AND ")}
|
|
|
1991
1996
|
class="input__field"
|
|
1992
1997
|
placeholder="${s==="signup"?"Enter a strong password":"Enter your password"}"
|
|
1993
1998
|
.value=${e}
|
|
1994
|
-
@input=${m=>
|
|
1999
|
+
@input=${m=>l(m.target.value)}
|
|
1995
2000
|
@keypress=${m=>{m.key==="Enter"&&e&&!n&&f()}}
|
|
1996
2001
|
?disabled=${n}
|
|
1997
2002
|
autofocus
|
|
@@ -2035,20 +2040,20 @@ WHERE ${l.join(" AND ")}
|
|
|
2035
2040
|
margin: 0;
|
|
2036
2041
|
}
|
|
2037
2042
|
</style>
|
|
2038
|
-
`:o==="code"?
|
|
2043
|
+
`:o==="code"?F`
|
|
2039
2044
|
<div class="items">
|
|
2040
2045
|
<div class="text-center">
|
|
2041
2046
|
<h3 class="heading">Check your email</h3>
|
|
2042
2047
|
<p class="body">
|
|
2043
2048
|
We've sent a 6-digit verification code to
|
|
2044
|
-
<strong>${
|
|
2049
|
+
<strong>${r}</strong>
|
|
2045
2050
|
</p>
|
|
2046
2051
|
<p class="body" style="margin-top: 10px; font-size: 12px; opacity: 0.7;">
|
|
2047
2052
|
The code will expire in 15 minutes
|
|
2048
2053
|
</p>
|
|
2049
2054
|
</div>
|
|
2050
2055
|
|
|
2051
|
-
${i?
|
|
2056
|
+
${i?F`
|
|
2052
2057
|
<div class="error-message">
|
|
2053
2058
|
<p>${i}</p>
|
|
2054
2059
|
</div>
|
|
@@ -2065,8 +2070,8 @@ WHERE ${l.join(" AND ")}
|
|
|
2065
2070
|
maxlength="6"
|
|
2066
2071
|
class="input__field code-input"
|
|
2067
2072
|
placeholder="000000"
|
|
2068
|
-
.value=${
|
|
2069
|
-
@input=${m=>{let
|
|
2073
|
+
.value=${t}
|
|
2074
|
+
@input=${m=>{let w=m.target.value.replace(/\D/g,"");u(w)}}
|
|
2070
2075
|
?disabled=${n}
|
|
2071
2076
|
autofocus
|
|
2072
2077
|
/>
|
|
@@ -2077,7 +2082,7 @@ WHERE ${l.join(" AND ")}
|
|
|
2077
2082
|
<button
|
|
2078
2083
|
class="button button--full"
|
|
2079
2084
|
@click=${p}
|
|
2080
|
-
?disabled=${n||
|
|
2085
|
+
?disabled=${n||t.length!==6}
|
|
2081
2086
|
>
|
|
2082
2087
|
${n?"Verifying...":"Verify Code"}
|
|
2083
2088
|
</button>
|
|
@@ -2123,14 +2128,14 @@ WHERE ${l.join(" AND ")}
|
|
|
2123
2128
|
opacity: 0.8;
|
|
2124
2129
|
}
|
|
2125
2130
|
</style>
|
|
2126
|
-
`:
|
|
2131
|
+
`:F``}function Cp({initialUrl:r,detecting:e,multiUserDetected:t,error:i,onBack:n,onUrlChange:a,onConnect:o,onMultiUserAuth:s,onRequestCapability:c}){let l=t!==null&&!e,u=r||"";return F`
|
|
2127
2132
|
<div class="items">
|
|
2128
2133
|
<div class="text-center">
|
|
2129
2134
|
<h3 class="heading">Connect to Remote AD4M</h3>
|
|
2130
2135
|
<p class="body">Enter the URL of a remote AD4M executor</p>
|
|
2131
2136
|
</div>
|
|
2132
2137
|
|
|
2133
|
-
${
|
|
2138
|
+
${l?F`
|
|
2134
2139
|
<div class="items items--small">
|
|
2135
2140
|
<div class="remote-info">
|
|
2136
2141
|
<p class="body" style="margin: 0 0 5px 0; font-size: 13px;">
|
|
@@ -2140,11 +2145,11 @@ WHERE ${l.join(" AND ")}
|
|
|
2140
2145
|
class="body"
|
|
2141
2146
|
style="margin: 0; font-family: monospace; font-size: 12px; opacity: 0.8;"
|
|
2142
2147
|
>
|
|
2143
|
-
${
|
|
2148
|
+
${u}
|
|
2144
2149
|
</p>
|
|
2145
2150
|
</div>
|
|
2146
2151
|
|
|
2147
|
-
${
|
|
2152
|
+
${t?F`
|
|
2148
2153
|
<div class="auth-option auth-option--primary">
|
|
2149
2154
|
<div class="auth-option__header">
|
|
2150
2155
|
<svg
|
|
@@ -2209,12 +2214,12 @@ WHERE ${l.join(" AND ")}
|
|
|
2209
2214
|
</p>
|
|
2210
2215
|
<button
|
|
2211
2216
|
class="button button--secondary button--full"
|
|
2212
|
-
@click=${
|
|
2217
|
+
@click=${c}
|
|
2213
2218
|
>
|
|
2214
2219
|
Request Capability
|
|
2215
2220
|
</button>
|
|
2216
2221
|
</div>
|
|
2217
|
-
`:
|
|
2222
|
+
`:F`
|
|
2218
2223
|
<div class="auth-option auth-option--primary">
|
|
2219
2224
|
<div class="auth-option__header">
|
|
2220
2225
|
<svg
|
|
@@ -2247,7 +2252,7 @@ WHERE ${l.join(" AND ")}
|
|
|
2247
2252
|
</p>
|
|
2248
2253
|
<button
|
|
2249
2254
|
class="button button--full"
|
|
2250
|
-
@click=${
|
|
2255
|
+
@click=${c}
|
|
2251
2256
|
>
|
|
2252
2257
|
Request Capability
|
|
2253
2258
|
</button>
|
|
@@ -2264,7 +2269,7 @@ WHERE ${l.join(" AND ")}
|
|
|
2264
2269
|
</button>
|
|
2265
2270
|
</div>
|
|
2266
2271
|
</div>
|
|
2267
|
-
`:
|
|
2272
|
+
`:F`
|
|
2268
2273
|
<div class="items items--small">
|
|
2269
2274
|
<div class="input">
|
|
2270
2275
|
<label class="input__label" for="remote-url">
|
|
@@ -2275,13 +2280,13 @@ WHERE ${l.join(" AND ")}
|
|
|
2275
2280
|
type="text"
|
|
2276
2281
|
class="input__field"
|
|
2277
2282
|
placeholder="wss://your-server.com/graphql"
|
|
2278
|
-
.value=${
|
|
2283
|
+
.value=${u}
|
|
2279
2284
|
@input=${d=>a(d.target.value)}
|
|
2280
2285
|
?disabled=${e}
|
|
2281
2286
|
/>
|
|
2282
2287
|
</div>
|
|
2283
2288
|
|
|
2284
|
-
${i?
|
|
2289
|
+
${i?F`
|
|
2285
2290
|
<div class="error-message">
|
|
2286
2291
|
<p>${i}</p>
|
|
2287
2292
|
</div>
|
|
@@ -2298,7 +2303,7 @@ WHERE ${l.join(" AND ")}
|
|
|
2298
2303
|
<button
|
|
2299
2304
|
class="button"
|
|
2300
2305
|
@click=${o}
|
|
2301
|
-
?disabled=${e||!
|
|
2306
|
+
?disabled=${e||!u}
|
|
2302
2307
|
>
|
|
2303
2308
|
${e?"Detecting...":"Connect"}
|
|
2304
2309
|
</button>
|
|
@@ -2367,22 +2372,22 @@ WHERE ${l.join(" AND ")}
|
|
|
2367
2372
|
margin: 0;
|
|
2368
2373
|
}
|
|
2369
2374
|
</style>
|
|
2370
|
-
`}function
|
|
2375
|
+
`}function Ep({capabilities:r,appname:e,appiconpath:t,changeState:i,setOpen:n,requestCapability:a}){return F`
|
|
2371
2376
|
<div class="items">
|
|
2372
2377
|
<div class="text-center">
|
|
2373
2378
|
<p class="body">An external application</p>
|
|
2374
2379
|
<h1 class="heading nomargin">${e}</h1>
|
|
2375
2380
|
<p class="body">wants to access your AD4M data</p>
|
|
2376
2381
|
</div>
|
|
2377
|
-
${
|
|
2378
|
-
<img class="dialog__connect-app" src=${
|
|
2382
|
+
${t&&F`<div class="dialog__connect">
|
|
2383
|
+
<img class="dialog__connect-app" src=${t} alt="Logo" />
|
|
2379
2384
|
<div class="dialog__connect-check"></div>
|
|
2380
|
-
<div class="dialog__connect-ad4m">${
|
|
2385
|
+
<div class="dialog__connect-ad4m">${ko()}</div>
|
|
2381
2386
|
</div>`}
|
|
2382
2387
|
<div>
|
|
2383
2388
|
<p class="text-center"><b>This will allow the developer to:</b></p>
|
|
2384
2389
|
<ul class="check-list">
|
|
2385
|
-
${
|
|
2390
|
+
${r.map(o=>F`<li>
|
|
2386
2391
|
<span>
|
|
2387
2392
|
<svg
|
|
2388
2393
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -2421,12 +2426,12 @@ WHERE ${l.join(" AND ")}
|
|
|
2421
2426
|
Connection settings
|
|
2422
2427
|
</button>
|
|
2423
2428
|
</div>
|
|
2424
|
-
`}function
|
|
2429
|
+
`}function xp({changeState:r,onSuccess:e,uiState:t}){function i(n){let a=new BarcodeDetector,o=n.currentTarget,s=()=>re(this,null,function*(){try{if(t!=="qr")return;let l=(yield a.detect(o)).find(u=>u.format==="qr_code");if(l!=null&&l.rawValue){r("requestcap"),e(l.rawValue);return}else requestAnimationFrame(s)}catch(c){console.error(c)}});s()}return F`
|
|
2425
2430
|
<div class="qr-scanner">
|
|
2426
2431
|
<div class="qr-content">
|
|
2427
2432
|
<button
|
|
2428
2433
|
class="button button--primary stop"
|
|
2429
|
-
@click=${()=>
|
|
2434
|
+
@click=${()=>r("start")}
|
|
2430
2435
|
>
|
|
2431
2436
|
Stop scanning
|
|
2432
2437
|
</button>
|
|
@@ -2440,21 +2445,21 @@ WHERE ${l.join(" AND ")}
|
|
|
2440
2445
|
></video>
|
|
2441
2446
|
</div>
|
|
2442
2447
|
</div>
|
|
2443
|
-
`}function
|
|
2448
|
+
`}function Ap({port:r,url:e,isRemote:t,connectToPort:i,changeIsRemote:n,connectRemote:a,changeState:o,changeUrl:s,changePort:c,clearState:l}){return F`
|
|
2444
2449
|
<div class="items items--small">
|
|
2445
2450
|
<div class="text-center">
|
|
2446
2451
|
<h1 class="heading">Connection Settings</h1>
|
|
2447
2452
|
<p class="body">Please choose how you want to connect to AD4M</p>
|
|
2448
2453
|
</div>
|
|
2449
2454
|
<div style="display: flex; gap: 10px;">
|
|
2450
|
-
<button class=${`button ${
|
|
2455
|
+
<button class=${`button ${t?"button--secondary":"button--primary"}`} @click=${()=>n(!1)}>
|
|
2451
2456
|
Locally
|
|
2452
2457
|
</button>
|
|
2453
|
-
<button class=${`button ${
|
|
2458
|
+
<button class=${`button ${t?"button--primary":"button--secondary"}`} @click=${()=>n(!0)}>
|
|
2454
2459
|
Remotely
|
|
2455
2460
|
</button>
|
|
2456
2461
|
</div>
|
|
2457
|
-
${
|
|
2462
|
+
${t?F`
|
|
2458
2463
|
<div class="input">
|
|
2459
2464
|
<label class="input__label">URL</label>
|
|
2460
2465
|
<input
|
|
@@ -2471,20 +2476,20 @@ WHERE ${l.join(" AND ")}
|
|
|
2471
2476
|
Connect
|
|
2472
2477
|
</button>
|
|
2473
2478
|
</div>
|
|
2474
|
-
`:
|
|
2479
|
+
`:F`
|
|
2475
2480
|
<div class="input">
|
|
2476
2481
|
<label class="input__label">PORT</label>
|
|
2477
2482
|
<input
|
|
2478
2483
|
class="input__field"
|
|
2479
|
-
value=${
|
|
2480
|
-
@input=${f=>
|
|
2484
|
+
value=${r}
|
|
2485
|
+
@input=${f=>c(parseInt(f.target.value))}
|
|
2481
2486
|
/>
|
|
2482
2487
|
</div>
|
|
2483
2488
|
|
|
2484
2489
|
<div class="buttons">
|
|
2485
2490
|
<button
|
|
2486
2491
|
class="button button--full"
|
|
2487
|
-
@click=${()=>i(
|
|
2492
|
+
@click=${()=>i(r)}
|
|
2488
2493
|
>
|
|
2489
2494
|
Connect
|
|
2490
2495
|
</button>
|
|
@@ -2501,17 +2506,17 @@ WHERE ${l.join(" AND ")}
|
|
|
2501
2506
|
</button>
|
|
2502
2507
|
<button
|
|
2503
2508
|
class="button button--full button--secondary"
|
|
2504
|
-
@click=${
|
|
2509
|
+
@click=${l}
|
|
2505
2510
|
>
|
|
2506
2511
|
Clear state
|
|
2507
2512
|
</button>
|
|
2508
2513
|
</div
|
|
2509
2514
|
</div>
|
|
2510
|
-
`}function
|
|
2515
|
+
`}function kp({connect:r,isMobile:e,hasClickedDownload:t,changeState:i,onDownloaded:n,scanQrcode:a,hosting:o}){let c=(Kt("ad4murl")||`http://localhost:${Tr}`).includes("localhost");function l(u){u.preventDefault();let d=u.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return F`
|
|
2511
2516
|
<div class="items">
|
|
2512
|
-
${
|
|
2517
|
+
${t?F`
|
|
2513
2518
|
<div class="text-center">
|
|
2514
|
-
<a class="button" target="_blank" @click=${()=>
|
|
2519
|
+
<a class="button" target="_blank" @click=${()=>r()}>
|
|
2515
2520
|
Connect to ADAM
|
|
2516
2521
|
</a>
|
|
2517
2522
|
<p>
|
|
@@ -2519,17 +2524,17 @@ WHERE ${l.join(" AND ")}
|
|
|
2519
2524
|
ADAM agent
|
|
2520
2525
|
</p>
|
|
2521
2526
|
</div>
|
|
2522
|
-
`:
|
|
2527
|
+
`:F`
|
|
2523
2528
|
<div class="text-center">
|
|
2524
2529
|
<h1 class="heading">Could not connect to AD4M</h1>
|
|
2525
|
-
${
|
|
2530
|
+
${c?F`
|
|
2526
2531
|
<p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
|
|
2527
2532
|
Please make sure you have the ADAM Launcher running on your computer and there are no browser restrictions ("Shields") blocking your connection to ADAM on localhost.
|
|
2528
2533
|
<br/>
|
|
2529
2534
|
<br/>
|
|
2530
2535
|
(Safari users: please use a different browser for now. Safari is very strict about this and we are working on a solution.)
|
|
2531
2536
|
</p>
|
|
2532
|
-
`:
|
|
2537
|
+
`:F`
|
|
2533
2538
|
<p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
|
|
2534
2539
|
Looks like the remote executor you are trying to connect to is not reachable.
|
|
2535
2540
|
<br/>
|
|
@@ -2537,24 +2542,24 @@ WHERE ${l.join(" AND ")}
|
|
|
2537
2542
|
Please try connecting to a different remote executor or check your connection settings.
|
|
2538
2543
|
</p>
|
|
2539
2544
|
`}
|
|
2540
|
-
${e?
|
|
2545
|
+
${e?F`<button class="button" @click=${()=>a()}>
|
|
2541
2546
|
Connect with QR
|
|
2542
|
-
</button>`:
|
|
2547
|
+
</button>`:F`<a
|
|
2543
2548
|
class="button"
|
|
2544
2549
|
target="_blank"
|
|
2545
|
-
@click=${
|
|
2550
|
+
@click=${l}
|
|
2546
2551
|
href="https://github.com/coasys/ad4m/releases"
|
|
2547
2552
|
>
|
|
2548
2553
|
Download AD4M
|
|
2549
2554
|
</a>
|
|
2550
2555
|
`}
|
|
2551
|
-
${o?
|
|
2552
|
-
${o?
|
|
2556
|
+
${o?F`<p>Or</p>`:""}
|
|
2557
|
+
${o?F`<button class="button" @click=${()=>i("hosting")}>Use hosted AD4M (alpha)</button>`:""}
|
|
2553
2558
|
</div>
|
|
2554
2559
|
|
|
2555
2560
|
<div style="display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: -30px">
|
|
2556
2561
|
or
|
|
2557
|
-
<button class="button button--secondary" @click=${()=>
|
|
2562
|
+
<button class="button button--secondary" @click=${()=>r()}>
|
|
2558
2563
|
Try reconnecting
|
|
2559
2564
|
</button>
|
|
2560
2565
|
or
|
|
@@ -2573,7 +2578,7 @@ WHERE ${l.join(" AND ")}
|
|
|
2573
2578
|
</a>
|
|
2574
2579
|
</div>
|
|
2575
2580
|
</div>
|
|
2576
|
-
`}function
|
|
2581
|
+
`}function Tp({code:r,changeState:e,verifyCode:t,changeCode:i,isHosting:n,verifyCodeError:a}){return F`
|
|
2577
2582
|
<div class="items">
|
|
2578
2583
|
<div class="text-center">
|
|
2579
2584
|
<div class="heading">${n?"Please check your emails for the 2FA security code that was sent from the ADAM hosting service":"Please check your ADAM Launcher"}</div>
|
|
@@ -2588,10 +2593,10 @@ WHERE ${l.join(" AND ")}
|
|
|
2588
2593
|
type="tel"
|
|
2589
2594
|
placeholder="XXXXXX"
|
|
2590
2595
|
class="input__field"
|
|
2591
|
-
value=${
|
|
2596
|
+
value=${r}
|
|
2592
2597
|
@change=${o=>i(o.target.value)}
|
|
2593
2598
|
/>
|
|
2594
|
-
${a?
|
|
2599
|
+
${a?F`<p class="error">${a}</p>`:""}
|
|
2595
2600
|
</div>
|
|
2596
2601
|
<div class="buttons">
|
|
2597
2602
|
<button
|
|
@@ -2600,12 +2605,12 @@ WHERE ${l.join(" AND ")}
|
|
|
2600
2605
|
>
|
|
2601
2606
|
Back
|
|
2602
2607
|
</button>
|
|
2603
|
-
<button class="button button--full" @click=${()=>r
|
|
2608
|
+
<button class="button button--full" @click=${()=>t(r)}>
|
|
2604
2609
|
Continue
|
|
2605
2610
|
</button>
|
|
2606
2611
|
</div>
|
|
2607
2612
|
</div>
|
|
2608
|
-
`}function
|
|
2613
|
+
`}function q3(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>navigator.userAgent.match(e))}var B3=Tc`
|
|
2609
2614
|
:host {
|
|
2610
2615
|
--primary-color: #fff;
|
|
2611
2616
|
--heading-color: #fff;
|
|
@@ -3006,16 +3011,16 @@ WHERE ${l.join(" AND ")}
|
|
|
3006
3011
|
width: 100vw;
|
|
3007
3012
|
object-fit: cover;
|
|
3008
3013
|
}
|
|
3009
|
-
`,ee=class extends Pr{constructor(){super(...arguments);this._code=null;this._isMobile=null;this._hasClickedDownload=null;this._isRemote=!1;this._isOpen=!1;this._hostingStep=0;this._email="";this._passowrd="";this._passwordError=null;this._hostingNotRunningError=null;this._verifyCodeError=null;this._isHostingLoading=!1;this._multiUserEmail="";this._multiUserPassword="";this._multiUserVerificationCode="";this._multiUserError=null;this._multiUserLoading=!1;this._codeSubmitTimeout=null;this._multiUserStep="email";this._multiUserVerificationType="login";this._localDetected=!1;this._remoteUrl="";this._remoteMultiUserDetected=null;this._remoteDetecting=!1;this._remoteError=null;this.uiState="connection_overview";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=Kt("ad4mhosting")==="true"||!1;this.token=Kt("ad4mToken")||"";this.port=parseInt(Kt("ad4mport"))||Or;this.url=Kt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href","https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap"),document.head.appendChild(r)}connectedCallback(){super.connectedCallback(),Co(this),this.injectFont(),this._isMobile=j3(),this._client=new Eo({appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath,capabilities:Array.isArray(this.capabilities)?this.capabilities:JSON.parse(this.capabilities),port:this.port||parseInt(Kt("ad4mport"))||Or,token:this.token||Kt("ad4mtoken"),url:this.url||Kt("ad4murl"),hosting:this.hosting}),this._client.on("configstatechange",this.handleConfigChange),this._client.on("authstatechange",this.handleAuthChange),this._client.on("connectionstatechange",this.handleConnectionChange),this.loadFont(),this.token||Kt("ad4mtoken")?this.multiUser&&this.backendUrl?this._client.connect(this.backendUrl):this._client.connect():(this.detectLocal(),this.changeUIState("connection_overview"),this._isOpen=!0)}checkEmail(){return re(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(r){console.log(r)}})}handleMultiUserEmailSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let r=this._client.buildTempClient(this.backendUrl),i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield r.agent.requestLoginVerification(this._multiUserEmail,i);n.success&&!n.requiresPassword?(this._multiUserStep="code",this._multiUserVerificationType="login"):n.requiresPassword?(this._multiUserStep="password",this._multiUserVerificationType=n.isExistingUser?"login":"signup"):this._multiUserError=n.message||"Failed to send verification email"}catch(r){this._multiUserError=r.message||"Failed to process email. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserPasswordSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let r=this._client.buildTempClient(this.backendUrl);if(this._multiUserVerificationType==="login")try{let i=yield r.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(i){this._multiUserError=i.message||"Invalid email or password. Please try again."}else{let i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield r.agent.createUser(this._multiUserEmail,this._multiUserPassword,i);if(n.success)if(n.error&&n.error.includes("SMTP is not configured"))try{let a=yield r.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(a),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(a){this._multiUserError=a.message||"Account created but login failed. Please try logging in."}else n.error?this._multiUserError=n.error+" You can try logging in with your password.":(this._multiUserStep="code",this._multiUserVerificationType="signup");else this._multiUserError=n.error||"Failed to create account. Please try again."}}catch(r){this._multiUserError=r.message||"Failed to process request. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserCodeSubmit(){return re(this,null,function*(){if(!this._multiUserLoading){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null);try{this._multiUserLoading=!0,this._multiUserError=null;let i=yield this._client.buildTempClient(this.backendUrl).agent.verifyEmailCode(this._multiUserEmail,this._multiUserVerificationCode,this._multiUserVerificationType);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(r){this._multiUserError="Invalid or expired code. Please try again.",this._multiUserVerificationCode=""}finally{this._multiUserLoading=!1}}})}handleMultiUserBackToEmail(){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserStep="email",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserError=null}changeMultiUserEmail(r){this._multiUserEmail=r,this._multiUserError=null}changeMultiUserPassword(r){this._multiUserPassword=r,this._multiUserError=null}changeMultiUserVerificationCode(r){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserVerificationCode=r,this._multiUserError=null,r.length===6&&!this._multiUserLoading&&(this._codeSubmitTimeout=setTimeout(()=>{this._codeSubmitTimeout=null,this._multiUserVerificationCode.length===6&&!this._multiUserLoading&&this.handleMultiUserCodeSubmit()},100))}detectLocal(){return re(this,null,function*(){try{yield fi(`ws://localhost:${this.port}/graphql`,3e3),this._localDetected=!0}catch(r){console.log("[Ad4m Connect] Local detection failed:",r),this._localDetected=!1}})}verifyAd4mApi(r){return re(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",r);let i=this._client.buildTempClient(r);try{yield i.runtime.info(),console.log("[Ad4m Connect] AD4M API verified")}catch(n){throw console.error("[Ad4m Connect] Failed to verify AD4M API:",n),new Error("Server is reachable but doesn't appear to be an AD4M executor. Make sure the URL includes '/graphql'.")}})}detectRemoteMultiUser(r){return re(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",r);let i=this._client.buildTempClient(r);try{let n=yield i.runtime.multiUserEnabled();return console.log("[Ad4m Connect] Multi-user detection result:",n),n}catch(n){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",n),console.error("[Ad4m Connect] Error details:",n.message,n.stack),!1}})}handleConnectLocal(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect()}catch(r){console.error("Failed to connect to local AD4M:",r),this.changeUIState("connection_overview")}})}handleShowRemoteConnection(){this._remoteUrl=this.backendUrl||this.url||"",this._remoteMultiUserDetected=null,this._remoteError=null,this.changeUIState("remote_connection")}handleRemoteUrlChange(r){this._remoteUrl=r,this._remoteError=null}handleRemoteConnect(){return re(this,null,function*(){if(!this._remoteUrl){this._remoteError="Please enter a URL";return}this._remoteDetecting=!0,this._remoteError=null,this._remoteMultiUserDetected=null;try{console.log("[Ad4m Connect] Checking if server is reachable:",this._remoteUrl),yield fi(this._remoteUrl,5e3),console.log("[Ad4m Connect] Server is reachable"),yield this.verifyAd4mApi(this._remoteUrl);let r=yield this.detectRemoteMultiUser(this._remoteUrl);this._remoteMultiUserDetected=r,this._remoteDetecting=!1}catch(r){console.error("[Ad4m Connect] Connection/detection failed:",r),this._remoteError=r.message||"Cannot reach server at this URL. Please check the URL and try again.",this._remoteMultiUserDetected=null,this._remoteDetecting=!1}})}handleRemoteMultiUserAuth(){return re(this,null,function*(){this.backendUrl=this._remoteUrl,this.changeUIState("multiuser_auth")})}handleRemoteRequestCapability(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect(this._remoteUrl)}catch(r){this._remoteError=r.message||"Failed to connect",this.changeUIState("remote_connection")}})}loginToHosting(){return re(this,null,function*(){try{yield this._client.loginToHosting(this._email,this._passowrd),this.changeUIState("connected")}catch(r){r.message.includes("Passwords did not match")?this._passwordError="Passwords did not match":this._hostingNotRunningError="Hosting is not running"}})}changeEmail(r){this._email=r}changePassword(r){this._passowrd=r}unlockAgent(r,i=!0){return re(this,null,function*(){yield this._client.ad4mClient.agent.unlock(r,i)})}verifyCode(r){return re(this,null,function*(){try{yield this._client.verifyCode(r)}catch(i){this._verifyCodeError="Invalid code"}})}changeUrl(r){r!==this._client.url&&(fp("ad4mtoken"),this._client.setToken(null)),this._client.setUrl(r)}changePort(r){this._client.setPort(r)}changeUIState(r){this.uiState=r}setIsHostingRunning(r){this._hostingNotRunningError=r}changeIsRemote(r){this._isRemote=r}changeCode(r){this._code=r}onDownloaded(){this._hasClickedDownload=!0}handleAuthChange(r){let i=new CustomEvent("authstatechange",{detail:r});r==="locked"&&(this._isOpen=!0),r==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(i),this.requestUpdate()}handleConfigChange(r,i){this[r]=i,i?Ec("ad4m"+r,i):fp("ad4m"+r),this.requestUpdate()}handleConnectionChange(r){if(r==="checking_local"){this._isOpen=!1;return}r==="connected"&&(this.authState!=="authenticated"?(this.changeUIState("requestcap"),this._isOpen=!0):(this.changeUIState("connected"),this._isOpen=!1)),r==="disconnected"&&(this._isOpen=!0),r==="not_connected"&&(this._isOpen=!0,this.multiUser&&this.backendUrl?this.changeUIState("multiuser_auth"):this.changeUIState("start"));let i=new CustomEvent("connectionstatechange",{detail:r});this.dispatchEvent(i),this.requestUpdate()}loadFont(){let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.crossOrigin="anonymous",r.href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap",document.head.appendChild(r)}startCamera(r){return re(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(i){window.BarcodeDetector=Nr}yield this.changeUIState("qr"),setTimeout(()=>re(this,null,function*(){let i=this.shadowRoot.querySelector("video");if(!i)return;let n=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});i.srcObject=n,i.autoplay=!0}),100)})}connect(){return re(this,null,function*(){this._isOpen=!0,this.requestUpdate();let r=yield this._client.connect();try{let i=yield r.agent.status();i.isUnlocked&&i.isInitialized&&window.location.reload()}catch(i){console.warn(i)}return r})}getAd4mClient(){return this._client.ad4mClient}connectRemote(r){return re(this,null,function*(){try{this.changeUrl(r);let i=yield this._client.connect(r),n=yield i.agent.status();return n.isUnlocked&&n.isInitialized||this.changeUIState("requestcap"),i}catch(i){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(r){return re(this,null,function*(){try{yield this._client.requestCapability(r),this.changeUIState("verifycode")}catch(i){console.warn(i)}})}isAuthenticated(){return re(this,null,function*(){return this._client.checkAuth()})}setOpen(r){this._isOpen=r}setHostingStep(r){this._hostingStep=r}clearState(){this.handleConfigChange("port",null),this.handleConfigChange("url",null),this.handleConfigChange("token",null),this.handleConnectionChange("not_connected"),this.handleAuthChange("unauthenticated"),this.changeUIState("start"),this._client.clearState()}renderViews(){if(this.connectionState==="connecting")return bp();if(this.uiState==="connection_overview")return hp({localDetected:this._localDetected,multiUserConfigured:this.multiUser&&!!this.backendUrl,backendUrl:this.backendUrl,configuredUrl:this.url,isMobile:this._isMobile,onConnectLocal:this.handleConnectLocal,onConnectRemote:this.handleShowRemoteConnection,onScanQR:()=>{this.startCamera(null)},onDownloadAd4m:()=>{window.open("https://github.com/coasys/ad4m/releases")}});if(this.uiState==="remote_connection")return wp({initialUrl:this._remoteUrl,detecting:this._remoteDetecting,multiUserDetected:this._remoteMultiUserDetected,error:this._remoteError,onBack:()=>this.changeUIState("connection_overview"),onUrlChange:this.handleRemoteUrlChange,onConnect:this.handleRemoteConnect,onMultiUserAuth:this.handleRemoteMultiUserAuth,onRequestCapability:this.handleRemoteRequestCapability});if(this.uiState==="multiuser_auth")return Sp({email:this._multiUserEmail,password:this._multiUserPassword,verificationCode:this._multiUserVerificationCode,error:this._multiUserError,isLoading:this._multiUserLoading,backendUrl:this.backendUrl,step:this._multiUserStep,verificationType:this._multiUserVerificationType,changeEmail:this.changeMultiUserEmail,changePassword:this.changeMultiUserPassword,changeVerificationCode:this.changeMultiUserVerificationCode,onEmailSubmit:this.handleMultiUserEmailSubmit,onPasswordSubmit:this.handleMultiUserPasswordSubmit,onCodeSubmit:this.handleMultiUserCodeSubmit,onBackToEmail:this.handleMultiUserBackToEmail});if(this.uiState==="hosting")return vp({email:this._email,password:this._passowrd,changeEmail:this.changeEmail,changePassword:this.changePassword,changeState:this.changeUIState,step:this._hostingStep,setHostingStep:this.setHostingStep,login:this.loginToHosting,checkEmail:this.checkEmail,passwordError:this._passwordError,isHostingRunning:this._hostingNotRunningError,setIsHostingRunning:this.setIsHostingRunning});if(this.uiState==="qr")return Ep({changeState:this.changeUIState,onSuccess:r=>{this.changeUrl(r),this._client.connect(r)},uiState:this.uiState});if(this.authState==="locked")return dp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return xp({port:this.port,changePort:this.changePort,isRemote:this._isRemote,changeIsRemote:this.changeIsRemote,url:this.url,changeState:this.changeUIState,changeUrl:this.changeUrl,connectToPort:this._client.connectToPort,connectRemote:this.connectRemote,clearState:this.clearState});if(this.connectionState==="not_connected")return Ap({scanQrcode:this.startCamera,connect:this.connect,isMobile:this._isMobile,hasClickedDownload:this._hasClickedDownload,onDownloaded:this.onDownloaded,changeState:this.changeUIState,hosting:this.hosting});if(this.connectionState==="connected")return this.uiState==="verifycode"?kp({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):Cp({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return gp({reconnect:this.connect});if(this.connectionState==="port_not_found")return mp()}mobileView(){return this.mobile?_p({openModal:()=>{this.changeUIState("settings"),this._isOpen=!this._isOpen}}):null}render(){return console.log(this.authState,this.connectionState,this.uiState,this._isOpen),this._isOpen===!1?this.authState==="authenticated"?this.mobileView():null:L`
|
|
3014
|
+
`,ee=class extends Nr{constructor(){super(...arguments);this._code=null;this._isMobile=null;this._hasClickedDownload=null;this._isRemote=!1;this._isOpen=!1;this._hostingStep=0;this._email="";this._passowrd="";this._passwordError=null;this._hostingNotRunningError=null;this._verifyCodeError=null;this._isHostingLoading=!1;this._multiUserEmail="";this._multiUserPassword="";this._multiUserVerificationCode="";this._multiUserError=null;this._multiUserLoading=!1;this._codeSubmitTimeout=null;this._multiUserStep="email";this._multiUserVerificationType="login";this._localDetected=!1;this._remoteUrl="";this._remoteMultiUserDetected=null;this._remoteDetecting=!1;this._remoteError=null;this.uiState="connection_overview";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=Kt("ad4mhosting")==="true"||!1;this.token=Kt("ad4mToken")||"";this.port=parseInt(Kt("ad4mport"))||Tr;this.url=Kt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href","https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap"),document.head.appendChild(t)}connectedCallback(){super.connectedCallback(),xo(this),this.injectFont(),this._isMobile=q3(),this._client=new Ao({appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath,capabilities:Array.isArray(this.capabilities)?this.capabilities:JSON.parse(this.capabilities),port:this.port||parseInt(Kt("ad4mport"))||Tr,token:this.token||Kt("ad4mtoken"),url:this.url||Kt("ad4murl"),hosting:this.hosting}),this._client.on("configstatechange",this.handleConfigChange),this._client.on("authstatechange",this.handleAuthChange),this._client.on("connectionstatechange",this.handleConnectionChange),this.loadFont(),this.token||Kt("ad4mtoken")?this.multiUser&&this.backendUrl?this._client.connect(this.backendUrl):this._client.connect():(this.detectLocal(),this.changeUIState("connection_overview"),this._isOpen=!0)}checkEmail(){return re(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(t){console.log(t)}})}handleMultiUserEmailSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl),i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.requestLoginVerification(this._multiUserEmail,i);n.success&&!n.requiresPassword?(this._multiUserStep="code",this._multiUserVerificationType="login"):n.requiresPassword?(this._multiUserStep="password",this._multiUserVerificationType=n.isExistingUser?"login":"signup"):this._multiUserError=n.message||"Failed to send verification email"}catch(t){this._multiUserError=t.message||"Failed to process email. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserPasswordSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl);if(this._multiUserVerificationType==="login")try{let i=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(i){this._multiUserError=i.message||"Invalid email or password. Please try again."}else{let i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.createUser(this._multiUserEmail,this._multiUserPassword,i);if(n.success)if(n.error&&n.error.includes("SMTP is not configured"))try{let a=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(a),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(a){this._multiUserError=a.message||"Account created but login failed. Please try logging in."}else n.error?this._multiUserError=n.error+" You can try logging in with your password.":(this._multiUserStep="code",this._multiUserVerificationType="signup");else this._multiUserError=n.error||"Failed to create account. Please try again."}}catch(t){this._multiUserError=t.message||"Failed to process request. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserCodeSubmit(){return re(this,null,function*(){if(!this._multiUserLoading){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null);try{this._multiUserLoading=!0,this._multiUserError=null;let i=yield this._client.buildTempClient(this.backendUrl).agent.verifyEmailCode(this._multiUserEmail,this._multiUserVerificationCode,this._multiUserVerificationType);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(t){this._multiUserError="Invalid or expired code. Please try again.",this._multiUserVerificationCode=""}finally{this._multiUserLoading=!1}}})}handleMultiUserBackToEmail(){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserStep="email",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserError=null}changeMultiUserEmail(t){this._multiUserEmail=t,this._multiUserError=null}changeMultiUserPassword(t){this._multiUserPassword=t,this._multiUserError=null}changeMultiUserVerificationCode(t){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserVerificationCode=t,this._multiUserError=null,t.length===6&&!this._multiUserLoading&&(this._codeSubmitTimeout=setTimeout(()=>{this._codeSubmitTimeout=null,this._multiUserVerificationCode.length===6&&!this._multiUserLoading&&this.handleMultiUserCodeSubmit()},100))}detectLocal(){return re(this,null,function*(){try{yield pi(`ws://localhost:${this.port}/graphql`,3e3),this._localDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this._localDetected=!1}})}verifyAd4mApi(t){return re(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",t);let i=this._client.buildTempClient(t);try{yield i.runtime.info(),console.log("[Ad4m Connect] AD4M API verified")}catch(n){throw console.error("[Ad4m Connect] Failed to verify AD4M API:",n),new Error("Server is reachable but doesn't appear to be an AD4M executor. Make sure the URL includes '/graphql'.")}})}detectRemoteMultiUser(t){return re(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",t);let i=this._client.buildTempClient(t);try{let n=yield i.runtime.multiUserEnabled();return console.log("[Ad4m Connect] Multi-user detection result:",n),n}catch(n){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",n),console.error("[Ad4m Connect] Error details:",n.message,n.stack),!1}})}handleConnectLocal(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect()}catch(t){console.error("Failed to connect to local AD4M:",t),this.changeUIState("connection_overview")}})}handleShowRemoteConnection(){this._remoteUrl=this.backendUrl||this.url||"",this._remoteMultiUserDetected=null,this._remoteError=null,this.changeUIState("remote_connection")}handleRemoteUrlChange(t){this._remoteUrl=t,this._remoteError=null}handleRemoteConnect(){return re(this,null,function*(){if(!this._remoteUrl){this._remoteError="Please enter a URL";return}this._remoteDetecting=!0,this._remoteError=null,this._remoteMultiUserDetected=null;try{console.log("[Ad4m Connect] Checking if server is reachable:",this._remoteUrl),yield pi(this._remoteUrl,5e3),console.log("[Ad4m Connect] Server is reachable"),yield this.verifyAd4mApi(this._remoteUrl);let t=yield this.detectRemoteMultiUser(this._remoteUrl);this._remoteMultiUserDetected=t,this._remoteDetecting=!1}catch(t){console.error("[Ad4m Connect] Connection/detection failed:",t),this._remoteError=t.message||"Cannot reach server at this URL. Please check the URL and try again.",this._remoteMultiUserDetected=null,this._remoteDetecting=!1}})}handleRemoteMultiUserAuth(){return re(this,null,function*(){this.backendUrl=this._remoteUrl,this.changeUIState("multiuser_auth")})}handleRemoteRequestCapability(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect(this._remoteUrl)}catch(t){this._remoteError=t.message||"Failed to connect",this.changeUIState("remote_connection")}})}loginToHosting(){return re(this,null,function*(){try{yield this._client.loginToHosting(this._email,this._passowrd),this.changeUIState("connected")}catch(t){t.message.includes("Passwords did not match")?this._passwordError="Passwords did not match":this._hostingNotRunningError="Hosting is not running"}})}changeEmail(t){this._email=t}changePassword(t){this._passowrd=t}unlockAgent(t,i=!0){return re(this,null,function*(){yield this._client.ad4mClient.agent.unlock(t,i)})}verifyCode(t){return re(this,null,function*(){try{yield this._client.verifyCode(t)}catch(i){this._verifyCodeError="Invalid code"}})}changeUrl(t){t!==this._client.url&&(dp("ad4mtoken"),this._client.setToken(null)),this._client.setUrl(t)}changePort(t){this._client.setPort(t)}changeUIState(t){this.uiState=t}setIsHostingRunning(t){this._hostingNotRunningError=t}changeIsRemote(t){this._isRemote=t}changeCode(t){this._code=t}onDownloaded(){this._hasClickedDownload=!0}handleAuthChange(t){let i=new CustomEvent("authstatechange",{detail:t});t==="locked"&&(this._isOpen=!0),t==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(i),this.requestUpdate()}handleConfigChange(t,i){this[t]=i,i?xc("ad4m"+t,i):dp("ad4m"+t),this.requestUpdate()}handleConnectionChange(t){if(t==="checking_local"){this._isOpen=!1;return}t==="connected"&&(this.authState!=="authenticated"?(this.changeUIState("requestcap"),this._isOpen=!0):(this.changeUIState("connected"),this._isOpen=!1)),t==="disconnected"&&(this._isOpen=!0),t==="not_connected"&&(this._isOpen=!0,this.multiUser&&this.backendUrl?this.changeUIState("multiuser_auth"):this.changeUIState("start"));let i=new CustomEvent("connectionstatechange",{detail:t});this.dispatchEvent(i),this.requestUpdate()}loadFont(){let t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.crossOrigin="anonymous",t.href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap",document.head.appendChild(t)}startCamera(t){return re(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(i){window.BarcodeDetector=Or}yield this.changeUIState("qr"),setTimeout(()=>re(this,null,function*(){let i=this.shadowRoot.querySelector("video");if(!i)return;let n=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});i.srcObject=n,i.autoplay=!0}),100)})}connect(){return re(this,null,function*(){this._isOpen=!0,this.requestUpdate();let t=yield this._client.connect();try{let i=yield t.agent.status();i.isUnlocked&&i.isInitialized&&window.location.reload()}catch(i){console.warn(i)}return t})}getAd4mClient(){return this._client.ad4mClient}connectRemote(t){return re(this,null,function*(){try{this.changeUrl(t);let i=yield this._client.connect(t),n=yield i.agent.status();return n.isUnlocked&&n.isInitialized||this.changeUIState("requestcap"),i}catch(i){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(t){return re(this,null,function*(){try{yield this._client.requestCapability(t),this.changeUIState("verifycode")}catch(i){console.warn(i)}})}isAuthenticated(){return re(this,null,function*(){return this._client.checkAuth()})}setOpen(t){this._isOpen=t}setHostingStep(t){this._hostingStep=t}clearState(){this.handleConfigChange("port",null),this.handleConfigChange("url",null),this.handleConfigChange("token",null),this.handleConnectionChange("not_connected"),this.handleAuthChange("unauthenticated"),this.changeUIState("start"),this._client.clearState()}renderViews(){if(this.connectionState==="connecting")return _p();if(this.uiState==="connection_overview")return mp({localDetected:this._localDetected,multiUserConfigured:this.multiUser&&!!this.backendUrl,backendUrl:this.backendUrl,configuredUrl:this.url,isMobile:this._isMobile,onConnectLocal:this.handleConnectLocal,onConnectRemote:this.handleShowRemoteConnection,onScanQR:()=>{this.startCamera(null)},onDownloadAd4m:()=>{window.open("https://github.com/coasys/ad4m/releases")}});if(this.uiState==="remote_connection")return Cp({initialUrl:this._remoteUrl,detecting:this._remoteDetecting,multiUserDetected:this._remoteMultiUserDetected,error:this._remoteError,onBack:()=>this.changeUIState("connection_overview"),onUrlChange:this.handleRemoteUrlChange,onConnect:this.handleRemoteConnect,onMultiUserAuth:this.handleRemoteMultiUserAuth,onRequestCapability:this.handleRemoteRequestCapability});if(this.uiState==="multiuser_auth")return wp({email:this._multiUserEmail,password:this._multiUserPassword,verificationCode:this._multiUserVerificationCode,error:this._multiUserError,isLoading:this._multiUserLoading,backendUrl:this.backendUrl,step:this._multiUserStep,verificationType:this._multiUserVerificationType,changeEmail:this.changeMultiUserEmail,changePassword:this.changeMultiUserPassword,changeVerificationCode:this.changeMultiUserVerificationCode,onEmailSubmit:this.handleMultiUserEmailSubmit,onPasswordSubmit:this.handleMultiUserPasswordSubmit,onCodeSubmit:this.handleMultiUserCodeSubmit,onBackToEmail:this.handleMultiUserBackToEmail});if(this.uiState==="hosting")return bp({email:this._email,password:this._passowrd,changeEmail:this.changeEmail,changePassword:this.changePassword,changeState:this.changeUIState,step:this._hostingStep,setHostingStep:this.setHostingStep,login:this.loginToHosting,checkEmail:this.checkEmail,passwordError:this._passwordError,isHostingRunning:this._hostingNotRunningError,setIsHostingRunning:this.setIsHostingRunning});if(this.uiState==="qr")return xp({changeState:this.changeUIState,onSuccess:t=>{this.changeUrl(t),this._client.connect(t)},uiState:this.uiState});if(this.authState==="locked")return hp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return Ap({port:this.port,changePort:this.changePort,isRemote:this._isRemote,changeIsRemote:this.changeIsRemote,url:this.url,changeState:this.changeUIState,changeUrl:this.changeUrl,connectToPort:this._client.connectToPort,connectRemote:this.connectRemote,clearState:this.clearState});if(this.connectionState==="not_connected")return kp({scanQrcode:this.startCamera,connect:this.connect,isMobile:this._isMobile,hasClickedDownload:this._hasClickedDownload,onDownloaded:this.onDownloaded,changeState:this.changeUIState,hosting:this.hosting});if(this.connectionState==="connected")return this.uiState==="verifycode"?Tp({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):Ep({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return yp({reconnect:this.connect});if(this.connectionState==="port_not_found")return gp()}mobileView(){return this.mobile?Sp({openModal:()=>{this.changeUIState("settings"),this._isOpen=!this._isOpen}}):null}render(){return console.log(this.authState,this.connectionState,this.uiState,this._isOpen),this._isOpen===!1?this.authState==="authenticated"?this.mobileView():null:F`
|
|
3010
3015
|
<div class="wrapper">
|
|
3011
3016
|
<div class="dialog">
|
|
3012
|
-
${
|
|
3017
|
+
${vp()}
|
|
3013
3018
|
<main class="dialog__content">${this.renderViews()}</main>
|
|
3014
3019
|
${this.mobileView()}
|
|
3015
3020
|
</div>
|
|
3016
3021
|
<div class="ad4mConnect__backdrop" />
|
|
3017
3022
|
</div>
|
|
3018
|
-
`}};ee.styles=[
|
|
3023
|
+
`}};ee.styles=[B3],te([xe()],ee.prototype,"_code",2),te([xe()],ee.prototype,"_isMobile",2),te([xe()],ee.prototype,"_hasClickedDownload",2),te([xe()],ee.prototype,"_isRemote",2),te([xe()],ee.prototype,"_client",2),te([xe()],ee.prototype,"_isOpen",2),te([xe()],ee.prototype,"_hostingStep",2),te([xe()],ee.prototype,"_email",2),te([xe()],ee.prototype,"_passowrd",2),te([xe()],ee.prototype,"_passwordError",2),te([xe()],ee.prototype,"_hostingNotRunningError",2),te([xe()],ee.prototype,"_verifyCodeError",2),te([xe()],ee.prototype,"_isHostingLoading",2),te([xe()],ee.prototype,"_multiUserEmail",2),te([xe()],ee.prototype,"_multiUserPassword",2),te([xe()],ee.prototype,"_multiUserVerificationCode",2),te([xe()],ee.prototype,"_multiUserError",2),te([xe()],ee.prototype,"_multiUserLoading",2),te([xe()],ee.prototype,"_multiUserStep",2),te([xe()],ee.prototype,"_multiUserVerificationType",2),te([xe()],ee.prototype,"_localDetected",2),te([xe()],ee.prototype,"_remoteUrl",2),te([xe()],ee.prototype,"_remoteMultiUserDetected",2),te([xe()],ee.prototype,"_remoteDetecting",2),te([xe()],ee.prototype,"_remoteError",2),te([xe()],ee.prototype,"uiState",2),te([pt({type:String,reflect:!0})],ee.prototype,"appName",2),te([pt({type:String,reflect:!0})],ee.prototype,"appDesc",2),te([pt({type:String,reflect:!0})],ee.prototype,"appDomain",2),te([pt({type:String,reflect:!0})],ee.prototype,"appIconPath",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"mobile",2),te([pt({type:String,reflect:!0})],ee.prototype,"capabilities",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"hosting",2),te([pt({type:String})],ee.prototype,"token",2),te([pt({type:String,reflect:!0})],ee.prototype,"port",2),te([pt({type:String,reflect:!0})],ee.prototype,"url",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"multiUser",2),te([pt({type:String,reflect:!0})],ee.prototype,"backendUrl",2),ee=te([Zp("ad4m-connect")],ee);function V3(r){let e=new ee;return Object.entries(r).forEach(([t,i])=>{e[t]=i}),document.body.appendChild(e),e}export{ee as Ad4mConnectElement,V3 as default,U3 as getAd4mClient};
|
|
3019
3024
|
/*!
|
|
3020
3025
|
* @undecaf/barcode-detector-polyfill v0.9.20
|
|
3021
3026
|
* A WebAssembly polyfill for the Barcode Detection API
|