@coasys/ad4m-connect 0.12.0-rc1-dev.1 → 0.12.0-rc1-dev.3

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.
Files changed (44) hide show
  1. package/dist/components/icons/CheckCircleIcon.d.ts +1 -0
  2. package/dist/components/icons/TickIcon.d.ts +1 -0
  3. package/dist/components/shared/Ad4mLogo.d.ts +1 -0
  4. package/dist/components/shared/AppLogo.d.ts +1 -0
  5. package/dist/components/shared/Header.d.ts +1 -0
  6. package/dist/components/shared/Logo.d.ts +1 -0
  7. package/dist/components/states/ErrorState.d.ts +6 -0
  8. package/dist/components/views/ConnectionOverview.d.ts +22 -0
  9. package/dist/components/views/Hosting.d.ts +22 -0
  10. package/dist/components/views/MultiUserAuth.d.ts +26 -0
  11. package/dist/components/views/RemoteConnection.d.ts +19 -0
  12. package/dist/components/views/RequestCapability.d.ts +16 -0
  13. package/dist/components/views/ScanQRCode.d.ts +14 -0
  14. package/dist/components/views/Settings.d.ts +19 -0
  15. package/dist/components/views/Start.d.ts +19 -0
  16. package/dist/components/views/old/Hosting.d.ts +22 -0
  17. package/dist/components/views/old/MultiUserAuth.d.ts +26 -0
  18. package/dist/components/views/old/RemoteConnection.d.ts +19 -0
  19. package/dist/components/views/old/RequestCapability.d.ts +16 -0
  20. package/dist/components/views/old/ScanQRCode.d.ts +14 -0
  21. package/dist/components/views/old/Settings.d.ts +19 -0
  22. package/dist/components/views/old/Start.d.ts +19 -0
  23. package/dist/core.js +299 -299
  24. package/dist/index.js +371 -371
  25. package/dist/old/components/InvalidToken.d.ts +0 -0
  26. package/dist/old/components/VerifyCode.d.ts +0 -0
  27. package/dist/old/core.d.ts +0 -0
  28. package/dist/old/electron.d.ts +0 -0
  29. package/dist/old/state/ConnectState.d.ts +0 -0
  30. package/dist/old/state/index.d.ts +0 -0
  31. package/dist/old/utils.d.ts +0 -0
  32. package/dist/old/views/Hosting.d.ts +0 -0
  33. package/dist/old/views/MultiUserAuth.d.ts +0 -0
  34. package/dist/old/views/RemoteConnection.d.ts +0 -0
  35. package/dist/old/views/RequestCapability.d.ts +0 -0
  36. package/dist/old/views/ScanQRCode.d.ts +0 -0
  37. package/dist/old/views/Settings.d.ts +0 -0
  38. package/dist/old/views/Start.d.ts +0 -0
  39. package/dist/old/web.d.ts +0 -0
  40. package/dist/state/ConnectState.d.ts +101 -0
  41. package/dist/state/index.d.ts +2 -0
  42. package/dist/utils.js +1 -1
  43. package/dist/web.js +340 -340
  44. package/package.json +14 -14
package/dist/web.js CHANGED
@@ -1,49 +1,49 @@
1
- var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Object.getPrototypeOf;var hu=Reflect.get;var B=(i,e,t,r)=>{for(var n=r>1?void 0:r?pu(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&du(e,t,n),n};var wo=(i,e,t)=>hu(fu(i),t,e);var Ee=(i,e,t)=>new Promise((r,n)=>{var a=c=>{try{o(t.next(c))}catch(l){n(l)}},s=c=>{try{o(t.throw(c))}catch(l){n(l)}},o=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,s);o((t=t.apply(i,e)).next())});var Cn=window,Ln=Cn.ShadowRoot&&(Cn.ShadyCSS===void 0||Cn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ga=Symbol(),_o=new WeakMap,Lr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ga)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(Ln&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=_o.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&_o.set(t,e))}return e}toString(){return this.cssText}},Eo=i=>new Lr(typeof i=="string"?i:i+"",void 0,Ga),Ze=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[a+1],i[0]);return new Lr(t,i,Ga)},Za=(i,e)=>{Ln?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Cn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Nn=Ln?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Eo(t)})(i):i;var Ja,Pn=window,xo=Pn.trustedTypes,gu=xo?xo.emptyScript:"",$o=Pn.reactiveElementPolyfillSupport,Xa={toAttribute(i,e){switch(e){case Boolean:i=i?gu:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Ao=(i,e)=>e!==i&&(e==e||i==i),Ya={attribute:!0,type:String,converter:Xa,reflect:!1,hasChanged:Ao},es="finalized",Ct=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,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=Ya){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Ya}static finalize(){if(this.hasOwnProperty(es))return!1;this[es]=!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,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(Nn(n))}else e!==void 0&&t.push(Nn(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.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 Za(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 r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Ya){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:Xa).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:Xa;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||Ao)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):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,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(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(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),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,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Ct[es]=!0,Ct.elementProperties=new Map,Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},$o?.({ReactiveElement:Ct}),((Ja=Pn.reactiveElementVersions)!==null&&Ja!==void 0?Ja:Pn.reactiveElementVersions=[]).push("1.6.3");var ts,Rn=window,Yi=Rn.trustedTypes,Io=Yi?Yi.createPolicy("lit-html",{createHTML:i=>i}):void 0,rs="$lit$",Ft=`lit$${(Math.random()+"").slice(9)}$`,Ro="?"+Ft,mu=`<${Ro}>`,pi=document,Pr=()=>pi.createComment(""),Rr=i=>i===null||typeof i!="object"&&typeof i!="function",Oo=Array.isArray,yu=i=>Oo(i)||typeof i?.[Symbol.iterator]=="function",is=`[
2
- \f\r]`,Nr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ko=/-->/g,To=/>/g,ui=RegExp(`>|${is}(?:([^\\s"'>=/]+)(${is}*=${is}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,Lo=/"/g,Do=/^(?:script|style|textarea|title)$/i,Uo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),P=Uo(1),Zh=Uo(2),fi=Symbol.for("lit-noChange"),xe=Symbol.for("lit-nothing"),No=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Mo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(e):e}var vu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Nr;for(let o=0;o<t;o++){let c=i[o],l,u,m=-1,p=0;for(;p<c.length&&(s.lastIndex=p,u=s.exec(c),u!==null);)p=s.lastIndex,s===Nr?u[1]==="!--"?s=ko:u[1]!==void 0?s=To:u[2]!==void 0?(Do.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Nr,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,l=u[1],s=u[3]===void 0?ui:u[3]==='"'?Lo:Co):s===Lo||s===Co?s=ui:s===ko||s===To?s=Nr:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Nr?c+mu:m>=0?(r.push(l),c.slice(0,m)+rs+c.slice(m)+Ft+d):c+Ft+(m===-2?(r.push(void 0),o):d)}return[Mo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},hi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,c=this.parts,[l,u]=vu(e,t);if(this.el=hi.createElement(l,r),di.currentNode=this.el.content,t===2){let m=this.el.content,p=m.firstChild;p.remove(),m.append(...p.childNodes)}for(;(n=di.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let p of n.getAttributeNames())if(p.endsWith(rs)||p.startsWith(Ft)){let d=u[s++];if(m.push(p),d!==void 0){let f=n.getAttribute(d.toLowerCase()+rs).split(Ft),y=/([.?@])?(.*)/.exec(d);c.push({type:1,index:a,name:y[2],strings:f,ctor:y[1]==="."?as:y[1]==="?"?ss:y[1]==="@"?os:er})}else c.push({type:6,index:a})}for(let p of m)n.removeAttribute(p)}if(Do.test(n.tagName)){let m=n.textContent.split(Ft),p=m.length-1;if(p>0){n.textContent=Yi?Yi.emptyScript:"";for(let d=0;d<p;d++)n.append(m[d],Pr()),di.nextNode(),c.push({type:2,index:++a});n.append(m[p],Pr())}}}else if(n.nodeType===8)if(n.data===Ro)c.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(Ft,m+1))!==-1;)c.push({type:7,index:a}),m+=Ft.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function Xi(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let c=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,l=Rr(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(i),c._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=c:t._$Cl=c),c!==void 0&&(e=Xi(i,c._$AS(i,e.values),c,r)),e}var ns=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:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:pi).importNode(r,!0);di.currentNode=a;let s=di.nextNode(),o=0,c=0,l=n[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new gi(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new cs(s,this,e)),this._$AV.push(u),l=n[++c]}o!==l?.index&&(s=di.nextNode(),o++)}return di.currentNode=pi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},gi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=xe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,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=Xi(this,e,t),Rr(e)?e===xe||e==null||e===""?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):yu(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!==xe&&Rr(this._$AH)?this._$AA.nextSibling.data=e:this.$(pi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=hi.createElement(Mo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ns(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=No.get(e.strings);return t===void 0&&No.set(e.strings,t=new hi(e)),t}T(e){Oo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new gi(this.k(Pr()),this.k(Pr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.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))}},er=class{constructor(e,t,r,n,a){this.type=1,this._$AH=xe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=xe}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Xi(this,e,t,0),s=!Rr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Xi(this,o[r+c],t,c),l===fi&&(l=this._$AH[c]),s||(s=!Rr(l)||l!==this._$AH[c]),l===xe?e=xe:e!==xe&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}s&&!n&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},as=class extends er{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}},bu=Yi?Yi.emptyScript:"",ss=class extends er{constructor(){super(...arguments),this.type=4}j(e){e&&e!==xe?this.element.setAttribute(this.name,bu):this.element.removeAttribute(this.name)}},os=class extends er{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Xi(this,e,t,0))!==null&&r!==void 0?r:xe)===fi)return;let n=this._$AH,a=e===xe&&n!==xe||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==xe&&(n===xe||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},cs=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}};var Po=Rn.litHtmlPolyfillSupport;Po?.(hi,gi),((ts=Rn.litHtmlVersions)!==null&&ts!==void 0?ts:Rn.litHtmlVersions=[]).push("2.8.0");var Fo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new gi(e.insertBefore(Pr(),o),o,void 0,t??{})}return s._$AI(i),s};var ls,us;var Pe=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fo(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 fi}};Pe.finalized=!0,Pe._$litElement$=!0,(ls=globalThis.litElementHydrateSupport)===null||ls===void 0||ls.call(globalThis,{LitElement:Pe});var Bo=globalThis.litElementPolyfillSupport;Bo?.({LitElement:Pe});((us=globalThis.litElementVersions)!==null&&us!==void 0?us:globalThis.litElementVersions=[]).push("3.3.3");var mt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var Su=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{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,i)}},wu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?wu(i,e,t):Su(i,e)}function ue(i){return fe({...i,state:!0})}var ds,Eg=((ds=window.HTMLSlotElement)===null||ds===void 0?void 0:ds.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var _u=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function ps(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of _u(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var jo="0.12.0-rc1-dev.1";function xu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function On(i,e){xu()&&localStorage.setItem(`${jo}/${i}`,e)}function Dn(i,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function mi(){return P`
1
+ var pu=Object.defineProperty;var fu=Object.getOwnPropertyDescriptor;var hu=Object.getPrototypeOf;var gu=Reflect.get;var F=(i,e,t,r)=>{for(var n=r>1?void 0:r?fu(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&pu(e,t,n),n};var _o=(i,e,t)=>gu(hu(i),t,e);var Se=(i,e,t)=>new Promise((r,n)=>{var a=c=>{try{o(t.next(c))}catch(l){n(l)}},s=c=>{try{o(t.throw(c))}catch(l){n(l)}},o=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,s);o((t=t.apply(i,e)).next())});var Cn=window,Ln=Cn.ShadowRoot&&(Cn.ShadyCSS===void 0||Cn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ga=Symbol(),Eo=new WeakMap,Tr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ga)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(Ln&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Eo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Eo.set(t,e))}return e}toString(){return this.cssText}},xo=i=>new Tr(typeof i=="string"?i:i+"",void 0,Ga),We=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[a+1],i[0]);return new Tr(t,i,Ga)},Za=(i,e)=>{Ln?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Cn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Nn=Ln?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return xo(t)})(i):i;var Ja,Rn=window,$o=Rn.trustedTypes,mu=$o?$o.emptyScript:"",Ao=Rn.reactiveElementPolyfillSupport,Xa={toAttribute(i,e){switch(e){case Boolean:i=i?mu:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},ko=(i,e)=>e!==i&&(e==e||i==i),Ya={attribute:!0,type:String,converter:Xa,reflect:!1,hasChanged:ko},es="finalized",Ct=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,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=Ya){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Ya}static finalize(){if(this.hasOwnProperty(es))return!1;this[es]=!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,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(Nn(n))}else e!==void 0&&t.push(Nn(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.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 Za(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 r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Ya){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:Xa).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:Xa;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||ko)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):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,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(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(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),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,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Ct[es]=!0,Ct.elementProperties=new Map,Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},Ao?.({ReactiveElement:Ct}),((Ja=Rn.reactiveElementVersions)!==null&&Ja!==void 0?Ja:Rn.reactiveElementVersions=[]).push("1.6.3");var ts,Pn=window,Ji=Pn.trustedTypes,Io=Ji?Ji.createPolicy("lit-html",{createHTML:i=>i}):void 0,rs="$lit$",Ft=`lit$${(Math.random()+"").slice(9)}$`,Oo="?"+Ft,yu=`<${Oo}>`,di=document,Lr=()=>di.createComment(""),Nr=i=>i===null||typeof i!="object"&&typeof i!="function",Do=Array.isArray,vu=i=>Do(i)||typeof i?.[Symbol.iterator]=="function",is=`[
2
+ \f\r]`,Cr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,To=/-->/g,Co=/>/g,li=RegExp(`>|${is}(?:([^\\s"'>=/]+)(${is}*=${is}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Lo=/'/g,No=/"/g,Mo=/^(?:script|style|textarea|title)$/i,Uo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),N=Uo(1),ig=Uo(2),pi=Symbol.for("lit-noChange"),we=Symbol.for("lit-nothing"),Ro=new WeakMap,ui=di.createTreeWalker(di,129,null,!1);function Fo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(e):e}var bu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Cr;for(let o=0;o<t;o++){let c=i[o],l,u,y=-1,g=0;for(;g<c.length&&(s.lastIndex=g,u=s.exec(c),u!==null);)g=s.lastIndex,s===Cr?u[1]==="!--"?s=To:u[1]!==void 0?s=Co:u[2]!==void 0?(Mo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=li):u[3]!==void 0&&(s=li):s===li?u[0]===">"?(s=n??Cr,y=-1):u[1]===void 0?y=-2:(y=s.lastIndex-u[2].length,l=u[1],s=u[3]===void 0?li:u[3]==='"'?No:Lo):s===No||s===Lo?s=li:s===To||s===Co?s=Cr:(s=li,n=void 0);let d=s===li&&i[o+1].startsWith("/>")?" ":"";a+=s===Cr?c+yu:y>=0?(r.push(l),c.slice(0,y)+rs+c.slice(y)+Ft+d):c+Ft+(y===-2?(r.push(void 0),o):d)}return[Fo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},fi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,c=this.parts,[l,u]=bu(e,t);if(this.el=fi.createElement(l,r),ui.currentNode=this.el.content,t===2){let y=this.el.content,g=y.firstChild;g.remove(),y.append(...g.childNodes)}for(;(n=ui.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let y=[];for(let g of n.getAttributeNames())if(g.endsWith(rs)||g.startsWith(Ft)){let d=u[s++];if(y.push(g),d!==void 0){let p=n.getAttribute(d.toLowerCase()+rs).split(Ft),h=/([.?@])?(.*)/.exec(d);c.push({type:1,index:a,name:h[2],strings:p,ctor:h[1]==="."?as:h[1]==="?"?ss:h[1]==="@"?os:Xi})}else c.push({type:6,index:a})}for(let g of y)n.removeAttribute(g)}if(Mo.test(n.tagName)){let y=n.textContent.split(Ft),g=y.length-1;if(g>0){n.textContent=Ji?Ji.emptyScript:"";for(let d=0;d<g;d++)n.append(y[d],Lr()),ui.nextNode(),c.push({type:2,index:++a});n.append(y[g],Lr())}}}else if(n.nodeType===8)if(n.data===Oo)c.push({type:2,index:a});else{let y=-1;for(;(y=n.data.indexOf(Ft,y+1))!==-1;)c.push({type:7,index:a}),y+=Ft.length-1}a++}}static createElement(e,t){let r=di.createElement("template");return r.innerHTML=e,r}};function Yi(i,e,t=i,r){var n,a,s,o;if(e===pi)return e;let c=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,l=Nr(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(i),c._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=c:t._$Cl=c),c!==void 0&&(e=Yi(i,c._$AS(i,e.values),c,r)),e}var ns=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:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:di).importNode(r,!0);ui.currentNode=a;let s=ui.nextNode(),o=0,c=0,l=n[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new hi(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new cs(s,this,e)),this._$AV.push(u),l=n[++c]}o!==l?.index&&(s=ui.nextNode(),o++)}return ui.currentNode=di,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},hi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=we,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,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=Yi(this,e,t),Nr(e)?e===we||e==null||e===""?(this._$AH!==we&&this._$AR(),this._$AH=we):e!==this._$AH&&e!==pi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):vu(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&&Nr(this._$AH)?this._$AA.nextSibling.data=e:this.$(di.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=fi.createElement(Fo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ns(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Ro.get(e.strings);return t===void 0&&Ro.set(e.strings,t=new fi(e)),t}T(e){Do(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new hi(this.k(Lr()),this.k(Lr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.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))}},Xi=class{constructor(e,t,r,n,a){this.type=1,this._$AH=we,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=we}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Yi(this,e,t,0),s=!Nr(e)||e!==this._$AH&&e!==pi,s&&(this._$AH=e);else{let o=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Yi(this,o[r+c],t,c),l===pi&&(l=this._$AH[c]),s||(s=!Nr(l)||l!==this._$AH[c]),l===we?e=we:e!==we&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}s&&!n&&this.j(e)}j(e){e===we?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},as=class extends Xi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===we?void 0:e}},Su=Ji?Ji.emptyScript:"",ss=class extends Xi{constructor(){super(...arguments),this.type=4}j(e){e&&e!==we?this.element.setAttribute(this.name,Su):this.element.removeAttribute(this.name)}},os=class extends Xi{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Yi(this,e,t,0))!==null&&r!==void 0?r:we)===pi)return;let n=this._$AH,a=e===we&&n!==we||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==we&&(n===we||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},cs=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Yi(this,e)}};var Po=Pn.litHtmlPolyfillSupport;Po?.(fi,hi),((ts=Pn.litHtmlVersions)!==null&&ts!==void 0?ts:Pn.litHtmlVersions=[]).push("2.8.0");var jo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new hi(e.insertBefore(Lr(),o),o,void 0,t??{})}return s._$AI(i),s};var ls,us;var Te=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=jo(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 pi}};Te.finalized=!0,Te._$litElement$=!0,(ls=globalThis.litElementHydrateSupport)===null||ls===void 0||ls.call(globalThis,{LitElement:Te});var Bo=globalThis.litElementPolyfillSupport;Bo?.({LitElement:Te});((us=globalThis.litElementVersions)!==null&&us!==void 0?us:globalThis.litElementVersions=[]).push("3.3.3");var ht=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var wu=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{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,i)}},_u=(i,e,t)=>{e.constructor.createProperty(t,i)};function de(i){return(e,t)=>t!==void 0?_u(i,e,t):wu(i,e)}function ce(i){return de({...i,state:!0})}var ds,Tg=((ds=window.HTMLSlotElement)===null||ds===void 0?void 0:ds.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Eu=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function ps(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of Eu(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var qo="0.12.0-rc1-dev.2";function $u(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function On(i,e){$u()&&localStorage.setItem(`${qo}/${i}`,e)}function Dn(i,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function gi(){return N`
4
4
  <svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
5
5
  <path fill="currentColor" 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" />
6
6
  </svg>
7
- `}function tr(){return P`
7
+ `}function er(){return N`
8
8
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
9
9
  <circle cx="12" cy="12" r="10"></circle>
10
10
  <circle cx="12" cy="12" r="3" fill="currentColor"></circle>
11
11
  </svg>
12
- `}function ir(){return P`
12
+ `}function tr(){return N`
13
13
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
14
14
  <circle cx="12" cy="12" r="10"></circle>
15
15
  <path d="M2 12h20"></path>
16
16
  <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
17
17
  </svg>
18
- `}function Un(){return P`
18
+ `}function Mn(){return N`
19
19
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
20
20
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
21
21
  <polyline points="7 10 12 15 17 10"></polyline>
22
22
  <line x1="12" y1="15" x2="12" y2="3"></line>
23
23
  </svg>
24
- `}function pt(){return P`
24
+ `}function ct(){return N`
25
25
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
26
26
  <rect width="256" height="256" fill="none"/>
27
27
  <polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
28
28
  </svg>
29
- `}function Me(){return P`
29
+ `}function Re(){return N`
30
30
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
31
31
  <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
32
32
  </svg>
33
- `}function Mn(){return P`
33
+ `}function Un(){return N`
34
34
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
35
35
  <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
36
36
  <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
37
37
  </svg>
38
- `}function Fn(){return P`
38
+ `}function Fn(){return N`
39
39
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
40
40
  <path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5m14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5"/>
41
41
  </svg>
42
- `}function rr(){return P`
42
+ `}function ir(){return N`
43
43
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
44
44
  <path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
45
45
  </svg>
46
- `}var Bt=Ze`
46
+ `}var jt=We`
47
47
  * {
48
48
  box-sizing: border-box;
49
49
  }
@@ -305,7 +305,7 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
305
305
  .state.danger svg {
306
306
  color: var(--ac-danger-color);
307
307
  }
308
- `;var Te=class extends Pe{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return Ee(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return Ee(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return Ee(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return Ee(this,null,function*(){try{yield Dn(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return Ee(this,null,function*(){wo(Te.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:P`
308
+ `;var $e=class extends Te{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return Se(this,null,function*(){try{yield Dn(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return Se(this,null,function*(){_o($e.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:N`
309
309
  <div class="container">
310
310
  <div class="header">
311
311
  <h1>Connect AD4M</h1>
@@ -313,31 +313,31 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
313
313
  </div>
314
314
 
315
315
  <div class="options">
316
- ${this.isMobile?"":P`
316
+ ${this.isMobile?"":N`
317
317
  <div class="box">
318
318
  <div class="box-header">
319
- ${tr()}
319
+ ${er()}
320
320
  <h3>Local Node</h3>
321
321
  </div>
322
322
 
323
- ${this.localNodeDetected?P`
323
+ ${this.localNodeDetected?N`
324
324
  <div class="state success">
325
- ${pt()}
325
+ ${ct()}
326
326
  <p>Local node detected on port ${this.port}</p>
327
327
  </div>
328
328
 
329
329
  <button class="primary" @click=${this.connectLocalNode}>
330
330
  Connect to Local Node
331
331
  </button>
332
- `:P`
332
+ `:N`
333
333
  <div class="state danger">
334
- ${Me()}
334
+ ${Re()}
335
335
  <p>No local node detected on port ${this.port}</p>
336
336
  </div>
337
337
 
338
338
  <p style="margin-bottom: -12px">Download and install AD4M</p>
339
339
  <button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
340
- ${Un()} Download AD4M
340
+ ${Mn()} Download AD4M
341
341
  </button>
342
342
  `}
343
343
 
@@ -351,25 +351,25 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
351
351
  @keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
352
352
  />
353
353
  <button class="primary" @click=${this.refreshPort}>
354
- ${Mn()}
354
+ ${Un()}
355
355
  </button>
356
356
  </div>
357
357
  </div>
358
358
  `}
359
359
 
360
- ${this.showMultiUserOption?P`
360
+ ${this.showMultiUserOption?N`
361
361
  <div class="box">
362
362
  <div class="box-header">
363
- ${ir()}
363
+ ${tr()}
364
364
  <h3>Remote Node</h3>
365
365
  </div>
366
366
 
367
- ${this.remoteUrl?P`
367
+ ${this.remoteUrl?N`
368
368
  <div class="state success">
369
- ${pt()}
369
+ ${ct()}
370
370
  <p>Remote configuration detected</p>
371
371
  </div>
372
- `:P`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
372
+ `:N`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
373
373
 
374
374
  <input
375
375
  type="text"
@@ -380,9 +380,9 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
380
380
  style= "font-size: 16px;"
381
381
  />
382
382
 
383
- ${this.remoteNodeError?P`
383
+ ${this.remoteNodeError?N`
384
384
  <div class="state danger">
385
- ${Me()}
385
+ ${Re()}
386
386
  <p>Unable to connect to remote node</p>
387
387
  </div>
388
388
  `:""}
@@ -398,7 +398,7 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
398
398
  `:""}
399
399
  </div>
400
400
  </div>
401
- `}};Te.styles=[Bt,Ze`
401
+ `}};$e.styles=[jt,We`
402
402
  .options {
403
403
  display: flex;
404
404
  flex-direction: column;
@@ -427,17 +427,17 @@ var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Objec
427
427
  button {
428
428
  width: 100%;
429
429
  }
430
- `],B([fe({type:Number})],Te.prototype,"port",2),B([fe({type:String})],Te.prototype,"remoteUrl",2),B([fe({type:Boolean})],Te.prototype,"connectingToRemoteNode",2),B([fe({type:Boolean})],Te.prototype,"remoteNodeError",2),B([fe({type:Boolean})],Te.prototype,"showMultiUserOption",2),B([ue()],Te.prototype,"loading",2),B([ue()],Te.prototype,"localNodeDetected",2),B([ue()],Te.prototype,"newPort",2),B([ue()],Te.prototype,"newRemoteUrl",2),B([ue()],Te.prototype,"isMobile",2),Te=B([mt("connection-options")],Te);var va=function(){return va=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},va.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Xn(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xn=function(t){return typeof t}:Xn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xn(i)}function $u(i){return Xn(i)=="object"&&i!==null}var ll=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ns(i,e){for(var t=/\r\n|[\n\r]/g,r=1,n=e+1,a;(a=t.exec(i.body))&&a.index<e;)r+=1,n=e+1-(a.index+a[0].length);return{line:r,column:n}}function Au(i){return ul(i.source,Ns(i.source,i.start))}function ul(i,e){var t=i.locationOffset.column-1,r=ea(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,c=e.column+o,l="".concat(i.name,":").concat(s,":").concat(c,`
431
- `),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var p=Math.floor(c/80),d=c%80,f=[],y=0;y<m.length;y+=80)f.push(m.slice(y,y+80));return l+qo([["".concat(s),f[0]]].concat(f.slice(1,p+1).map(function($){return["",$]}),[[" ",ea(d-1)+"^"],["",f[p+1]]]))}return l+qo([["".concat(s-1),u[n-1]],["".concat(s),m],["",ea(c-1)+"^"],["".concat(s+1),u[n+1]]])}function qo(i){var e=i.filter(function(r){r[0];var n=r[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(r){var n=r[0];return n.length}));return e.map(function(r){var n=r[0],a=r[1];return Iu(t,n)+(a?" | "+a:" |")}).join(`
432
- `)}function ea(i){return Array(i+1).join(" ")}function Iu(i,e){return ea(i-e.length)+e}function ta(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ta=function(t){return typeof t}:ta=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ta(i)}function Vo(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function ku(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vo(Object(t),!0).forEach(function(r){Tu(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vo(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function Tu(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Cu(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Lu(i,e,t){return e&&zo(i.prototype,e),t&&zo(i,t),i}function Nu(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&ln(i,e)}function Pu(i){var e=pl();return function(){var r=un(i),n;if(e){var a=un(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return dl(this,n)}}function dl(i,e){return e&&(ta(e)==="object"||typeof e=="function")?e:Br(i)}function Br(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ps(i){var e=typeof Map=="function"?new Map:void 0;return Ps=function(r){if(r===null||!Ru(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return ia(r,arguments,un(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ln(n,r)},Ps(i)}function ia(i,e,t){return pl()?ia=Reflect.construct:ia=function(n,a,s){var o=[null];o.push.apply(o,a);var c=Function.bind.apply(n,o),l=new c;return s&&ln(l,s.prototype),l},ia.apply(null,arguments)}function pl(){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 Ru(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function ln(i,e){return ln=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},ln(i,e)}function un(i){return un=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},un(i)}var Ou=function(i){Nu(t,i);var e=Pu(t);function t(r,n,a,s,o,c,l){var u,m,p,d;Cu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=c??void 0,d.nodes=Ho(Array.isArray(n)?n:n?[n]:void 0);for(var f=[],y=0,$=(A=d.nodes)!==null&&A!==void 0?A:[];y<$.length;y++){var A,T=$[y],N=T.loc;N!=null&&f.push(N)}f=Ho(f),d.source=a??((u=f)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=f)===null||m===void 0?void 0:m.map(function(C){return C.start})),d.locations=s&&a?s.map(function(C){return Ns(a,C)}):(p=f)===null||p===void 0?void 0:p.map(function(C){return Ns(C.source,C.start)}),d.path=o??void 0;var x=c?.extensions;return l==null&&$u(x)?d.extensions=ku({},x):d.extensions=l??{},Object.defineProperties(Br(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Br(d),"stack",{value:c.stack,writable:!0,configurable:!0}),dl(d)):(Error.captureStackTrace?Error.captureStackTrace(Br(d),t):Object.defineProperty(Br(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Lu(t,[{key:"toString",value:function(){return Du(this)}},{key:ll,get:function(){return"Object"}}]),t}(Ps(Error));function Ho(i){return i===void 0||i.length===0?void 0:i}function Du(i){var e=i.message;if(i.nodes)for(var t=0,r=i.nodes;t<r.length;t++){var n=r[t];n.loc&&(e+=`
430
+ `],F([de({type:Number})],$e.prototype,"port",2),F([de({type:String})],$e.prototype,"remoteUrl",2),F([de({type:Boolean})],$e.prototype,"connectingToRemoteNode",2),F([de({type:Boolean})],$e.prototype,"remoteNodeError",2),F([de({type:Boolean})],$e.prototype,"showMultiUserOption",2),F([ce()],$e.prototype,"loading",2),F([ce()],$e.prototype,"localNodeDetected",2),F([ce()],$e.prototype,"newPort",2),F([ce()],$e.prototype,"newRemoteUrl",2),F([ce()],$e.prototype,"isMobile",2),$e=F([ht("connection-options")],$e);var ma=function(){return ma=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ma.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Xn(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xn=function(t){return typeof t}:Xn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xn(i)}function Au(i){return Xn(i)=="object"&&i!==null}var ul=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ns(i,e){for(var t=/\r\n|[\n\r]/g,r=1,n=e+1,a;(a=t.exec(i.body))&&a.index<e;)r+=1,n=e+1-(a.index+a[0].length);return{line:r,column:n}}function ku(i){return dl(i.source,Ns(i.source,i.start))}function dl(i,e){var t=i.locationOffset.column-1,r=ea(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,c=e.column+o,l="".concat(i.name,":").concat(s,":").concat(c,`
431
+ `),u=r.split(/\r\n|[\n\r]/g),y=u[n];if(y.length>120){for(var g=Math.floor(c/80),d=c%80,p=[],h=0;h<y.length;h+=80)p.push(y.slice(h,h+80));return l+Vo([["".concat(s),p[0]]].concat(p.slice(1,g+1).map(function(w){return["",w]}),[[" ",ea(d-1)+"^"],["",p[g+1]]]))}return l+Vo([["".concat(s-1),u[n-1]],["".concat(s),y],["",ea(c-1)+"^"],["".concat(s+1),u[n+1]]])}function Vo(i){var e=i.filter(function(r){r[0];var n=r[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(r){var n=r[0];return n.length}));return e.map(function(r){var n=r[0],a=r[1];return Iu(t,n)+(a?" | "+a:" |")}).join(`
432
+ `)}function ea(i){return Array(i+1).join(" ")}function Iu(i,e){return ea(i-e.length)+e}function ta(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ta=function(t){return typeof t}:ta=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ta(i)}function Ho(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function Tu(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ho(Object(t),!0).forEach(function(r){Cu(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Ho(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function Cu(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Lu(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Nu(i,e,t){return e&&zo(i.prototype,e),t&&zo(i,t),i}function Ru(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&cn(i,e)}function Pu(i){var e=fl();return function(){var r=ln(i),n;if(e){var a=ln(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return pl(this,n)}}function pl(i,e){return e&&(ta(e)==="object"||typeof e=="function")?e:Ur(i)}function Ur(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Rs(i){var e=typeof Map=="function"?new Map:void 0;return Rs=function(r){if(r===null||!Ou(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return ia(r,arguments,ln(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),cn(n,r)},Rs(i)}function ia(i,e,t){return fl()?ia=Reflect.construct:ia=function(n,a,s){var o=[null];o.push.apply(o,a);var c=Function.bind.apply(n,o),l=new c;return s&&cn(l,s.prototype),l},ia.apply(null,arguments)}function fl(){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 Ou(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function cn(i,e){return cn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},cn(i,e)}function ln(i){return ln=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ln(i)}var Du=function(i){Ru(t,i);var e=Pu(t);function t(r,n,a,s,o,c,l){var u,y,g,d;Lu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=c??void 0,d.nodes=Ko(Array.isArray(n)?n:n?[n]:void 0);for(var p=[],h=0,w=(E=d.nodes)!==null&&E!==void 0?E:[];h<w.length;h++){var E,I=w[h],k=I.loc;k!=null&&p.push(k)}p=Ko(p),d.source=a??((u=p)===null||u===void 0?void 0:u[0].source),d.positions=s??((y=p)===null||y===void 0?void 0:y.map(function(T){return T.start})),d.locations=s&&a?s.map(function(T){return Ns(a,T)}):(g=p)===null||g===void 0?void 0:g.map(function(T){return Ns(T.source,T.start)}),d.path=o??void 0;var S=c?.extensions;return l==null&&Au(S)?d.extensions=Tu({},S):d.extensions=l??{},Object.defineProperties(Ur(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ur(d),"stack",{value:c.stack,writable:!0,configurable:!0}),pl(d)):(Error.captureStackTrace?Error.captureStackTrace(Ur(d),t):Object.defineProperty(Ur(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Nu(t,[{key:"toString",value:function(){return Mu(this)}},{key:ul,get:function(){return"Object"}}]),t}(Rs(Error));function Ko(i){return i===void 0||i.length===0?void 0:i}function Mu(i){var e=i.message;if(i.nodes)for(var t=0,r=i.nodes;t<r.length;t++){var n=r[t];n.loc&&(e+=`
433
433
 
434
- `+Au(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
434
+ `+ku(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
435
435
 
436
- `+ul(i.source,o)}return e}function Xe(i,e,t){return new Ou("Syntax Error: ".concat(t),void 0,i,[e])}var j=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 Uu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Mu=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Rs=Mu;function fl(i){var e=i.prototype.toJSON;typeof e=="function"||Uu(0),i.prototype.inspect=e,Rs&&(i.prototype[Rs]=e)}var hl=function(){function i(t,r,n){this.start=t.start,this.end=r.end,this.startToken=t,this.endToken=r,this.source=n}var e=i.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},i}();fl(hl);var me=function(){function i(t,r,n,a,s,o,c){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=c,this.prev=o,this.next=null}var e=i.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},i}();fl(me);var _=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 ra(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ra=function(t){return typeof t}:ra=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ra(i)}var Fu=10,gl=2;function Bu(i){return qa(i,[])}function qa(i,e){switch(ra(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":ju(i,e);default:return String(i)}}function ju(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=zu(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:qa(n,t)}else if(Array.isArray(i))return Vu(i,t);return qu(i,t)}function qu(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>gl)return"["+Hu(i)+"]";var r=t.map(function(n){var a=qa(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function Vu(i,e){if(i.length===0)return"[]";if(e.length>gl)return"[Array]";for(var t=Math.min(Fu,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(qa(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function zu(i){var e=i[String(Rs)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function Hu(i){var e=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof i.constructor=="function"){var t=i.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function fs(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var Ku=function(e,t){return e instanceof t};function Ko(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Wu(i,e,t){return e&&Ko(i.prototype,e),t&&Ko(i,t),i}var ml=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||fs(0,"Body must be a string. Received: ".concat(Bu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||fs(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||fs(0,"column in locationOffset is 1-indexed and must be positive.")}return Wu(i,[{key:ll,get:function(){return"Source"}}]),i}();function Qu(i){return Ku(i,ml)}var Gu=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 Zu(i){var e=i.split(/\r\n|[\n\r]/g),t=Ju(i);if(t!==0)for(var r=1;r<e.length;r++)e[r]=e[r].slice(t);for(var n=0;n<e.length&&Wo(e[n]);)++n;for(var a=e.length;a>n&&Wo(e[a-1]);)--a;return e.slice(n,a).join(`
437
- `)}function Wo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Ju(i){for(var e,t=!0,r=!0,n=0,a=null,s=0;s<i.length;++s)switch(i.charCodeAt(s)){case 13:i.charCodeAt(s+1)===10&&++s;case 10:t=!1,r=!0,n=0;break;case 9:case 32:++n;break;default:r&&!t&&(a===null||n<a)&&(a=n),r=!1}return(e=a)!==null&&e!==void 0?e:0}var Yu=function(){function i(t){var r=new me(_.SOF,0,0,0,0,null);this.source=t,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var e=i.prototype;return e.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},e.lookahead=function(){var r=this.token;if(r.kind!==_.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=ed(this,r)}while(r.kind===_.COMMENT);return r},i}();function Xu(i){return i===_.BANG||i===_.DOLLAR||i===_.AMP||i===_.PAREN_L||i===_.PAREN_R||i===_.SPREAD||i===_.COLON||i===_.EQUALS||i===_.AT||i===_.BRACKET_L||i===_.BRACKET_R||i===_.BRACE_L||i===_.PIPE||i===_.BRACE_R}function Pi(i){return isNaN(i)?_.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function ed(i,e){for(var t=i.source,r=t.body,n=r.length,a=e.end;a<n;){var s=r.charCodeAt(a),o=i.line,c=1+a-i.lineStart;switch(s){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++i.line,i.lineStart=a;continue;case 13:r.charCodeAt(a+1)===10?a+=2:++a,++i.line,i.lineStart=a;continue;case 33:return new me(_.BANG,a,a+1,o,c,e);case 35:return id(t,a,o,c,e);case 36:return new me(_.DOLLAR,a,a+1,o,c,e);case 38:return new me(_.AMP,a,a+1,o,c,e);case 40:return new me(_.PAREN_L,a,a+1,o,c,e);case 41:return new me(_.PAREN_R,a,a+1,o,c,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new me(_.SPREAD,a,a+3,o,c,e);break;case 58:return new me(_.COLON,a,a+1,o,c,e);case 61:return new me(_.EQUALS,a,a+1,o,c,e);case 64:return new me(_.AT,a,a+1,o,c,e);case 91:return new me(_.BRACKET_L,a,a+1,o,c,e);case 93:return new me(_.BRACKET_R,a,a+1,o,c,e);case 123:return new me(_.BRACE_L,a,a+1,o,c,e);case 124:return new me(_.PIPE,a,a+1,o,c,e);case 125:return new me(_.BRACE_R,a,a+1,o,c,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?ad(t,a,o,c,e,i):nd(t,a,o,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 rd(t,a,s,o,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 od(t,a,o,c,e)}throw Xe(t,a,td(s))}var l=i.line,u=1+a-i.lineStart;return new me(_.EOF,n,n,l,u,e)}function td(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Pi(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Pi(i),".")}function id(i,e,t,r,n){var a=i.body,s,o=e;do s=a.charCodeAt(++o);while(!isNaN(s)&&(s>31||s===9));return new me(_.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function rd(i,e,t,r,n,a){var s=i.body,o=t,c=e,l=!1;if(o===45&&(o=s.charCodeAt(++c)),o===48){if(o=s.charCodeAt(++c),o>=48&&o<=57)throw Xe(i,c,"Invalid number, unexpected digit after 0: ".concat(Pi(o),"."))}else c=hs(i,c,o),o=s.charCodeAt(c);if(o===46&&(l=!0,o=s.charCodeAt(++c),c=hs(i,c,o),o=s.charCodeAt(c)),(o===69||o===101)&&(l=!0,o=s.charCodeAt(++c),(o===43||o===45)&&(o=s.charCodeAt(++c)),c=hs(i,c,o),o=s.charCodeAt(c)),o===46||cd(o))throw Xe(i,c,"Invalid number, expected digit but got: ".concat(Pi(o),"."));return new me(l?_.FLOAT:_.INT,e,c,r,n,a,s.slice(e,c))}function hs(i,e,t){var r=i.body,n=e,a=t;if(a>=48&&a<=57){do a=r.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Xe(i,n,"Invalid number, expected digit but got: ".concat(Pi(a),"."))}function nd(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,c=0,l="";s<a.length&&!isNaN(c=a.charCodeAt(s))&&c!==10&&c!==13;){if(c===34)return l+=a.slice(o,s),new me(_.STRING,e,s+1,t,r,n,l);if(c<32&&c!==9)throw Xe(i,s,"Invalid character within String: ".concat(Pi(c),"."));if(++s,c===92){switch(l+=a.slice(o,s-1),c=a.charCodeAt(s),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+=`
438
- `;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=sd(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var m=a.slice(s+1,s+5);throw Xe(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}l+=String.fromCharCode(u),s+=4;break}default:throw Xe(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++s,o=s}}throw Xe(i,s,"Unterminated string.")}function ad(i,e,t,r,n,a){for(var s=i.body,o=e+3,c=o,l=0,u="";o<s.length&&!isNaN(l=s.charCodeAt(o));){if(l===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(c,o),new me(_.BLOCK_STRING,e,o+3,t,r,n,Zu(u));if(l<32&&l!==9&&l!==10&&l!==13)throw Xe(i,o,"Invalid character within String: ".concat(Pi(l),"."));l===10?(++o,++a.line,a.lineStart=o):l===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):l===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(c,o)+'"""',o+=4,c=o):++o}throw Xe(i,o,"Unterminated string.")}function sd(i,e,t,r){return Bn(i)<<12|Bn(e)<<8|Bn(t)<<4|Bn(r)}function Bn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function od(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,c=0;o!==s&&!isNaN(c=a.charCodeAt(o))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++o;return new me(_.NAME,e,o,t,r,n,a.slice(e,o))}function cd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function ld(i,e){var t=new ud(i,e);return t.parseDocument()}var ud=function(){function i(t,r){var n=Qu(t)?t:new ml(t);this._lexer=new Yu(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken(_.NAME);return{kind:j.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:j.DOCUMENT,definitions:this.many(_.SOF,this.parseDefinition,_.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek(_.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(_.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek(_.BRACE_L))return{kind:j.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek(_.NAME)&&(a=this.parseName()),{kind:j.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken(_.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany(_.PAREN_L,this.parseVariableDefinition,_.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:j.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(_.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(_.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken(_.DOLLAR),{kind:j.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:j.SELECTION_SET,selections:this.many(_.BRACE_L,this.parseSelection,_.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek(_.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken(_.COLON)?(a=n,s=this.parseName()):s=n,{kind:j.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(_.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany(_.PAREN_L,n,_.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken(_.COLON),{kind:j.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:j.ARGUMENT,name:this.parseName(),value:(this.expectToken(_.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken(_.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(_.NAME)?{kind:j.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:j.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:j.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:j.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(r){var n=this._lexer.token;switch(n.kind){case _.BRACKET_L:return this.parseList(r);case _.BRACE_L:return this.parseObject(r);case _.INT:return this._lexer.advance(),{kind:j.INT,value:n.value,loc:this.loc(n)};case _.FLOAT:return this._lexer.advance(),{kind:j.FLOAT,value:n.value,loc:this.loc(n)};case _.STRING:case _.BLOCK_STRING:return this.parseStringLiteral();case _.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:j.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:j.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:j.NULL,loc:this.loc(n)};default:return{kind:j.ENUM,value:n.value,loc:this.loc(n)}}case _.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:j.STRING,value:r.value,block:r.kind===_.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:j.LIST,values:this.any(_.BRACKET_L,s,_.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:j.OBJECT,fields:this.any(_.BRACE_L,s,_.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken(_.COLON),{kind:j.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek(_.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken(_.AT),{kind:j.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken(_.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(_.BRACKET_R),n={kind:j.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken(_.BANG)?{kind:j.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:j.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===_.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek(_.STRING)||this.peek(_.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many(_.BRACE_L,this.parseOperationTypeDefinition,_.BRACE_R);return{kind:j.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken(_.COLON);var a=this.parseNamedType();return{kind:j.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(_.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(_.AMP)||this.peek(_.NAME));return n}return this.delimitedMany(_.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek(_.BRACE_L)&&this._lexer.lookahead().kind===_.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(_.BRACE_L,this.parseFieldDefinition,_.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken(_.COLON);var o=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:j.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:c,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany(_.PAREN_L,this.parseInputValueDef,_.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(_.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken(_.EQUALS)&&(o=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:j.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:c,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:j.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(_.EQUALS)?this.delimitedMany(_.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:j.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(_.BRACE_L,this.parseEnumValueDefinition,_.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:j.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(_.BRACE_L,this.parseInputValueDef,_.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===_.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(_.BRACE_L,this.parseOperationTypeDefinition,_.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:j.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=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:j.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(_.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:j.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:c,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany(_.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Gu[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new hl(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Xe(this._lexer.source,n.start,"Expected ".concat(yl(r),", found ").concat(gs(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===_.NAME&&n.value===r)this._lexer.advance();else throw Xe(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(gs(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===_.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Xe(this._lexer.source,n.start,"Unexpected ".concat(gs(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function gs(i){var e=i.value;return yl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function yl(i){return Xu(i)?'"'.concat(i,'"'):i}var na=new Map,Os=new Map,vl=!0,ba=!1;function bl(i){return i.replace(/[\s,]+/g," ").trim()}function dd(i){return bl(i.source.body.substring(i.start,i.end))}function pd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=dd(r.loc),s=Os.get(n);s&&!s.has(a)?vl&&console.warn("Warning: fragment with name "+n+` already exists.
436
+ `+dl(i.source,o)}return e}function Ge(i,e,t){return new Du("Syntax Error: ".concat(t),void 0,i,[e])}var j=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 Uu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Fu=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ps=Fu;function hl(i){var e=i.prototype.toJSON;typeof e=="function"||Uu(0),i.prototype.inspect=e,Ps&&(i.prototype[Ps]=e)}var gl=function(){function i(t,r,n){this.start=t.start,this.end=r.end,this.startToken=t,this.endToken=r,this.source=n}var e=i.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},i}();hl(gl);var he=function(){function i(t,r,n,a,s,o,c){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=c,this.prev=o,this.next=null}var e=i.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},i}();hl(he);var $=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 ra(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ra=function(t){return typeof t}:ra=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ra(i)}var ju=10,ml=2;function Bu(i){return ja(i,[])}function ja(i,e){switch(ra(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":qu(i,e);default:return String(i)}}function qu(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=zu(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:ja(n,t)}else if(Array.isArray(i))return Hu(i,t);return Vu(i,t)}function Vu(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>ml)return"["+Ku(i)+"]";var r=t.map(function(n){var a=ja(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function Hu(i,e){if(i.length===0)return"[]";if(e.length>ml)return"[Array]";for(var t=Math.min(ju,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(ja(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function zu(i){var e=i[String(Ps)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function Ku(i){var e=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof i.constructor=="function"){var t=i.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function fs(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var Wu=function(e,t){return e instanceof t};function Wo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Qu(i,e,t){return e&&Wo(i.prototype,e),t&&Wo(i,t),i}var yl=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||fs(0,"Body must be a string. Received: ".concat(Bu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||fs(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||fs(0,"column in locationOffset is 1-indexed and must be positive.")}return Qu(i,[{key:ul,get:function(){return"Source"}}]),i}();function Gu(i){return Wu(i,yl)}var Zu=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 Ju(i){var e=i.split(/\r\n|[\n\r]/g),t=Yu(i);if(t!==0)for(var r=1;r<e.length;r++)e[r]=e[r].slice(t);for(var n=0;n<e.length&&Qo(e[n]);)++n;for(var a=e.length;a>n&&Qo(e[a-1]);)--a;return e.slice(n,a).join(`
437
+ `)}function Qo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Yu(i){for(var e,t=!0,r=!0,n=0,a=null,s=0;s<i.length;++s)switch(i.charCodeAt(s)){case 13:i.charCodeAt(s+1)===10&&++s;case 10:t=!1,r=!0,n=0;break;case 9:case 32:++n;break;default:r&&!t&&(a===null||n<a)&&(a=n),r=!1}return(e=a)!==null&&e!==void 0?e:0}var Xu=function(){function i(t){var r=new he($.SOF,0,0,0,0,null);this.source=t,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var e=i.prototype;return e.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},e.lookahead=function(){var r=this.token;if(r.kind!==$.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=td(this,r)}while(r.kind===$.COMMENT);return r},i}();function ed(i){return i===$.BANG||i===$.DOLLAR||i===$.AMP||i===$.PAREN_L||i===$.PAREN_R||i===$.SPREAD||i===$.COLON||i===$.EQUALS||i===$.AT||i===$.BRACKET_L||i===$.BRACKET_R||i===$.BRACE_L||i===$.PIPE||i===$.BRACE_R}function Ni(i){return isNaN(i)?$.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function td(i,e){for(var t=i.source,r=t.body,n=r.length,a=e.end;a<n;){var s=r.charCodeAt(a),o=i.line,c=1+a-i.lineStart;switch(s){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++i.line,i.lineStart=a;continue;case 13:r.charCodeAt(a+1)===10?a+=2:++a,++i.line,i.lineStart=a;continue;case 33:return new he($.BANG,a,a+1,o,c,e);case 35:return rd(t,a,o,c,e);case 36:return new he($.DOLLAR,a,a+1,o,c,e);case 38:return new he($.AMP,a,a+1,o,c,e);case 40:return new he($.PAREN_L,a,a+1,o,c,e);case 41:return new he($.PAREN_R,a,a+1,o,c,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new he($.SPREAD,a,a+3,o,c,e);break;case 58:return new he($.COLON,a,a+1,o,c,e);case 61:return new he($.EQUALS,a,a+1,o,c,e);case 64:return new he($.AT,a,a+1,o,c,e);case 91:return new he($.BRACKET_L,a,a+1,o,c,e);case 93:return new he($.BRACKET_R,a,a+1,o,c,e);case 123:return new he($.BRACE_L,a,a+1,o,c,e);case 124:return new he($.PIPE,a,a+1,o,c,e);case 125:return new he($.BRACE_R,a,a+1,o,c,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?sd(t,a,o,c,e,i):ad(t,a,o,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 nd(t,a,s,o,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 cd(t,a,o,c,e)}throw Ge(t,a,id(s))}var l=i.line,u=1+a-i.lineStart;return new he($.EOF,n,n,l,u,e)}function id(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Ni(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Ni(i),".")}function rd(i,e,t,r,n){var a=i.body,s,o=e;do s=a.charCodeAt(++o);while(!isNaN(s)&&(s>31||s===9));return new he($.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function nd(i,e,t,r,n,a){var s=i.body,o=t,c=e,l=!1;if(o===45&&(o=s.charCodeAt(++c)),o===48){if(o=s.charCodeAt(++c),o>=48&&o<=57)throw Ge(i,c,"Invalid number, unexpected digit after 0: ".concat(Ni(o),"."))}else c=hs(i,c,o),o=s.charCodeAt(c);if(o===46&&(l=!0,o=s.charCodeAt(++c),c=hs(i,c,o),o=s.charCodeAt(c)),(o===69||o===101)&&(l=!0,o=s.charCodeAt(++c),(o===43||o===45)&&(o=s.charCodeAt(++c)),c=hs(i,c,o),o=s.charCodeAt(c)),o===46||ld(o))throw Ge(i,c,"Invalid number, expected digit but got: ".concat(Ni(o),"."));return new he(l?$.FLOAT:$.INT,e,c,r,n,a,s.slice(e,c))}function hs(i,e,t){var r=i.body,n=e,a=t;if(a>=48&&a<=57){do a=r.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Ge(i,n,"Invalid number, expected digit but got: ".concat(Ni(a),"."))}function ad(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,c=0,l="";s<a.length&&!isNaN(c=a.charCodeAt(s))&&c!==10&&c!==13;){if(c===34)return l+=a.slice(o,s),new he($.STRING,e,s+1,t,r,n,l);if(c<32&&c!==9)throw Ge(i,s,"Invalid character within String: ".concat(Ni(c),"."));if(++s,c===92){switch(l+=a.slice(o,s-1),c=a.charCodeAt(s),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+=`
438
+ `;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=od(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var y=a.slice(s+1,s+5);throw Ge(i,s,"Invalid character escape sequence: \\u".concat(y,"."))}l+=String.fromCharCode(u),s+=4;break}default:throw Ge(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++s,o=s}}throw Ge(i,s,"Unterminated string.")}function sd(i,e,t,r,n,a){for(var s=i.body,o=e+3,c=o,l=0,u="";o<s.length&&!isNaN(l=s.charCodeAt(o));){if(l===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(c,o),new he($.BLOCK_STRING,e,o+3,t,r,n,Ju(u));if(l<32&&l!==9&&l!==10&&l!==13)throw Ge(i,o,"Invalid character within String: ".concat(Ni(l),"."));l===10?(++o,++a.line,a.lineStart=o):l===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):l===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(c,o)+'"""',o+=4,c=o):++o}throw Ge(i,o,"Unterminated string.")}function od(i,e,t,r){return jn(i)<<12|jn(e)<<8|jn(t)<<4|jn(r)}function jn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function cd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,c=0;o!==s&&!isNaN(c=a.charCodeAt(o))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++o;return new he($.NAME,e,o,t,r,n,a.slice(e,o))}function ld(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function ud(i,e){var t=new dd(i,e);return t.parseDocument()}var dd=function(){function i(t,r){var n=Gu(t)?t:new yl(t);this._lexer=new Xu(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:j.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:j.DOCUMENT,definitions:this.many($.SOF,this.parseDefinition,$.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek($.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($.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek($.BRACE_L))return{kind:j.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek($.NAME)&&(a=this.parseName()),{kind:j.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken($.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:j.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken($.DOLLAR),{kind:j.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:j.SELECTION_SET,selections:this.many($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken($.COLON)?(a=n,s=this.parseName()):s=n,{kind:j.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,n,$.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken($.COLON),{kind:j.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:j.ARGUMENT,name:this.parseName(),value:(this.expectToken($.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken($.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek($.NAME)?{kind:j.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:j.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:j.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:j.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(r){var n=this._lexer.token;switch(n.kind){case $.BRACKET_L:return this.parseList(r);case $.BRACE_L:return this.parseObject(r);case $.INT:return this._lexer.advance(),{kind:j.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:j.FLOAT,value:n.value,loc:this.loc(n)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:j.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:j.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:j.NULL,loc:this.loc(n)};default:return{kind:j.ENUM,value:n.value,loc:this.loc(n)}}case $.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:j.STRING,value:r.value,block:r.kind===$.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:j.LIST,values:this.any($.BRACKET_L,s,$.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:j.OBJECT,fields:this.any($.BRACE_L,s,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:j.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek($.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken($.AT),{kind:j.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken($.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken($.BRACKET_R),n={kind:j.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:j.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:j.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek($.STRING)||this.peek($.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);return{kind:j.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken($.COLON);var a=this.parseNamedType();return{kind:j.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken($.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return n}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken($.COLON);var o=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:j.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:c,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken($.EQUALS)&&(o=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:j.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:c,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:j.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:c,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:j.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken($.EQUALS)?this.delimitedMany($.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:j.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany($.BRACE_L,this.parseEnumValueDefinition,$.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:j.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:j.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===$.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:j.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=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:j.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:j.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:j.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken($.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:j.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:c,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Zu[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new gl(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Ge(this._lexer.source,n.start,"Expected ".concat(vl(r),", found ").concat(gs(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===$.NAME&&n.value===r)this._lexer.advance();else throw Ge(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(gs(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===$.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Ge(this._lexer.source,n.start,"Unexpected ".concat(gs(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function gs(i){var e=i.value;return vl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function vl(i){return ed(i)?'"'.concat(i,'"'):i}var na=new Map,Os=new Map,bl=!0,ya=!1;function Sl(i){return i.replace(/[\s,]+/g," ").trim()}function pd(i){return Sl(i.source.body.substring(i.start,i.end))}function fd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=pd(r.loc),s=Os.get(n);s&&!s.has(a)?bl&&console.warn("Warning: fragment with name "+n+` already exists.
439
439
  graphql-tag enforces all fragment names across your application to be unique; read more about
440
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Os.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),va(va({},i),{definitions:t})}function fd(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function hd(i){var e=bl(i);if(!na.has(e)){var t=ld(i,{experimentalFragmentVariables:ba,allowLegacyFragmentVariables:ba});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");na.set(e,fd(pd(t)))}return na.get(e)}function v(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),hd(r)}function gd(){na.clear(),Os.clear()}function md(){vl=!1}function yd(){ba=!0}function vd(){ba=!1}var Dr={gql:v,resetCaches:gd,disableFragmentWarnings:md,enableExperimentalFragmentVariables:yd,disableExperimentalFragmentVariables:vd};(function(i){i.gql=Dr.gql,i.resetCaches=Dr.resetCaches,i.disableFragmentWarnings=Dr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Dr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Dr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function S(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function bd(){}function oi(){return bd}var z=oi,h=oi,Ie=oi,re=oi,q=oi,rt=oi,Sd=oi,ao=oi,Sl=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ri=class{constructor(e){this.code=e}};Sl([h(),wl("design:type",String)],Ri.prototype,"code",void 0);Ri=Sl([q(),wl("design:paramtypes",[String])],Ri);var so=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},oo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Et=class{constructor(e,t){this.address=e,this.name=t}};so([h(),oo("design:type",String)],Et.prototype,"address",void 0);so([h(),oo("design:type",String)],Et.prototype,"name",void 0);Et=so([q(),oo("design:paramtypes",[String,String])],Et);var pe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Se=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ut=class{constructor(e,t){this.key=t,this.signature=e}};pe([h(),Se("design:type",String)],Ut.prototype,"signature",void 0);pe([h(),Se("design:type",String)],Ut.prototype,"key",void 0);pe([h(),Se("design:type",Boolean)],Ut.prototype,"valid",void 0);pe([h(),Se("design:type",Boolean)],Ut.prototype,"invalid",void 0);Ut=pe([q(),Ie(),Se("design:paramtypes",[String,String])],Ut);var Oi=class{};pe([h(),Se("design:type",String)],Oi.prototype,"signature",void 0);pe([h(),Se("design:type",String)],Oi.prototype,"key",void 0);pe([h(),Se("design:type",Boolean)],Oi.prototype,"valid",void 0);pe([h(),Se("design:type",Boolean)],Oi.prototype,"invalid",void 0);Oi=pe([Ie()],Oi);function ci(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return pe([h(),Se("design:type",String)],e.prototype,"author",void 0),pe([h(),Se("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),Se("design:type",Object)],e.prototype,"data",void 0),pe([h(),Se("design:type",Ut)],e.prototype,"proof",void 0),e=pe([q(),Se("design:paramtypes",[String,String,Object,Ut])],e),e}function wd(i){let e=class{};return pe([h(),Se("design:type",String)],e.prototype,"author",void 0),pe([h(),Se("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),Se("design:type",Object)],e.prototype,"data",void 0),pe([h(),Se("design:type",Oi)],e.prototype,"proof",void 0),e=pe([Ie()],e),e}var Qo=class extends ci(){};Qo=pe([q()],Qo);var Sa=class extends ci(){};pe([h(),Se("design:type",Et)],Sa.prototype,"language",void 0);pe([h(),Se("design:type",Ri)],Sa.prototype,"icon",void 0);Sa=pe([q()],Sa);function jm(i){return i&&i.author&&i.timestamp&&i.data}var ye=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ne=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ye=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ye([h(),Ne("design:type",String)],Ye.prototype,"source",void 0);ye([h(),Ne("design:type",String)],Ye.prototype,"target",void 0);ye([h(),Ne("design:type",String)],Ye.prototype,"predicate",void 0);Ye=ye([q(),Ne("design:paramtypes",[Object])],Ye);var wa=class{};ye([h(),Ne("design:type",Array)],wa.prototype,"additions",void 0);ye([h(),Ne("design:type",Array)],wa.prototype,"removals",void 0);wa=ye([Ie()],wa);var _a=class{constructor(e,t){this.additions=e,this.removals=t}};ye([h(),Ne("design:type",Array)],_a.prototype,"additions",void 0);ye([h(),Ne("design:type",Array)],_a.prototype,"removals",void 0);_a=ye([q(),Ne("design:paramtypes",[Array,Array])],_a);var dn=class{};ye([h(),Ne("design:type",String)],dn.prototype,"source",void 0);ye([h(),Ne("design:type",String)],dn.prototype,"target",void 0);ye([h(),Ne("design:type",String)],dn.prototype,"predicate",void 0);dn=ye([Ie()],dn);var ti=class extends ci(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};ye([h(),Ne("design:type",String)],ti.prototype,"status",void 0);ti=ye([q()],ti);var Ds=class extends wd(){};ye([h(),Ne("design:type",String)],Ds.prototype,"status",void 0);Ds=ye([Ie()],Ds);function Qm(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function Gm(i){return i&&i.source&&i.target}var Ea=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ye([h(),Ne("design:type",ti)],Ea.prototype,"oldLink",void 0);ye([h(),Ne("design:type",ti)],Ea.prototype,"newLink",void 0);Ea=ye([q(),Ne("design:paramtypes",[ti,ti])],Ea);var zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},En=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Us,At=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 r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.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}};zi([h(),En("design:type",Array)],At.prototype,"links",void 0);At=zi([q(),En("design:paramtypes",[Array])],At);var xa=class{};zi([h(),En("design:type",Array)],xa.prototype,"links",void 0);xa=zi([Ie()],xa);var Ms=Us=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Us;return t.links.push(e),t}};zi([h(),En("design:type",Array)],Ms.prototype,"links",void 0);Ms=Us=zi([Ie(),En("design:paramtypes",[Array])],Ms);var Di=class extends ci(){};Di=zi([q()],Di);var R=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},O=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Gt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new At}};R([h(),O("design:type",String)],Gt.prototype,"did",void 0);R([h(),O("design:type",At)],Gt.prototype,"perspective",void 0);R([h(),O("design:type",String)],Gt.prototype,"directMessageLanguage",void 0);Gt=R([q(),O("design:paramtypes",[String,At])],Gt);var Go=class extends ci(){};Go=R([q()],Go);var ii=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};R([h(),O("design:type",String)],ii.prototype,"did",void 0);R([h(),O("design:type",String)],ii.prototype,"didSigningKeyId",void 0);R([h(),O("design:type",String)],ii.prototype,"deviceKeyType",void 0);R([h(),O("design:type",String)],ii.prototype,"deviceKey",void 0);R([h(),O("design:type",String)],ii.prototype,"deviceKeySignedByDid",void 0);R([h(),O("design:type",String)],ii.prototype,"didSignedByDeviceKey",void 0);ii=R([q(),O("design:paramtypes",[String,String,String,String,String,String])],ii);var ri=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};R([h(),O("design:type",String)],ri.prototype,"did",void 0);R([h(),O("design:type",String)],ri.prototype,"didSigningKeyId",void 0);R([h(),O("design:type",String)],ri.prototype,"deviceKeyType",void 0);R([h(),O("design:type",String)],ri.prototype,"deviceKey",void 0);R([h(),O("design:type",String)],ri.prototype,"deviceKeySignedByDid",void 0);R([h(),O("design:type",String)],ri.prototype,"didSignedByDeviceKey",void 0);ri=R([Ie(),O("design:paramtypes",[String,String,String,String,String,String])],ri);var $a=class{constructor(e,t){this.signature=e,this.publicKey=t}};R([h(),O("design:type",String)],$a.prototype,"signature",void 0);R([h(),O("design:type",String)],$a.prototype,"publicKey",void 0);$a=R([q(),O("design:paramtypes",[String,String])],$a);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};R([h(),O("design:type",String)],gr.prototype,"domain",void 0);R([h(),O("design:type",Array)],gr.prototype,"pointers",void 0);gr=R([q(),O("design:paramtypes",[String,Array])],gr);var Aa=class{constructor(e,t){this.with=e,this.can=t}};R([h(),O("design:type",gr)],Aa.prototype,"with",void 0);R([h(),O("design:type",Array)],Aa.prototype,"can",void 0);Aa=R([q(),O("design:paramtypes",[gr,Array])],Aa);var Mt=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};R([h(),O("design:type",String)],Mt.prototype,"appName",void 0);R([h(),O("design:type",String)],Mt.prototype,"appDesc",void 0);R([h(),O("design:type",String)],Mt.prototype,"appUrl",void 0);R([h(),O("design:type",String)],Mt.prototype,"appIconPath",void 0);R([h(),O("design:type",Array)],Mt.prototype,"capabilities",void 0);Mt=R([q(),O("design:paramtypes",[String,String,String,Array,String])],Mt);var mr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};R([h(),O("design:type",String)],mr.prototype,"requestId",void 0);R([h(),O("design:type",String)],mr.prototype,"token",void 0);R([h(),O("design:type",Boolean)],mr.prototype,"revoked",void 0);R([h(),O("design:type",Mt)],mr.prototype,"auth",void 0);mr=R([q(),O("design:paramtypes",[String,Mt,String,Boolean])],mr);var yr=class{constructor(e,t){this.domain=e,this.pointers=t}};R([h(),O("design:type",String)],yr.prototype,"domain",void 0);R([h(),O("design:type",Array)],yr.prototype,"pointers",void 0);yr=R([Ie(),O("design:paramtypes",[String,Array])],yr);var Ia=class{constructor(e,t){this.with=e,this.can=t}};R([h(),O("design:type",yr)],Ia.prototype,"with",void 0);R([h(),O("design:type",Array)],Ia.prototype,"can",void 0);Ia=R([Ie(),O("design:paramtypes",[yr,Array])],Ia);var It=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};R([h(),O("design:type",String)],It.prototype,"appName",void 0);R([h(),O("design:type",String)],It.prototype,"appDesc",void 0);R([h(),O("design:type",String)],It.prototype,"appDomain",void 0);R([h(),O("design:type",String)],It.prototype,"appUrl",void 0);R([h(),O("design:type",String)],It.prototype,"appIconPath",void 0);R([h(),O("design:type",Array)],It.prototype,"capabilities",void 0);It=R([Ie(),O("design:paramtypes",[String,String,String,String,String,Array])],It);var Ui=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};R([h(),O("design:type",String)],Ui.prototype,"did",void 0);R([h(),O("design:type",Boolean)],Ui.prototype,"success",void 0);R([h(),O("design:type",String)],Ui.prototype,"error",void 0);Ui=R([q(),O("design:paramtypes",[String,Boolean,String])],Ui);var $r=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ar=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ct=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)}};$r([h(),Ar("design:type",Boolean)],ct.prototype,"isInitialized",void 0);$r([h(),Ar("design:type",Boolean)],ct.prototype,"isUnlocked",void 0);$r([h(),Ar("design:type",String)],ct.prototype,"did",void 0);$r([h(),Ar("design:type",String)],ct.prototype,"didDocument",void 0);$r([h(),Ar("design:type",String)],ct.prototype,"error",void 0);ct=$r([q(),Ar("design:paramtypes",[Object])],ct);var Zo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},he=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},He,Ke,Fs=class{constructor(e,t){He.set(this,void 0),Ke.set(this,void 0),Zo(this,He,e,"f"),Zo(this,Ke,t,"f")}async otherAgents(){return await he(this,He,"f").otherAgents(he(this,Ke,"f"))}async hasTelepresenceAdapter(){return await he(this,He,"f").hasTelepresenceAdapter(he(this,Ke,"f"))}async onlineAgents(){return await he(this,He,"f").onlineAgents(he(this,Ke,"f"))}async setOnlineStatus(e){return await he(this,He,"f").setOnlineStatus(he(this,Ke,"f"),e)}async setOnlineStatusU(e){return await he(this,He,"f").setOnlineStatusU(he(this,Ke,"f"),e)}async sendSignal(e,t){return await he(this,He,"f").sendSignal(he(this,Ke,"f"),e,t)}async sendSignalU(e,t){return await he(this,He,"f").sendSignalU(he(this,Ke,"f"),e,t)}async sendBroadcast(e,t=!1){return await he(this,He,"f").sendBroadcast(he(this,Ke,"f"),e,t)}async sendBroadcastU(e,t=!1){return await he(this,He,"f").sendBroadcastU(he(this,Ke,"f"),e,t)}async addSignalHandler(e){await he(this,He,"f").addSignalHandler(he(this,Ke,"f"),e)}removeSignalHandler(e){he(this,He,"f").removeSignalHandler(he(this,Ke,"f"),e)}};He=new WeakMap,Ke=new WeakMap;var Hi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ki=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},se=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)}};Hi([h(),Ki("design:type",String)],se.prototype,"source",void 0);Hi([h(),Ki("design:type",String)],se.prototype,"target",void 0);Hi([h(),Ki("design:type",String)],se.prototype,"predicate",void 0);Hi([h(),Ki("design:type",Date)],se.prototype,"fromDate",void 0);Hi([h(),Ki("design:type",Date)],se.prototype,"untilDate",void 0);Hi([h(),Ki("design:type",Number)],se.prototype,"limit",void 0);se=Hi([q(),Ie(),Ki("design:paramtypes",[Object])],se);var Jo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ce=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},We,Nt;function jn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ae=class{constructor(){We.set(this,void 0),Nt.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 ae;return Jo(t,Nt,e,"f"),t}static from(e){let t=new ae;return Jo(t,We,e,"f"),t}toUrl(){if(Ce(this,Nt,"f")&&!Ce(this,We,"f"))return Ce(this,Nt,"f");if(!Ce(this,Nt,"f")&&(Ce(this,We,"f")===void 0||Ce(this,We,"f")===""||Ce(this,We,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ce(this,We,"f")){case"string":e=`string:${jn(Ce(this,We,"f"))}`;break;case"number":e=`number:${jn(Ce(this,We,"f"))}`;break;case"boolean":e=`boolean:${jn(Ce(this,We,"f"))}`;break;case"object":e=`json:${jn(JSON.stringify(Ce(this,We,"f")))}`;break}return`literal://${e}`}get(){if(Ce(this,We,"f"))return Ce(this,We,"f");if(!Ce(this,Nt,"f"))throw new Error("Can't render empty Literal");if(!Ce(this,Nt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ce(this,Nt,"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}`)}};We=new WeakMap,Nt=new WeakMap;function Zt(i){return i.charAt(0).toUpperCase()+i.slice(1)}function ka(i){return`set${Zt(i)}`}function co(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function _d(i){return`add${Zt(co(i))}`}function Ed(i){return`remove${Zt(co(i))}`}function xd(i){return`setCollection${Zt(co(i))}`}function vi(i){if(Array.isArray(i))return`[${i.map(vi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var ms=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},K=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Be,je,ge,fr=class{constructor(i,e,t){Be.set(this,void 0),je.set(this,void 0),ge.set(this,void 0),ms(this,Be,e,"f"),ms(this,je,t,"f"),ms(this,ge,i,"f")}get baseExpression(){return K(this,Be,"f")}async init(){let isInstance=await K(this,ge,"f").isSubjectInstance(K(this,Be,"f"),K(this,je,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,je,"f")} for ${K(this,Be,"f")}`;let results=await K(this,ge,"f").infer(`subject_class("${K(this,je,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,ge,"f").infer(`subject_class("${K(this,je,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getPropertyValueViaSurreal(K(this,Be,"f"),K(this,je,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,ge,"f").infer(`subject_class("${K(this,je,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await K(this,ge,"f").infer(`subject_class("${K(this,je,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[ka(property)]=async i=>{resolveLanguage&&(i=await K(this,ge,"f").createExpression(i,resolveLanguage)),await K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:i}])}}let results2=await K(this,ge,"f").infer(`subject_class("${K(this,je,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(i=>i.Collection);for(let i of collections)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getCollectionValuesViaSurreal(K(this,Be,"f"),K(this,je,"f"),i)}catch(e){return console.warn(`Failed to get collection ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ge,"f").infer(`subject_class("${K(this,je,"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[_d(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:i}])}}let removers=await K(this,ge,"f").infer(`subject_class("${K(this,je,"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[Ed(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:i}])}}let collectionSetters=await K(this,ge,"f").infer(`subject_class("${K(this,je,"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[xd(collection)]=async i=>{Array.isArray(i)?await K(this,ge,"f").executeAction(actions,K(this,Be,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ge,"f").executeAction(actions,K(this,Be,"f"),[{name:"value",value:i}])}}}};Be=new WeakMap,je=new WeakMap,ge=new WeakMap;function Yo(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function _l(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${Yo(e)} your ${t} actions, with access to ${Yo(r)}`}function ne(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function Xo(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function ec(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function tc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var Jt=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=Xo(e),n=tc(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[]}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
440
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Os.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),ma(ma({},i),{definitions:t})}function hd(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function gd(i){var e=Sl(i);if(!na.has(e)){var t=ud(i,{experimentalFragmentVariables:ya,allowLegacyFragmentVariables:ya});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");na.set(e,hd(fd(t)))}return na.get(e)}function v(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),gd(r)}function md(){na.clear(),Os.clear()}function yd(){bl=!1}function vd(){ya=!0}function bd(){ya=!1}var Pr={gql:v,resetCaches:md,disableFragmentWarnings:yd,enableExperimentalFragmentVariables:vd,disableExperimentalFragmentVariables:bd};(function(i){i.gql=Pr.gql,i.resetCaches=Pr.resetCaches,i.disableFragmentWarnings=Pr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Pr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Pr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function b(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function Sd(){}function si(){return Sd}var H=si,f=si,xe=si,ne=si,q=si,Xe=si,wd=si,ao=si,wl=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},_l=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ri=class{constructor(e){this.code=e}};wl([f(),_l("design:type",String)],Ri.prototype,"code",void 0);Ri=wl([q(),_l("design:paramtypes",[String])],Ri);var so=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},oo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},_t=class{constructor(e,t){this.address=e,this.name=t}};so([f(),oo("design:type",String)],_t.prototype,"address",void 0);so([f(),oo("design:type",String)],_t.prototype,"name",void 0);_t=so([q(),oo("design:paramtypes",[String,String])],_t);var ue=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ve=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Mt=class{constructor(e,t){this.key=t,this.signature=e}};ue([f(),ve("design:type",String)],Mt.prototype,"signature",void 0);ue([f(),ve("design:type",String)],Mt.prototype,"key",void 0);ue([f(),ve("design:type",Boolean)],Mt.prototype,"valid",void 0);ue([f(),ve("design:type",Boolean)],Mt.prototype,"invalid",void 0);Mt=ue([q(),xe(),ve("design:paramtypes",[String,String])],Mt);var Pi=class{};ue([f(),ve("design:type",String)],Pi.prototype,"signature",void 0);ue([f(),ve("design:type",String)],Pi.prototype,"key",void 0);ue([f(),ve("design:type",Boolean)],Pi.prototype,"valid",void 0);ue([f(),ve("design:type",Boolean)],Pi.prototype,"invalid",void 0);Pi=ue([xe()],Pi);function oi(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return ue([f(),ve("design:type",String)],e.prototype,"author",void 0),ue([f(),ve("design:type",String)],e.prototype,"timestamp",void 0),ue([f(),ve("design:type",Object)],e.prototype,"data",void 0),ue([f(),ve("design:type",Mt)],e.prototype,"proof",void 0),e=ue([q(),ve("design:paramtypes",[String,String,Object,Mt])],e),e}function _d(i){let e=class{};return ue([f(),ve("design:type",String)],e.prototype,"author",void 0),ue([f(),ve("design:type",String)],e.prototype,"timestamp",void 0),ue([f(),ve("design:type",Object)],e.prototype,"data",void 0),ue([f(),ve("design:type",Pi)],e.prototype,"proof",void 0),e=ue([xe()],e),e}var Go=class extends oi(){};Go=ue([q()],Go);var va=class extends oi(){};ue([f(),ve("design:type",_t)],va.prototype,"language",void 0);ue([f(),ve("design:type",Ri)],va.prototype,"icon",void 0);va=ue([q()],va);function Wm(i){return i&&i.author&&i.timestamp&&i.data}var ge=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ie=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ve=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ge([f(),Ie("design:type",String)],Ve.prototype,"source",void 0);ge([f(),Ie("design:type",String)],Ve.prototype,"target",void 0);ge([f(),Ie("design:type",String)],Ve.prototype,"predicate",void 0);Ve=ge([q(),Ie("design:paramtypes",[Object])],Ve);var ba=class{};ge([f(),Ie("design:type",Array)],ba.prototype,"additions",void 0);ge([f(),Ie("design:type",Array)],ba.prototype,"removals",void 0);ba=ge([xe()],ba);var Sa=class{constructor(e,t){this.additions=e,this.removals=t}};ge([f(),Ie("design:type",Array)],Sa.prototype,"additions",void 0);ge([f(),Ie("design:type",Array)],Sa.prototype,"removals",void 0);Sa=ge([q(),Ie("design:paramtypes",[Array,Array])],Sa);var un=class{};ge([f(),Ie("design:type",String)],un.prototype,"source",void 0);ge([f(),Ie("design:type",String)],un.prototype,"target",void 0);ge([f(),Ie("design:type",String)],un.prototype,"predicate",void 0);un=ge([xe()],un);var ei=class extends oi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};ge([f(),Ie("design:type",String)],ei.prototype,"status",void 0);ei=ge([q()],ei);var Ds=class extends _d(){};ge([f(),Ie("design:type",String)],Ds.prototype,"status",void 0);Ds=ge([xe()],Ds);function ey(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function ty(i){return i&&i.source&&i.target}var wa=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ge([f(),Ie("design:type",ei)],wa.prototype,"oldLink",void 0);ge([f(),Ie("design:type",ei)],wa.prototype,"newLink",void 0);wa=ge([q(),Ie("design:paramtypes",[ei,ei])],wa);var Vi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},_n=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ms,At=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 r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.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}};Vi([f(),_n("design:type",Array)],At.prototype,"links",void 0);At=Vi([q(),_n("design:paramtypes",[Array])],At);var _a=class{};Vi([f(),_n("design:type",Array)],_a.prototype,"links",void 0);_a=Vi([xe()],_a);var Us=Ms=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Ms;return t.links.push(e),t}};Vi([f(),_n("design:type",Array)],Us.prototype,"links",void 0);Us=Ms=Vi([xe(),_n("design:paramtypes",[Array])],Us);var Oi=class extends oi(){};Oi=Vi([q()],Oi);var R=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},P=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Gt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new At}};R([f(),P("design:type",String)],Gt.prototype,"did",void 0);R([f(),P("design:type",At)],Gt.prototype,"perspective",void 0);R([f(),P("design:type",String)],Gt.prototype,"directMessageLanguage",void 0);Gt=R([q(),P("design:paramtypes",[String,At])],Gt);var Zo=class extends oi(){};Zo=R([q()],Zo);var ti=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};R([f(),P("design:type",String)],ti.prototype,"did",void 0);R([f(),P("design:type",String)],ti.prototype,"didSigningKeyId",void 0);R([f(),P("design:type",String)],ti.prototype,"deviceKeyType",void 0);R([f(),P("design:type",String)],ti.prototype,"deviceKey",void 0);R([f(),P("design:type",String)],ti.prototype,"deviceKeySignedByDid",void 0);R([f(),P("design:type",String)],ti.prototype,"didSignedByDeviceKey",void 0);ti=R([q(),P("design:paramtypes",[String,String,String,String,String,String])],ti);var ii=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};R([f(),P("design:type",String)],ii.prototype,"did",void 0);R([f(),P("design:type",String)],ii.prototype,"didSigningKeyId",void 0);R([f(),P("design:type",String)],ii.prototype,"deviceKeyType",void 0);R([f(),P("design:type",String)],ii.prototype,"deviceKey",void 0);R([f(),P("design:type",String)],ii.prototype,"deviceKeySignedByDid",void 0);R([f(),P("design:type",String)],ii.prototype,"didSignedByDeviceKey",void 0);ii=R([xe(),P("design:paramtypes",[String,String,String,String,String,String])],ii);var Ea=class{constructor(e,t){this.signature=e,this.publicKey=t}};R([f(),P("design:type",String)],Ea.prototype,"signature",void 0);R([f(),P("design:type",String)],Ea.prototype,"publicKey",void 0);Ea=R([q(),P("design:paramtypes",[String,String])],Ea);var fr=class{constructor(e,t){this.domain=e,this.pointers=t}};R([f(),P("design:type",String)],fr.prototype,"domain",void 0);R([f(),P("design:type",Array)],fr.prototype,"pointers",void 0);fr=R([q(),P("design:paramtypes",[String,Array])],fr);var xa=class{constructor(e,t){this.with=e,this.can=t}};R([f(),P("design:type",fr)],xa.prototype,"with",void 0);R([f(),P("design:type",Array)],xa.prototype,"can",void 0);xa=R([q(),P("design:paramtypes",[fr,Array])],xa);var Ut=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};R([f(),P("design:type",String)],Ut.prototype,"appName",void 0);R([f(),P("design:type",String)],Ut.prototype,"appDesc",void 0);R([f(),P("design:type",String)],Ut.prototype,"appUrl",void 0);R([f(),P("design:type",String)],Ut.prototype,"appIconPath",void 0);R([f(),P("design:type",Array)],Ut.prototype,"capabilities",void 0);Ut=R([q(),P("design:paramtypes",[String,String,String,Array,String])],Ut);var hr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};R([f(),P("design:type",String)],hr.prototype,"requestId",void 0);R([f(),P("design:type",String)],hr.prototype,"token",void 0);R([f(),P("design:type",Boolean)],hr.prototype,"revoked",void 0);R([f(),P("design:type",Ut)],hr.prototype,"auth",void 0);hr=R([q(),P("design:paramtypes",[String,Ut,String,Boolean])],hr);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};R([f(),P("design:type",String)],gr.prototype,"domain",void 0);R([f(),P("design:type",Array)],gr.prototype,"pointers",void 0);gr=R([xe(),P("design:paramtypes",[String,Array])],gr);var $a=class{constructor(e,t){this.with=e,this.can=t}};R([f(),P("design:type",gr)],$a.prototype,"with",void 0);R([f(),P("design:type",Array)],$a.prototype,"can",void 0);$a=R([xe(),P("design:paramtypes",[gr,Array])],$a);var kt=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};R([f(),P("design:type",String)],kt.prototype,"appName",void 0);R([f(),P("design:type",String)],kt.prototype,"appDesc",void 0);R([f(),P("design:type",String)],kt.prototype,"appDomain",void 0);R([f(),P("design:type",String)],kt.prototype,"appUrl",void 0);R([f(),P("design:type",String)],kt.prototype,"appIconPath",void 0);R([f(),P("design:type",Array)],kt.prototype,"capabilities",void 0);kt=R([xe(),P("design:paramtypes",[String,String,String,String,String,Array])],kt);var Di=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};R([f(),P("design:type",String)],Di.prototype,"did",void 0);R([f(),P("design:type",Boolean)],Di.prototype,"success",void 0);R([f(),P("design:type",String)],Di.prototype,"error",void 0);Di=R([q(),P("design:paramtypes",[String,Boolean,String])],Di);var Er=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},xr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},nt=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)}};Er([f(),xr("design:type",Boolean)],nt.prototype,"isInitialized",void 0);Er([f(),xr("design:type",Boolean)],nt.prototype,"isUnlocked",void 0);Er([f(),xr("design:type",String)],nt.prototype,"did",void 0);Er([f(),xr("design:type",String)],nt.prototype,"didDocument",void 0);Er([f(),xr("design:type",String)],nt.prototype,"error",void 0);nt=Er([q(),xr("design:paramtypes",[Object])],nt);var Jo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},pe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},je,Be,Fs=class{constructor(e,t){je.set(this,void 0),Be.set(this,void 0),Jo(this,je,e,"f"),Jo(this,Be,t,"f")}async otherAgents(){return await pe(this,je,"f").otherAgents(pe(this,Be,"f"))}async hasTelepresenceAdapter(){return await pe(this,je,"f").hasTelepresenceAdapter(pe(this,Be,"f"))}async onlineAgents(){return await pe(this,je,"f").onlineAgents(pe(this,Be,"f"))}async setOnlineStatus(e){return await pe(this,je,"f").setOnlineStatus(pe(this,Be,"f"),e)}async setOnlineStatusU(e){return await pe(this,je,"f").setOnlineStatusU(pe(this,Be,"f"),e)}async sendSignal(e,t){return await pe(this,je,"f").sendSignal(pe(this,Be,"f"),e,t)}async sendSignalU(e,t){return await pe(this,je,"f").sendSignalU(pe(this,Be,"f"),e,t)}async sendBroadcast(e,t=!1){return await pe(this,je,"f").sendBroadcast(pe(this,Be,"f"),e,t)}async sendBroadcastU(e,t=!1){return await pe(this,je,"f").sendBroadcastU(pe(this,Be,"f"),e,t)}async addSignalHandler(e){await pe(this,je,"f").addSignalHandler(pe(this,Be,"f"),e)}removeSignalHandler(e){pe(this,je,"f").removeSignalHandler(pe(this,Be,"f"),e)}};je=new WeakMap,Be=new WeakMap;var Hi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},zi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},te=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)}};Hi([f(),zi("design:type",String)],te.prototype,"source",void 0);Hi([f(),zi("design:type",String)],te.prototype,"target",void 0);Hi([f(),zi("design:type",String)],te.prototype,"predicate",void 0);Hi([f(),zi("design:type",Date)],te.prototype,"fromDate",void 0);Hi([f(),zi("design:type",Date)],te.prototype,"untilDate",void 0);Hi([f(),zi("design:type",Number)],te.prototype,"limit",void 0);te=Hi([q(),xe(),zi("design:paramtypes",[Object])],te);var Yo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ae=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},qe,Nt;function Bn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ae=class{constructor(){qe.set(this,void 0),Nt.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 ae;return Yo(t,Nt,e,"f"),t}static from(e){let t=new ae;return Yo(t,qe,e,"f"),t}toUrl(){if(Ae(this,Nt,"f")&&!Ae(this,qe,"f"))return Ae(this,Nt,"f");if(!Ae(this,Nt,"f")&&(Ae(this,qe,"f")===void 0||Ae(this,qe,"f")===""||Ae(this,qe,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ae(this,qe,"f")){case"string":e=`string:${Bn(Ae(this,qe,"f"))}`;break;case"number":e=`number:${Bn(Ae(this,qe,"f"))}`;break;case"boolean":e=`boolean:${Bn(Ae(this,qe,"f"))}`;break;case"object":e=`json:${Bn(JSON.stringify(Ae(this,qe,"f")))}`;break}return`literal://${e}`}get(){if(Ae(this,qe,"f"))return Ae(this,qe,"f");if(!Ae(this,Nt,"f"))throw new Error("Can't render empty Literal");if(!Ae(this,Nt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ae(this,Nt,"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}`)}};qe=new WeakMap,Nt=new WeakMap;function dt(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Aa(i){return`set${dt(i)}`}function El(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function Ed(i){return`add${dt(El(i))}`}function xd(i){return`remove${dt(El(i))}`}function $d(i){return`set${dt(i)}`}function yi(i){if(Array.isArray(i))return`[${i.map(yi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var ms=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},K=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Oe,De,fe,nn=class{constructor(i,e,t){Oe.set(this,void 0),De.set(this,void 0),fe.set(this,void 0),ms(this,Oe,e,"f"),ms(this,De,t,"f"),ms(this,fe,i,"f")}get baseExpression(){return K(this,Oe,"f")}async init(){let isInstance=await K(this,fe,"f").isSubjectInstance(K(this,Oe,"f"),K(this,De,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,De,"f")} for ${K(this,Oe,"f")}`;let results=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,fe,"f").getPropertyValueViaSurreal(K(this,Oe,"f"),K(this,De,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Aa(property)]=async i=>{resolveLanguage&&(i=await K(this,fe,"f").createExpression(i,resolveLanguage)),await K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:i}])}}let results2=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(i=>i.Collection);for(let i of relations)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,fe,"f").getRelationValuesViaSurreal(K(this,Oe,"f"),K(this,De,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Ed(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:e}]))):await K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:i}])}}let removers=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[xd(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:e}]))):await K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,fe,"f").infer(`subject_class("${K(this,De,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[$d(relation)]=async i=>{Array.isArray(i)?await K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),i.map(e=>({name:"value",value:e}))):await K(this,fe,"f").executeAction(actions,K(this,Oe,"f"),[{name:"value",value:i}])}}}};Oe=new WeakMap,De=new WeakMap,fe=new WeakMap;function Xo(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function ec(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function tc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var Zt=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=Xo(e),n=tc(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
441
441
  `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
442
442
  `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
443
443
  `,e+=`@prefix ad4m: <ad4m://> .
@@ -445,7 +445,8 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
445
445
  `,e+=`<${this.nodeShapeUri}>
446
446
  `,e+=` a sh:NodeShape ;
447
447
  `,this.targetClass&&(e+=` sh:targetClass <${this.targetClass}> ;
448
- `);for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n=t===this.properties.length-1;e+=` sh:property [
448
+ `);for(let t of this.parentShapes)e+=` sh:node <${t}> ;
449
+ `;for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n=t===this.properties.length-1;e+=` sh:property [
449
450
  `,e+=` sh:path <${r.path}> ;
450
451
  `,r.datatype&&(e+=` sh:datatype <${r.datatype}> ;
451
452
  `),r.nodeKind&&(e+=` sh:nodeKind sh:${r.nodeKind} ;
@@ -460,18 +461,39 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
460
461
  `),e=e.slice(0,-2)+`
461
462
  `,e+=n?` ] .
462
463
  `:` ] ;
463
- `}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&this.constructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&this.destructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=Xo(this.targetClass),s=tc(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`})}return e}static fromLinks(e,t){let r=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new Jt(t,r?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(c)}catch{}let s=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(s)try{let c=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(c)}catch{}let o=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of o){let l=c.target,u=e.find(b=>b.source===l&&b.predicate==="sh://path");if(!u)continue;let m;if(!l.startsWith("_:")){let b=l.lastIndexOf(".");b!==-1&&(m=l.substring(b+1))}let p={name:m,path:u.target},d=e.find(b=>b.source===l&&b.predicate==="sh://datatype");d&&(p.datatype=d.target);let f=e.find(b=>b.source===l&&b.predicate==="sh://nodeKind");f&&(p.nodeKind=f.target.replace("sh://",""));let y=e.find(b=>b.source===l&&b.predicate==="sh://minCount");if(y){let b=y.target.replace("literal://","").replace(/\^\^.*$/,"");b.startsWith("number:")&&(b=b.substring(7)),p.minCount=parseInt(b)}let $=e.find(b=>b.source===l&&b.predicate==="sh://maxCount");if($){let b=$.target.replace("literal://","").replace(/\^\^.*$/,"");b.startsWith("number:")&&(b=b.substring(7)),p.maxCount=parseInt(b)}let A=e.find(b=>b.source===l&&b.predicate==="sh://pattern");A&&(p.pattern=A.target.replace("literal://",""));let T=e.find(b=>b.source===l&&b.predicate==="sh://minInclusive");if(T){let b=T.target.replace("literal://","");b.startsWith("number:")&&(b=b.substring(7)),p.minInclusive=parseFloat(b)}let N=e.find(b=>b.source===l&&b.predicate==="sh://maxInclusive");if(N){let b=N.target.replace("literal://","");b.startsWith("number:")&&(b=b.substring(7)),p.maxInclusive=parseFloat(b)}let x=e.find(b=>b.source===l&&b.predicate==="sh://hasValue");x&&(p.hasValue=x.target.replace("literal://",""));let C=e.find(b=>b.source===l&&b.predicate==="ad4m://local");if(C){let b=C.target.replace("literal://","");b.startsWith("boolean:")&&(b=b.substring(8)),p.local=b==="true"}let D=e.find(b=>b.source===l&&b.predicate==="ad4m://writable");if(D){let b=D.target.replace("literal://","");b.startsWith("boolean:")&&(b=b.substring(8)),p.writable=b==="true"}let I=e.find(b=>b.source===l&&b.predicate==="ad4m://resolveLanguage");I&&(p.resolveLanguage=I.target.replace("literal://string:",""));let W=e.find(b=>b.source===l&&b.predicate==="ad4m://setter");if(W)try{let b=W.target.replace("literal://string:","");p.setter=JSON.parse(b)}catch{}let L=e.find(b=>b.source===l&&b.predicate==="ad4m://adder");if(L)try{let b=L.target.replace("literal://string:","");p.adder=JSON.parse(b)}catch{}let k=e.find(b=>b.source===l&&b.predicate==="ad4m://remover");if(k)try{let b=k.target.replace("literal://string:","");p.remover=JSON.parse(b)}catch{}n.addProperty(p)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Jt(e.node_shape_uri,e.target_class):new Jt(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover});return e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),t}},vr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:ae.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:ae.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:ae.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:ae.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),c=new vr(o,s),l=e.find(f=>f.source===t&&f.predicate==="ad4m://flowable");if(l)if(l.target==="ad4m://any")c.flowable="any";else try{let f=l.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(f))}catch{c.flowable="any"}let u=e.find(f=>f.source===t&&f.predicate==="ad4m://startAction");if(u)try{let f=u.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(f))}catch{}let m=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasState"),p=new Map;for(let f of m){let y=f.target,$=e.find(D=>D.source===y&&D.predicate==="ad4m://stateName"),A=$?ae.fromUrl($.target).get():"";p.set(y,A);let T=e.find(D=>D.source===y&&D.predicate==="ad4m://stateValue"),N=T?ae.fromUrl(T.target).get():0,x=e.find(D=>D.source===y&&D.predicate==="ad4m://stateCheck"),C={predicate:"",target:""};if(x)try{let D=x.target.replace("literal://string:","");C=JSON.parse(decodeURIComponent(D))}catch{}c.addState({name:A,value:N,stateCheck:C})}let d=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasTransition");for(let f of d){let y=f.target,$=e.find(k=>k.source===y&&k.predicate==="ad4m://actionName"),A=$?ae.fromUrl($.target).get():"",N=e.find(k=>k.source===y&&k.predicate==="ad4m://fromState")?.target||"",x=p.get(N)||"",D=e.find(k=>k.source===y&&k.predicate==="ad4m://toState")?.target||"",I=p.get(D)||"",W=e.find(k=>k.source===y&&k.predicate==="ad4m://transitionActions"),L=[];if(W)try{let k=W.target.replace("literal://string:","");L=JSON.parse(decodeURIComponent(k))}catch{}c.addTransition({actionName:A,fromState:x,toState:I,actions:L})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new vr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},ie=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},w=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},aa,Pt,vt,bt,Ii,zt,Ht,bi,jr,sa,Si,wi,st,ur,Bs,Y,ee,_i,Ei,xi,qr,Ta=class{constructor(e,t,r){aa.add(this),Pt.set(this,void 0),vt.set(this,void 0),bt.set(this,void 0),Ii.set(this,void 0),zt.set(this,void 0),Ht.set(this,void 0),bi.set(this,void 0),jr.set(this,!1),sa.set(this,void 0),Si.set(this,void 0),wi.set(this,void 0),st.set(this,void 0),ur.set(this,void 0),this.isSurrealDB=!1,ie(this,Pt,e,"f"),ie(this,ur,t,"f"),ie(this,bt,r,"f"),ie(this,Ii,new Set,"f"),ie(this,bi,null,"f"),ie(this,sa,new Promise((n,a)=>{ie(this,Si,n,"f"),ie(this,wi,a,"f")}),"f")}async subscribe(){w(this,Ht,"f")&&(w(this,Ht,"f").call(this),ie(this,Ht,void 0,"f")),w(this,st,"f")&&(clearTimeout(w(this,st,"f")),ie(this,st,void 0,"f")),w(this,zt,"f")&&(clearTimeout(w(this,zt,"f")),ie(this,zt,void 0,"f"));try{let t;this.isSurrealDB?t=await w(this,bt,"f").perspectiveSubscribeSurrealQuery(w(this,Pt,"f"),w(this,ur,"f")):t=await w(this,bt,"f").subscribeQuery(w(this,Pt,"f"),w(this,ur,"f")),ie(this,vt,t.subscriptionId,"f"),t.result?(ie(this,bi,t.result,"f"),w(this,aa,"m",Bs).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ie(this,st,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),ie(this,Ht,w(this,bt,"f").subscribeToQueryUpdates(w(this,vt,"f"),r=>{w(this,st,"f")&&(clearTimeout(w(this,st,"f")),ie(this,st,void 0,"f")),w(this,Si,"f")&&(w(this,Si,"f").call(this,!0),ie(this,Si,void 0,"f"),ie(this,wi,void 0,"f")),!(r.isInit&&w(this,bi,"f"))&&(ie(this,bi,r,"f"),w(this,aa,"m",Bs).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),w(this,wi,"f")&&(w(this,wi,"f").call(this,t),ie(this,Si,void 0,"f"),ie(this,wi,void 0,"f")),t}let e=async()=>{if(!w(this,jr,"f")){try{this.isSurrealDB?await w(this,bt,"f").perspectiveKeepAliveSurrealQuery(w(this,Pt,"f"),w(this,vt,"f")):await w(this,bt,"f").keepAliveQuery(w(this,Pt,"f"),w(this,vt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",w(this,ur,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}w(this,jr,"f")||ie(this,zt,setTimeout(e,3e4),"f")}};ie(this,zt,setTimeout(e,3e4),"f")}get id(){return w(this,vt,"f")}get initialized(){return w(this,sa,"f")}get result(){return w(this,bi,"f")}onResult(e){return w(this,Ii,"f").add(e),()=>w(this,Ii,"f").delete(e)}dispose(){ie(this,jr,!0,"f"),clearTimeout(w(this,zt,"f")),w(this,Ht,"f")&&w(this,Ht,"f").call(this),w(this,Ii,"f").clear(),w(this,st,"f")&&(clearTimeout(w(this,st,"f")),ie(this,st,void 0,"f")),w(this,vt,"f")&&(this.isSurrealDB?w(this,bt,"f").perspectiveDisposeSurrealQuerySubscription(w(this,Pt,"f"),w(this,vt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):w(this,bt,"f").disposeQuerySubscription(w(this,Pt,"f"),w(this,vt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Pt=new WeakMap,vt=new WeakMap,bt=new WeakMap,Ii=new WeakMap,zt=new WeakMap,Ht=new WeakMap,bi=new WeakMap,jr=new WeakMap,sa=new WeakMap,Si=new WeakMap,wi=new WeakMap,st=new WeakMap,ur=new WeakMap,aa=new WeakSet,Bs=function i(e){for(let t of w(this,Ii,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var pr=class{constructor(e,t){Y.set(this,void 0),ee.set(this,void 0),_i.set(this,void 0),Ei.set(this,void 0),xi.set(this,void 0),qr.set(this,void 0),ie(this,_i,[],"f"),ie(this,Ei,[],"f"),ie(this,xi,[],"f"),ie(this,qr,[],"f"),ie(this,Y,e,"f"),ie(this,ee,t,"f"),this.uuid=w(this,Y,"f").uuid,this.name=w(this,Y,"f").name,this.owners=w(this,Y,"f").owners,this.sharedUrl=w(this,Y,"f").sharedUrl,this.neighbourhood=w(this,Y,"f").neighbourhood,this.state=w(this,Y,"f").state,w(this,ee,"f").addPerspectiveLinkAddedListener(w(this,Y,"f").uuid,w(this,_i,"f")),w(this,ee,"f").addPerspectiveLinkRemovedListener(w(this,Y,"f").uuid,w(this,Ei,"f")),w(this,ee,"f").addPerspectiveLinkUpdatedListener(w(this,Y,"f").uuid,w(this,xi,"f")),w(this,ee,"f").addPerspectiveSyncStateChangeListener(w(this,Y,"f").uuid,w(this,qr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await w(this,ee,"f").executeCommands(w(this,Y,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await w(this,ee,"f").queryLinks(w(this,Y,"f").uuid,e)}async infer(e){return await w(this,ee,"f").queryProlog(w(this,Y,"f").uuid,e)}async querySurrealDB(e){return await w(this,ee,"f").querySurrealDB(w(this,Y,"f").uuid,e)}async add(e,t="shared",r){return await w(this,ee,"f").addLink(w(this,Y,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await w(this,ee,"f").addLinks(w(this,Y,"f").uuid,e,t,r)}async removeLinks(e,t){return await w(this,ee,"f").removeLinks(w(this,Y,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await w(this,ee,"f").linkMutations(w(this,Y,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await w(this,ee,"f").addLinkExpression(w(this,Y,"f").uuid,e,t,r)}async update(e,t,r){return await w(this,ee,"f").updateLink(w(this,Y,"f").uuid,e,t,r)}async remove(e,t){return await w(this,ee,"f").removeLink(w(this,Y,"f").uuid,e,t)}async createBatch(){return await w(this,ee,"f").createBatch(w(this,Y,"f").uuid)}async commitBatch(e){return await w(this,ee,"f").commitBatch(w(this,Y,"f").uuid,e)}async getExpression(e){return await w(this,ee,"f").getExpression(e)}async createExpression(e,t){return await w(this,ee,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?w(this,_i,"f").push(t):e==="link-removed"?w(this,Ei,"f").push(t):e==="link-updated"&&w(this,xi,"f").push(t)}async addSyncStateChangeListener(e){w(this,qr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=w(this,_i,"f").indexOf(t);w(this,_i,"f").splice(r,1)}else if(e==="link-removed"){let r=w(this,Ei,"f").indexOf(t);w(this,Ei,"f").splice(r,1)}else if(e==="link-updated"){let r=w(this,xi,"f").indexOf(t);w(this,xi,"f").splice(r,1)}}async snapshot(){return w(this,ee,"f").snapshotByUUID(w(this,Y,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new se({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new se({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return ae.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new se({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new se({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new se({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new se({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new se({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new se({source:s,predicate:"ad4m://sdna"}));for(let c of o){let l=ae.fromUrl(c.data.target).get();typeof l=="string"&&t.push(l)}}}return t}async getSdnaForClass(e){let t=ae.from(e);if((await this.get(new se({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new se({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=ae.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return w(this,ee,"f").addSdna(w(this,Y,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=ae.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Ye({source:s.source,predicate:s.predicate,target:s.target})),new Ye({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ye({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=ae.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new se({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;ne(n);let a=await this.get(new se({source:n,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(m=>m.data.target)].map(m=>`'${ne(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(c)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return Jt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new se({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=ae.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=ae.from(e).toUrl(),a=[...r.map(s=>new Ye({source:s.source,predicate:s.predicate,target:s.target})),new Ye({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ye({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=ae.from(e).toUrl(),r=await this.get(new se({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=ne(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=ne(s),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(c)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return vr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new se({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await w(this,ee,"f").createSubject(w(this,Y,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await w(this,ee,"f").createSubject(w(this,Y,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await w(this,ee,"f").getSubjectData(w(this,Y,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await w(this,ee,"f").getSubjectData(w(this,Y,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new se({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let c=s.data.target.slice(o.length),l=c;try{l=decodeURIComponent(c)}catch{}try{return JSON.parse(l)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${ne(e)}'`,c=(await this.querySurrealDB(s))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of n.requiredTriples){let s=ne(e),o=ne(a.predicate),c;if(a.target){let p=ne(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${p}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let l=await this.querySurrealDB(c);if(!l||l.length===0)return!1;let u=l[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new fr(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&o.add(c.path),c.adder&&c.adder.length>0?s.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){r.push(c.predicate);let l=o.has(c.predicate);c.target&&c.target!=="value"&&!l?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,collections:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=ne(r.predicate);if(r.target){let a=ne(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=ne(e),o=ne(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,l=await this.querySurrealDB(c);if(!l||l.length===0)return;let u=l[0].value;if(a.resolveLanguage&&u)try{let m=await this.getExpression(u);try{return JSON.parse(m.data)}catch{return m.data}}catch{return u}return u}async getCollectionValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.collections.get(r);if(!a)return[];let s=ne(e),o=ne(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,l=await this.querySurrealDB(c);if(!l||l.length===0)return[];let u=l.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let p of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${p.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let f=await this.querySurrealDB(`RETURN ${d}`);(f===!0||Array.isArray(f)&&f.length>0&&f[0]===!0)&&m.push(p)}u=m}catch(m){console.warn(`Failed to apply condition filter for ${r}:`,m)}if(a.instanceFilter)try{let m=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return m?await this.batchCheckSubjectInstances(u,m):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${ne(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(c=>c.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${ne(u)}'`).join(", "),o=ne(a.predicate),c;if(a.target){let u=ne(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let l=await this.querySurrealDB(c);r.push(new Set(l.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),c=await this.querySurrealDB(o);for(let l of c||[])try{let u;r?(u=new e(this,l.base),await u.get()):(u=new fr(this,l.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let c of o||[])try{let l=new fr(this,c.base,n);await l.init(),r.push(l)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],n=Object.getPrototypeOf(e);if(n?.__properties?t=Object.keys(n.__properties):t=Object.keys(e).filter(c=>!Array.isArray(e[c])),n?.__collections?r=Object.keys(n.__collections).filter(c=>c!=="isSubjectInstance"):r=Object.keys(e).filter(c=>Array.isArray(e[c])&&c!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let a=`SELECT
464
+ `}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=Xo(this.targetClass),s=tc(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`})}return e}static fromLinks(e,t){let r=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new Zt(t,r?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(c)}catch{}let s=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(s)try{let c=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(c)}catch{}let o=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of o){let l=c.target,u=e.find(_=>_.source===l&&_.predicate==="sh://path");if(!u)continue;let y;if(!l.startsWith("_:")){let _=l.lastIndexOf(".");_!==-1&&(y=l.substring(_+1))}let g={name:y,path:u.target},d=e.find(_=>_.source===l&&_.predicate==="sh://datatype");d&&(g.datatype=d.target);let p=e.find(_=>_.source===l&&_.predicate==="sh://nodeKind");p&&(g.nodeKind=p.target.replace("sh://",""));let h=e.find(_=>_.source===l&&_.predicate==="sh://minCount");if(h){let _=h.target.replace("literal://","").replace(/\^\^.*$/,"");_.startsWith("number:")&&(_=_.substring(7)),g.minCount=parseInt(_)}let w=e.find(_=>_.source===l&&_.predicate==="sh://maxCount");if(w){let _=w.target.replace("literal://","").replace(/\^\^.*$/,"");_.startsWith("number:")&&(_=_.substring(7)),g.maxCount=parseInt(_)}let E=e.find(_=>_.source===l&&_.predicate==="sh://pattern");E&&(g.pattern=E.target.replace("literal://",""));let I=e.find(_=>_.source===l&&_.predicate==="sh://minInclusive");if(I){let _=I.target.replace("literal://","");_.startsWith("number:")&&(_=_.substring(7)),g.minInclusive=parseFloat(_)}let k=e.find(_=>_.source===l&&_.predicate==="sh://maxInclusive");if(k){let _=k.target.replace("literal://","");_.startsWith("number:")&&(_=_.substring(7)),g.maxInclusive=parseFloat(_)}let S=e.find(_=>_.source===l&&_.predicate==="sh://hasValue");S&&(g.hasValue=S.target.replace("literal://",""));let T=e.find(_=>_.source===l&&_.predicate==="ad4m://local");if(T){let _=T.target.replace("literal://","");_.startsWith("boolean:")&&(_=_.substring(8)),g.local=_==="true"}let O=e.find(_=>_.source===l&&_.predicate==="ad4m://writable");if(O){let _=O.target.replace("literal://","");_.startsWith("boolean:")&&(_=_.substring(8)),g.writable=_==="true"}let C=e.find(_=>_.source===l&&_.predicate==="ad4m://resolveLanguage");C&&(g.resolveLanguage=C.target.replace("literal://string:",""));let W=e.find(_=>_.source===l&&_.predicate==="ad4m://setter");if(W)try{let _=W.target.replace("literal://string:","");g.setter=JSON.parse(_)}catch{}let B=e.find(_=>_.source===l&&_.predicate==="ad4m://adder");if(B)try{let _=B.target.replace("literal://string:","");g.adder=JSON.parse(_)}catch{}let L=e.find(_=>_.source===l&&_.predicate==="ad4m://remover");if(L)try{let _=L.target.replace("literal://string:","");g.remover=JSON.parse(_)}catch{}n.addProperty(g)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Zt(e.node_shape_uri,e.target_class):new Zt(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let r of e.parent_shapes)t.addParentShape(r);return t}},Et=new WeakMap,Le=new WeakMap;function Ci(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Et.get(n);a&&Object.assign(e,a)}return e}function bt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Le.get(n);a&&Object.assign(e,a)}return e}function Ad(i,e,t){Et.has(i)||Et.set(i,{}),Et.get(i)[e]=t}function kd(i,e,t){Le.has(i)||Le.set(i,{}),Le.get(i)[e]=t}function _y(i){let e=i.constructor,t=Ci(e),r={};for(let[n,a]of Object.entries(t))r[n]=i[n];return r}function xl(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var ic=class{};function Ey(i,e,t){return{action:"addLink",source:i,predicate:e,target:t}}function xy(i){return`triple(this, "${i}", _)`}function Ba(i){return function(e,t){let r=i.readOnly?!1:!!i.through;if(i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let n=e.constructor;if(Et.has(n)||Et.set(n,{}),Et.get(n)[t]={...i,writable:r},r){let a=t;e[`set${dt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function $y(i){return Ba({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function Ay(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.value)throw new Error("SubjectFlag requires a 'value' option");let r={through:i.through,required:!0,initial:i.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;Et.has(n)||Et.set(n,{}),Et.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Id(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){let t="",r=i.name,n=e.prototype,a=xl(8);t+=`subject_class("${r}", ${a}).
465
+ `;let s=[],o=[];n.subjectConstructor&&n.subjectConstructor.length&&(o=o.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let l=[],u=Ci(e);for(let h in u){let w=`property(${a}, "${h}").
466
+ `,{through:E,initial:I,required:k,resolveLanguage:S,writable:T,flag:O,prologGetter:C,prologSetter:W,local:B}=u[h];if(S&&(w+=`property_resolve(${a}, "${h}").
467
+ `,w+=`property_resolve_language(${a}, "${h}", "${S}").
468
+ `),C?w+=`property_getter(${a}, Base, "${h}", Value) :- ${C}.
469
+ `:E&&(w+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${E}", Value).
470
+ `,k&&(O?c.push(`triple(Base, "${E}", "${I}")`):c.push(`triple(Base, "${E}", _)`))),W)w+=`property_setter(${a}, "${h}", Actions) :- ${W}.
471
+ `;else if(T&&E&&typeof n[Aa(h)]=="function"){let Ke=[{action:"setSingleTarget",source:"this",predicate:E,target:"value",...B&&{local:!0}}];w+=`property_setter(${a}, "${h}", '${yi(Ke)}').
472
+ `}l.push(w);let L=I??(k&&T&&!O&&E?"literal://string:":void 0);L&&(o.push({action:"addLink",source:"this",predicate:E,target:L}),s.push({action:"removeLink",source:"this",predicate:E,target:"*"}))}let y=[],g=bt(e),d=Object.fromEntries(Object.entries(g).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));for(let h in d){let w=`collection(${a}, "${h}").
473
+ `,{predicate:E,local:I}=d[h];if(E){w+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${E}", C), List).
474
+ `;let k=[{action:"addLink",source:"this",predicate:E,target:"value",...I&&{local:!0}}],S=[{action:"removeLink",source:"this",predicate:E,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:E,target:"value",...I&&{local:!0}}];w+=`collection_adder(${a}, "${h}", '${yi(k)}').
475
+ `,w+=`collection_remover(${a}, "${h}", '${yi(S)}').
476
+ `,w+=`collection_setter(${a}, "${h}", '${yi(T)}').
477
+ `}y.push(w)}let p=yi(o);if(t+=`constructor(${a}, '${p}').
478
+ `,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
479
+ `,t+=`
480
+ `}return t+=`destructor(${a}, '${yi(s)}').
481
+ `,t+=`
482
+ `,t+=l.join(`
483
+ `),t+=`
484
+ `,t+=y.join(`
485
+ `),{sdna:t,name:r}},e.generateSHACL=function(){let t=i.name,r=e.prototype,n="ad4m://",a=Ci(e),s=bt(e),o=Object.fromEntries(Object.entries(s).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));if(Object.keys(a).length>0){let p=a[Object.keys(a)[0]];if(p.through){let h=p.through.match(/^([^:]+:\/\/)/);h&&(n=h[1])}}else if(Object.keys(o).length>0){let p=o[Object.keys(o)[0]];if(p.predicate){let h=p.predicate.match(/^([^:]+:\/\/)/);h&&(n=h[1])}}let c=`${n}${t}Shape`,l=`${n}${t}`,u=new Zt(c,l),y=Object.getPrototypeOf(e);if(y&&typeof y.generateSHACL=="function"){let p=y.generateSHACL();p?.shape?.nodeShapeUri&&u.addParentShape(p.shape.nodeShapeUri)}let g=[];r.subjectConstructor&&r.subjectConstructor.length&&(g=g.concat(r.subjectConstructor));let d=[];for(let p in a){let h=a[p];if(!h.through)continue;let w={name:p,path:h.through};if(h.resolveLanguage==="literal")w.datatype="xsd://string";else if(h.initial){let I=typeof r[p];I==="number"?w.datatype="xsd://integer":I==="boolean"?w.datatype="xsd://boolean":I==="string"&&(w.datatype="xsd://string")}h.required&&(w.minCount=1),w.maxCount=1,h.flag&&h.initial&&(w.hasValue=h.initial),h.local!==void 0&&(w.local=h.local),h.writable!==void 0&&(w.writable=h.writable),h.resolveLanguage&&(w.resolveLanguage=h.resolveLanguage),h.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${p}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):h.writable&&h.through&&typeof r[Aa(p)]=="function"&&(w.setter=[{action:"setSingleTarget",source:"this",predicate:h.through,target:"value",...h.local&&{local:!0}}]);let E=h.initial??(h.required&&h.writable&&!h.flag&&h.through?"literal://string:":void 0);E&&(g.push({action:"addLink",source:"this",predicate:h.through,target:E}),d.push({action:"removeLink",source:"this",predicate:h.through,target:"*"})),u.addProperty(w)}for(let p in o){let h=o[p];if(!h.predicate)continue;let w={name:p,path:h.predicate};w.nodeKind="IRI",h.local!==void 0&&(w.local=h.local),w.adder=[{action:"addLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],w.remover=[{action:"removeLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],u.addProperty(w)}return u.setConstructorActions(g),u.setDestructorActions(d),{shape:u,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function Td(i){let e=i.required??!1;return Ba({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function ky(i){return Td({...i,readOnly:!0})}function qa(i,e){let t=typeof i=="function"?{...e,target:i}:i;if(!t.through)throw new Error("Relation decorator requires a { through: '...' } option specifying the predicate URI.");return t}function Iy(i,e){let t=qa(i,e);return function(r,n){let a=r.constructor;Le.has(a)||Le.set(a,{});let s=Le.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter}};let o=n;r[`add${dt(o)}`]=async function(c,l){return this.addRelationValue(o,c,l)},r[`remove${dt(o)}`]=async function(c,l){return this.removeRelationValue(o,c,l)},r[`set${dt(o)}`]=async function(c,l){return this.setRelationValues(o,c,l)},Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Ty(i,e){let t=qa(i,e);return function(r,n){let a=r.constructor;Le.has(a)||Le.set(a,{});let s=Le.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local},Ba({through:t.through,readOnly:!1,local:t.local})(r,n);let o=n;r[`add${dt(o)}`]=async function(c){return this.addRelationValue(o,c)},r[`remove${dt(o)}`]=async function(c){return this.removeRelationValue(o,c)},r[`set${dt(o)}`]=async function(c){return this.setRelationValues(o,c)}}}function Cy(i,e){let t=qa(i,e);return function(r,n){let a=r.constructor;Le.has(a)||Le.set(a,{});let s=Le.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local},Ba({through:t.through,readOnly:!0,local:t.local})(r,n)}}function Ly(i,e){let t=qa(i,e);return function(r,n){let a=r.constructor;Le.has(a)||Le.set(a,{});let s=Le.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function rc(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function $l(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${rc(e)} your ${t} actions, with access to ${rc(r)}`}function J(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var mr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:ae.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:ae.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:ae.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:ae.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),c=new mr(o,s),l=e.find(p=>p.source===t&&p.predicate==="ad4m://flowable");if(l)if(l.target==="ad4m://any")c.flowable="any";else try{let p=l.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(p))}catch{c.flowable="any"}let u=e.find(p=>p.source===t&&p.predicate==="ad4m://startAction");if(u)try{let p=u.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(p))}catch{}let y=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasState"),g=new Map;for(let p of y){let h=p.target,w=e.find(O=>O.source===h&&O.predicate==="ad4m://stateName"),E=w?ae.fromUrl(w.target).get():"";g.set(h,E);let I=e.find(O=>O.source===h&&O.predicate==="ad4m://stateValue"),k=I?ae.fromUrl(I.target).get():0,S=e.find(O=>O.source===h&&O.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(S)try{let O=S.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(O))}catch{}c.addState({name:E,value:k,stateCheck:T})}let d=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasTransition");for(let p of d){let h=p.target,w=e.find(L=>L.source===h&&L.predicate==="ad4m://actionName"),E=w?ae.fromUrl(w.target).get():"",k=e.find(L=>L.source===h&&L.predicate==="ad4m://fromState")?.target||"",S=g.get(k)||"",O=e.find(L=>L.source===h&&L.predicate==="ad4m://toState")?.target||"",C=g.get(O)||"",W=e.find(L=>L.source===h&&L.predicate==="ad4m://transitionActions"),B=[];if(W)try{let L=W.target.replace("literal://string:","");B=JSON.parse(decodeURIComponent(L))}catch{}c.addTransition({actionName:E,fromState:S,toState:C,actions:B})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new mr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},re=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},x=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},aa,Rt,mt,yt,Ai,Ht,zt,vi,Fr,sa,bi,Si,it,lr,js,Y,ee,wi,_i,Ei,jr,ka=class{constructor(e,t,r){aa.add(this),Rt.set(this,void 0),mt.set(this,void 0),yt.set(this,void 0),Ai.set(this,void 0),Ht.set(this,void 0),zt.set(this,void 0),vi.set(this,void 0),Fr.set(this,!1),sa.set(this,void 0),bi.set(this,void 0),Si.set(this,void 0),it.set(this,void 0),lr.set(this,void 0),this.isSurrealDB=!1,re(this,Rt,e,"f"),re(this,lr,t,"f"),re(this,yt,r,"f"),re(this,Ai,new Set,"f"),re(this,vi,null,"f"),re(this,sa,new Promise((n,a)=>{re(this,bi,n,"f"),re(this,Si,a,"f")}),"f")}async subscribe(){x(this,zt,"f")&&(x(this,zt,"f").call(this),re(this,zt,void 0,"f")),x(this,it,"f")&&(clearTimeout(x(this,it,"f")),re(this,it,void 0,"f")),x(this,Ht,"f")&&(clearTimeout(x(this,Ht,"f")),re(this,Ht,void 0,"f"));try{let t;this.isSurrealDB?t=await x(this,yt,"f").perspectiveSubscribeSurrealQuery(x(this,Rt,"f"),x(this,lr,"f")):t=await x(this,yt,"f").subscribeQuery(x(this,Rt,"f"),x(this,lr,"f")),re(this,mt,t.subscriptionId,"f"),t.result?(re(this,vi,t.result,"f"),x(this,aa,"m",js).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),re(this,it,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),re(this,zt,x(this,yt,"f").subscribeToQueryUpdates(x(this,mt,"f"),r=>{x(this,it,"f")&&(clearTimeout(x(this,it,"f")),re(this,it,void 0,"f")),x(this,bi,"f")&&(x(this,bi,"f").call(this,!0),re(this,bi,void 0,"f"),re(this,Si,void 0,"f")),!(r.isInit&&x(this,vi,"f"))&&(re(this,vi,r,"f"),x(this,aa,"m",js).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),x(this,Si,"f")&&(x(this,Si,"f").call(this,t),re(this,bi,void 0,"f"),re(this,Si,void 0,"f")),t}let e=async()=>{if(!x(this,Fr,"f")){try{this.isSurrealDB?await x(this,yt,"f").perspectiveKeepAliveSurrealQuery(x(this,Rt,"f"),x(this,mt,"f")):await x(this,yt,"f").keepAliveQuery(x(this,Rt,"f"),x(this,mt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",x(this,lr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}x(this,Fr,"f")||re(this,Ht,setTimeout(e,3e4),"f")}};re(this,Ht,setTimeout(e,3e4),"f")}get id(){return x(this,mt,"f")}get initialized(){return x(this,sa,"f")}get result(){return x(this,vi,"f")}onResult(e){return x(this,Ai,"f").add(e),()=>x(this,Ai,"f").delete(e)}dispose(){re(this,Fr,!0,"f"),clearTimeout(x(this,Ht,"f")),x(this,zt,"f")&&x(this,zt,"f").call(this),x(this,Ai,"f").clear(),x(this,it,"f")&&(clearTimeout(x(this,it,"f")),re(this,it,void 0,"f")),x(this,mt,"f")&&(this.isSurrealDB?x(this,yt,"f").perspectiveDisposeSurrealQuerySubscription(x(this,Rt,"f"),x(this,mt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):x(this,yt,"f").disposeQuerySubscription(x(this,Rt,"f"),x(this,mt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Rt=new WeakMap,mt=new WeakMap,yt=new WeakMap,Ai=new WeakMap,Ht=new WeakMap,zt=new WeakMap,vi=new WeakMap,Fr=new WeakMap,sa=new WeakMap,bi=new WeakMap,Si=new WeakMap,it=new WeakMap,lr=new WeakMap,aa=new WeakSet,js=function i(e){for(let t of x(this,Ai,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var dr=class{constructor(e,t){Y.set(this,void 0),ee.set(this,void 0),wi.set(this,void 0),_i.set(this,void 0),Ei.set(this,void 0),jr.set(this,void 0),re(this,wi,[],"f"),re(this,_i,[],"f"),re(this,Ei,[],"f"),re(this,jr,[],"f"),re(this,Y,e,"f"),re(this,ee,t,"f"),this.uuid=x(this,Y,"f").uuid,this.name=x(this,Y,"f").name,this.owners=x(this,Y,"f").owners,this.sharedUrl=x(this,Y,"f").sharedUrl,this.neighbourhood=x(this,Y,"f").neighbourhood,this.state=x(this,Y,"f").state,x(this,ee,"f").addPerspectiveLinkAddedListener(x(this,Y,"f").uuid,x(this,wi,"f")),x(this,ee,"f").addPerspectiveLinkRemovedListener(x(this,Y,"f").uuid,x(this,_i,"f")),x(this,ee,"f").addPerspectiveLinkUpdatedListener(x(this,Y,"f").uuid,x(this,Ei,"f")),x(this,ee,"f").addPerspectiveSyncStateChangeListener(x(this,Y,"f").uuid,x(this,jr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await x(this,ee,"f").executeCommands(x(this,Y,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await x(this,ee,"f").queryLinks(x(this,Y,"f").uuid,e)}async infer(e){return await x(this,ee,"f").queryProlog(x(this,Y,"f").uuid,e)}async querySurrealDB(e){return await x(this,ee,"f").querySurrealDB(x(this,Y,"f").uuid,e)}async add(e,t="shared",r){return await x(this,ee,"f").addLink(x(this,Y,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await x(this,ee,"f").addLinks(x(this,Y,"f").uuid,e,t,r)}async removeLinks(e,t){return await x(this,ee,"f").removeLinks(x(this,Y,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await x(this,ee,"f").linkMutations(x(this,Y,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await x(this,ee,"f").addLinkExpression(x(this,Y,"f").uuid,e,t,r)}async update(e,t,r){return await x(this,ee,"f").updateLink(x(this,Y,"f").uuid,e,t,r)}async remove(e,t){return await x(this,ee,"f").removeLink(x(this,Y,"f").uuid,e,t)}async createBatch(){return await x(this,ee,"f").createBatch(x(this,Y,"f").uuid)}async commitBatch(e){return await x(this,ee,"f").commitBatch(x(this,Y,"f").uuid,e)}async getExpression(e){return await x(this,ee,"f").getExpression(e)}async createExpression(e,t){return await x(this,ee,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?x(this,wi,"f").push(t):e==="link-removed"?x(this,_i,"f").push(t):e==="link-updated"&&x(this,Ei,"f").push(t)}async addSyncStateChangeListener(e){x(this,jr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=x(this,wi,"f").indexOf(t);x(this,wi,"f").splice(r,1)}else if(e==="link-removed"){let r=x(this,_i,"f").indexOf(t);x(this,_i,"f").splice(r,1)}else if(e==="link-updated"){let r=x(this,Ei,"f").indexOf(t);x(this,Ei,"f").splice(r,1)}}async snapshot(){return x(this,ee,"f").snapshotByUUID(x(this,Y,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new te({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new te({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return ae.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new te({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new te({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new te({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new te({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new te({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new te({source:s,predicate:"ad4m://sdna"}));for(let c of o){let l=ae.fromUrl(c.data.target).get();typeof l=="string"&&t.push(l)}}}return t}async getSdnaForClass(e){let t=ae.from(e);if((await this.get(new te({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new te({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=ae.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return x(this,ee,"f").addSdna(x(this,Y,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=ae.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Ve({source:s.source,predicate:s.predicate,target:s.target})),new Ve({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ve({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=ae.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new te({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;J(n);let a=await this.get(new te({source:n,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(y=>y.data.target)].map(y=>`'${J(y)}'`).join(", ")}]`,u=(await this.querySurrealDB(c)||[]).map(y=>({source:y.source,predicate:y.predicate,target:y.target}));return Zt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new te({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=ae.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=ae.from(e).toUrl(),a=[...r.map(s=>new Ve({source:s.source,predicate:s.predicate,target:s.target})),new Ve({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ve({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=ae.from(e).toUrl(),r=await this.get(new te({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=J(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=J(s),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(c)||[]).map(y=>({source:y.source,predicate:y.predicate,target:y.target}));return mr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new te({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await x(this,ee,"f").createSubject(x(this,Y,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await x(this,ee,"f").createSubject(x(this,Y,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await x(this,ee,"f").getSubjectData(x(this,Y,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await x(this,ee,"f").getSubjectData(x(this,Y,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new te({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let c=s.data.target.slice(o.length),l=c;try{l=decodeURIComponent(c)}catch{}try{return JSON.parse(l)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${J(e)}'`,c=(await this.querySurrealDB(s))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of n.requiredTriples){let s=J(e),o=J(a.predicate),c;if(a.target){let g=J(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${g}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let l=await this.querySurrealDB(c);if(!l||l.length===0)return!1;let u=l[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new nn(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&o.add(c.path),c.adder&&c.adder.length>0?s.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){r.push(c.predicate);let l=o.has(c.predicate);c.target&&c.target!=="value"&&!l?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,relations:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=J(r.predicate);if(r.target){let a=J(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=J(e),o=J(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,l=await this.querySurrealDB(c);if(!l||l.length===0)return;let u=l[0].value;if(a.resolveLanguage&&u)try{let y=await this.getExpression(u);try{return JSON.parse(y.data)}catch{return y.data}}catch{return u}return u}async getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=J(e),o=J(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,l=await this.querySurrealDB(c);if(!l||l.length===0)return[];let u=l.map(y=>y.value).filter(y=>y!==""&&y!=="");if(a.condition&&u.length>0)try{let y=[];for(let g of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${g.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let p=await this.querySurrealDB(`RETURN ${d}`);(p===!0||Array.isArray(p)&&p.length>0&&p[0]===!0)&&y.push(g)}u=y}catch(y){console.warn(`Failed to apply condition filter for ${r}:`,y)}if(a.instanceFilter)try{let y=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return y?await this.batchCheckSubjectInstances(u,y):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${J(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(c=>c.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${J(u)}'`).join(", "),o=J(a.predicate),c;if(a.target){let u=J(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let l=await this.querySurrealDB(c);r.push(new Set(l.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),c=await this.querySurrealDB(o);for(let l of c||[])try{let u;r?(u=new e(this,l.base),await u.get()):(u=new nn(this,l.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let c of o||[])try{let l=new nn(this,c.base,n);await l.init(),r.push(l)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Ci(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(y=>!Array.isArray(e[y]));let o=a?Object.fromEntries(Object.entries(bt(a)).filter(([,y])=>y.kind==="hasMany"||y.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(y=>y!=="isSubjectInstance"):r=Object.keys(e).filter(y=>Array.isArray(e[y])&&y!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let c=`SELECT
464
486
  in.uri AS shape_source,
465
487
  predicate,
466
488
  out.uri AS target
467
489
  FROM link
468
- WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,s=await this.querySurrealDB(a);if(!s||s.length===0)return null;let o=new Map;for(let c of s)if(c.predicate==="rdf://type"&&c.target==="ad4m://SubjectClass"){let l=c.shape_source,u=l.indexOf("://");if(u<0)continue;let m=l.substring(u+3).split("/").pop();if(!m)continue;o.set(m,{shapeUri:l,properties:[],collections:[]})}for(let c of s)if(c.predicate==="sh://property"||c.predicate==="sh://collection"){for(let[l,u]of o)if(c.shape_source.endsWith(`${l}Shape`)){let m=c.target.lastIndexOf(".");if(m<0)continue;let p=c.target.substring(m+1);c.predicate==="sh://property"?u.properties.push(p):u.collections.push(p)}}for(let[c,l]of o){let u=t.every(p=>l.properties.includes(p)),m=r.every(p=>l.collections.includes(p));if(u&&m)return c}return null}async subjectClassesByTemplate(e){try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @ModelOptions decorator.`);let{shape:r}=e.generateSHACL(),n=JSON.stringify(r.toJSON());await this.addSdna(t,"","subject_class",n)}getNeighbourhoodProxy(){return w(this,ee,"f").getNeighbourhoodProxy(w(this,Y,"f").uuid)}get ai(){return w(this,ee,"f").aiClient}async subscribeInfer(e){let t=new Ta(this.uuid,e,w(this,ee,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Ta(this.uuid,e,w(this,ee,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};Y=new WeakMap,ee=new WeakMap,_i=new WeakMap,Ei=new WeakMap,xi=new WeakMap,qr=new WeakMap;var jt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},M=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Q,Vr,zr,Hr,oa,Kr,ca,la,Fe=`
490
+ WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,l=await this.querySurrealDB(c);if(!l||l.length===0)return null;let u=new Map;for(let y of l)if(y.predicate==="rdf://type"&&y.target==="ad4m://SubjectClass"){let g=y.shape_source,d=g.indexOf("://");if(d<0)continue;let p=g.substring(d+3).split("/").pop();if(!p)continue;u.set(p,{shapeUri:g,properties:[],relations:[]})}for(let y of l)if(y.predicate==="sh://property"||y.predicate==="sh://collection"){for(let[g,d]of u)if(y.shape_source.endsWith(`${g}Shape`)){let p=y.target.lastIndexOf(".");if(p<0)continue;let h=y.target.substring(p+1);y.predicate==="sh://property"?d.properties.push(h):d.relations.push(h)}}for(let[y,g]of u){let d=t.every(h=>g.properties.includes(h)),p=r.every(h=>g.relations.includes(h));if(d&&p)return y}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:r}=e.generateSHACL(),n=JSON.stringify(r.toJSON());await this.addSdna(t,"","subject_class",n)}getNeighbourhoodProxy(){return x(this,ee,"f").getNeighbourhoodProxy(x(this,Y,"f").uuid)}get ai(){return x(this,ee,"f").aiClient}async subscribeInfer(e){let t=new ka(this.uuid,e,x(this,ee,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new ka(this.uuid,e,x(this,ee,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};Y=new WeakMap,ee=new WeakMap,wi=new WeakMap,_i=new WeakMap,Ei=new WeakMap,jr=new WeakMap;var Bt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},M=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Q,Br,qr,Vr,oa,Hr,ca,la,Pe=`
469
491
  author
470
492
  timestamp
471
493
  status
472
494
  data { source, predicate, target }
473
495
  proof { valid, invalid, signature, key }
474
- `,nr=`
496
+ `,rr=`
475
497
  uuid
476
498
  name
477
499
  sharedUrl
@@ -492,139 +514,139 @@ neighbourhood {
492
514
  }
493
515
  author
494
516
  }
495
- `,Ca=class{constructor(e,t=!0){Q.set(this,void 0),Vr.set(this,void 0),zr.set(this,void 0),Hr.set(this,void 0),oa.set(this,void 0),Kr.set(this,void 0),ca.set(this,void 0),la.set(this,void 0),jt(this,Q,e,"f"),jt(this,Vr,[],"f"),jt(this,zr,[],"f"),jt(this,Hr,[],"f"),jt(this,oa,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){jt(this,Kr,e,"f")}setNeighbourhoodClient(e){jt(this,ca,e,"f")}setAIClient(e){jt(this,la,e,"f")}get aiClient(){return M(this,la,"f")}async all(){let{perspectives:e}=S(await M(this,Q,"f").query({query:v`query perspectives {
517
+ `,Ia=class{constructor(e,t=!0){Q.set(this,void 0),Br.set(this,void 0),qr.set(this,void 0),Vr.set(this,void 0),oa.set(this,void 0),Hr.set(this,void 0),ca.set(this,void 0),la.set(this,void 0),Bt(this,Q,e,"f"),Bt(this,Br,[],"f"),Bt(this,qr,[],"f"),Bt(this,Vr,[],"f"),Bt(this,oa,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Bt(this,Hr,e,"f")}setNeighbourhoodClient(e){Bt(this,ca,e,"f")}setAIClient(e){Bt(this,la,e,"f")}get aiClient(){return M(this,la,"f")}async all(){let{perspectives:e}=b(await M(this,Q,"f").query({query:v`query perspectives {
496
518
  perspectives {
497
- ${nr}
519
+ ${rr}
498
520
  }
499
- }`}));return e.map(t=>new pr(t,this))}async byUUID(e){let{perspective:t}=S(await M(this,Q,"f").query({query:v`query perspective($uuid: String!) {
521
+ }`}));return e.map(t=>new dr(t,this))}async byUUID(e){let{perspective:t}=b(await M(this,Q,"f").query({query:v`query perspective($uuid: String!) {
500
522
  perspective(uuid: $uuid) {
501
- ${nr}
523
+ ${rr}
502
524
  }
503
- }`,variables:{uuid:e}}));return t?new pr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=S(await M(this,Q,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
525
+ }`,variables:{uuid:e}}));return t?new dr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=b(await M(this,Q,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
504
526
  perspectiveSnapshot(uuid: $uuid) {
505
- links { ${Fe} }
527
+ links { ${Pe} }
506
528
  }
507
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
529
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
508
530
  perspectivePublishSnapshot(uuid: $uuid)
509
- }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=S(await M(this,Q,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
531
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=b(await M(this,Q,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
510
532
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
511
- ${Fe}
533
+ ${Pe}
512
534
  }
513
- }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=S(await M(this,Q,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
535
+ }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=b(await M(this,Q,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
514
536
  perspectiveQueryProlog(uuid: $uuid, query: $query)
515
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=S(await M(this,Q,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
537
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=b(await M(this,Q,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
516
538
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
517
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
539
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
518
540
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
519
541
  subscriptionId
520
542
  result
521
543
  }
522
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
544
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
523
545
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
524
546
  subscriptionId
525
547
  result
526
548
  }
527
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
549
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
528
550
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
529
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
551
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
530
552
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
531
553
  }`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=M(this,Q,"f").subscribe({query:v`
532
554
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
533
555
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
534
556
  }
535
- `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
557
+ `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
536
558
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
537
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
559
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
538
560
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
539
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
561
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
540
562
  perspectiveAdd(name: $name) {
541
- ${nr}
563
+ ${rr}
542
564
  }
543
- }`,variables:{name:e}}));return new pr(t,this)}async update(e,t){let{perspectiveUpdate:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
565
+ }`,variables:{name:e}}));return new dr(t,this)}async update(e,t){let{perspectiveUpdate:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
544
566
  perspectiveUpdate(uuid: $uuid, name: $name) {
545
- ${nr}
567
+ ${rr}
546
568
  }
547
- }`,variables:{uuid:e,name:t}}));return new pr(r,this)}async remove(e){return S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
569
+ }`,variables:{uuid:e,name:t}}));return new dr(r,this)}async remove(e){return b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
548
570
  perspectiveRemove(uuid: $uuid)
549
- }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
571
+ }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
550
572
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
551
- ${Fe}
573
+ ${Pe}
552
574
  }
553
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
575
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
554
576
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
555
- ${Fe}
577
+ ${Pe}
556
578
  }
557
- }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
579
+ }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
558
580
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
559
- ${Fe}
581
+ ${Pe}
560
582
  }
561
- }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
583
+ }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
562
584
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
563
585
  additions {
564
- ${Fe}
586
+ ${Pe}
565
587
  }
566
588
  removals {
567
- ${Fe}
589
+ ${Pe}
568
590
  }
569
591
  }
570
- }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
592
+ }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
571
593
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
572
- ${Fe}
594
+ ${Pe}
573
595
  }
574
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
596
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
575
597
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
576
- ${Fe}
598
+ ${Pe}
577
599
  }
578
- }`,variables:{uuid:e,oldLink:t,newLink:r,batchId:n}}));return a}async removeLink(e,t,r){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
600
+ }`,variables:{uuid:e,oldLink:t,newLink:r,batchId:n}}));return a}async removeLink(e,t,r){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
579
601
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
580
- }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
602
+ }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
581
603
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
582
- }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
604
+ }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
583
605
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
584
- }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
606
+ }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
585
607
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
586
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
608
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
587
609
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
588
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,Kr,"f").get(e)}async createExpression(e,t){return await M(this,Kr,"f").create(e,t)}addPerspectiveAddedListener(e){M(this,Vr,"f").push(e)}subscribePerspectiveAdded(){M(this,Q,"f").subscribe({query:v` subscription {
589
- perspectiveAdded { ${nr} }
610
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,Hr,"f").get(e)}async createExpression(e,t){return await M(this,Hr,"f").create(e,t)}addPerspectiveAddedListener(e){M(this,Br,"f").push(e)}subscribePerspectiveAdded(){M(this,Q,"f").subscribe({query:v` subscription {
611
+ perspectiveAdded { ${rr} }
590
612
  }
591
- `}).subscribe({next:e=>{M(this,Vr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){M(this,zr,"f").push(e)}subscribePerspectiveUpdated(){M(this,Q,"f").subscribe({query:v` subscription {
592
- perspectiveUpdated { ${nr} }
613
+ `}).subscribe({next:e=>{M(this,Br,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){M(this,qr,"f").push(e)}subscribePerspectiveUpdated(){M(this,Q,"f").subscribe({query:v` subscription {
614
+ perspectiveUpdated { ${rr} }
593
615
  }
594
- `}).subscribe({next:e=>{M(this,zr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){M(this,oa,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
616
+ `}).subscribe({next:e=>{M(this,qr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){M(this,oa,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
595
617
  perspectiveSyncStateChange(uuid: "${e}")
596
618
  }
597
- `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){M(this,Hr,"f").push(e)}subscribePerspectiveRemoved(){M(this,Q,"f").subscribe({query:v` subscription {
619
+ `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){M(this,Vr,"f").push(e)}subscribePerspectiveRemoved(){M(this,Q,"f").subscribe({query:v` subscription {
598
620
  perspectiveRemoved
599
621
  }
600
- `}).subscribe({next:e=>{M(this,Hr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
601
- perspectiveLinkAdded(uuid: "${e}") { ${Fe} }
622
+ `}).subscribe({next:e=>{M(this,Vr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
623
+ perspectiveLinkAdded(uuid: "${e}") { ${Pe} }
602
624
  }
603
625
  `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveLinkAdded)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkRemovedListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
604
- perspectiveLinkRemoved(uuid: "${e}") { ${Fe} }
626
+ perspectiveLinkRemoved(uuid: "${e}") { ${Pe} }
605
627
  }
606
628
  `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkRemoved.status||delete r.data.perspectiveLinkRemoved.status,n(r.data.perspectiveLinkRemoved)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkUpdatedListener(e,t){M(this,Q,"f").subscribe({query:v` subscription {
607
629
  perspectiveLinkUpdated(uuid: "${e}") {
608
630
  oldLink {
609
- ${Fe}
631
+ ${Pe}
610
632
  }
611
633
  newLink {
612
- ${Fe}
634
+ ${Pe}
613
635
  }
614
636
  }
615
637
  }
616
- `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new Fs(M(this,ca,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
638
+ `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new Fs(M(this,ca,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
617
639
  perspectiveCreateBatch(uuid: $uuid)
618
- }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=S(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
640
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=b(await M(this,Q,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
619
641
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
620
642
  additions {
621
- ${Fe}
643
+ ${Pe}
622
644
  }
623
645
  removals {
624
- ${Fe}
646
+ ${Pe}
625
647
  }
626
648
  }
627
- }`,variables:{uuid:e,batchId:t}}));return r}};Q=new WeakMap,Vr=new WeakMap,zr=new WeakMap,Hr=new WeakMap,oa=new WeakMap,Kr=new WeakMap,ca=new WeakMap,la=new WeakMap;var qn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},G=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},X,Wr,Qr,Gr,Ur=`
649
+ }`,variables:{uuid:e,batchId:t}}));return r}};Q=new WeakMap,Br=new WeakMap,qr=new WeakMap,Vr=new WeakMap,oa=new WeakMap,Hr=new WeakMap,ca=new WeakMap,la=new WeakMap;var qn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},G=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},X,zr,Kr,Wr,Or=`
628
650
  did
629
651
  directMessageLanguage
630
652
  perspective {
@@ -654,145 +676,145 @@ neighbourhood {
654
676
  can
655
677
  }
656
678
  }
657
- `,ar=`
679
+ `,nr=`
658
680
  isInitialized
659
681
  isUnlocked
660
682
  did
661
683
  didDocument
662
684
  error
663
- `,zn=`
685
+ `,Hn=`
664
686
  did
665
687
  didSigningKeyId
666
688
  deviceKeyType
667
689
  deviceKey
668
690
  deviceKeySignedByDid
669
691
  didSignedByDeviceKey
670
- `,$d=`
692
+ `,Cd=`
671
693
  signature
672
694
  publicKey
673
- `,pn=class{constructor(e,t=!0){X.set(this,void 0),Wr.set(this,void 0),Qr.set(this,void 0),Gr.set(this,void 0),qn(this,X,e,"f"),qn(this,Qr,[],"f"),qn(this,Gr,[],"f"),qn(this,Wr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=S(await G(this,X,"f").query({query:v`query agent { agent { ${Ur} } }`})),t=new Gt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=S(await G(this,X,"f").query({query:v`query agentStatus {
695
+ `,dn=class{constructor(e,t=!0){X.set(this,void 0),zr.set(this,void 0),Kr.set(this,void 0),Wr.set(this,void 0),qn(this,X,e,"f"),qn(this,Kr,[],"f"),qn(this,Wr,[],"f"),qn(this,zr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=b(await G(this,X,"f").query({query:v`query agent { agent { ${Or} } }`})),t=new Gt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=b(await G(this,X,"f").query({query:v`query agentStatus {
674
696
  agentStatus {
675
- ${ar}
697
+ ${nr}
676
698
  }
677
- }`}));return new ct(e)}async generate(e){let{agentGenerate:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentGenerate(
699
+ }`}));return new nt(e)}async generate(e){let{agentGenerate:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentGenerate(
678
700
  $passphrase: String!
679
701
  ) {
680
702
  agentGenerate(passphrase: $passphrase) {
681
- ${ar}
703
+ ${nr}
682
704
  }
683
- }`,variables:{passphrase:e}}));return new ct(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=S(await G(this,X,"f").mutate({mutation:v`mutation agentImport(
705
+ }`,variables:{passphrase:e}}));return new nt(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=b(await G(this,X,"f").mutate({mutation:v`mutation agentImport(
684
706
  $did: String!,
685
707
  $didDocument: String!,
686
708
  $keystore: String!,
687
709
  $passphrase: String!
688
710
  ) {
689
711
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
690
- ${ar}
712
+ ${nr}
691
713
  }
692
- }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new ct(s)}async lock(e){let{agentLock:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
714
+ }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new nt(s)}async lock(e){let{agentLock:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
693
715
  agentLock(passphrase: $passphrase) {
694
- ${ar}
716
+ ${nr}
695
717
  }
696
- }`,variables:{passphrase:e}}));return new ct(t)}async unlock(e,t=!0){let{agentUnlock:r}=S(await G(this,X,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
718
+ }`,variables:{passphrase:e}}));return new nt(t)}async unlock(e,t=!0){let{agentUnlock:r}=b(await G(this,X,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
697
719
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
698
- ${ar}
720
+ ${nr}
699
721
  }
700
- }`,variables:{passphrase:e,holochain:t}}));return new ct(r)}async byDID(e){let{agentByDID:t}=S(await G(this,X,"f").query({query:v`query agentByDID($did: String!) {
722
+ }`,variables:{passphrase:e,holochain:t}}));return new nt(r)}async byDID(e){let{agentByDID:t}=b(await G(this,X,"f").query({query:v`query agentByDID($did: String!) {
701
723
  agentByDID(did: $did) {
702
- ${Ur}
724
+ ${Or}
703
725
  }
704
- }`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(s=>{delete s.__typename,delete s.data.__typename,delete s.proof.__typename,delete s.status});let{agentUpdatePublicPerspective:r}=S(await G(this,X,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
726
+ }`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(s=>{delete s.__typename,delete s.data.__typename,delete s.proof.__typename,delete s.status});let{agentUpdatePublicPerspective:r}=b(await G(this,X,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
705
727
  agentUpdatePublicPerspective(perspective: $perspective) {
706
- ${Ur}
728
+ ${Or}
707
729
  }
708
- }`,variables:{perspective:t}})),n=r,a=new Gt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ca(G(this,X,"f")),r=new pn(G(this,X,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.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 s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
730
+ }`,variables:{perspective:t}})),n=r,a=new Gt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ia(G(this,X,"f")),r=new dn(G(this,X,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.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 s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
709
731
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
710
- ${Ur}
732
+ ${Or}
711
733
  }
712
- }`,variables:{directMessageLanguage:e}})),r=t,n=new Gt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
734
+ }`,variables:{directMessageLanguage:e}})),r=t,n=new Gt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
713
735
  agentAddEntanglementProofs(proofs: $proofs) {
714
- ${zn}
736
+ ${Hn}
715
737
  }
716
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
738
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
717
739
  agentDeleteEntanglementProofs(proofs: $proofs) {
718
- ${zn}
740
+ ${Hn}
719
741
  }
720
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=S(await G(this,X,"f").query({query:v`query agentGetEntanglementProofs {
742
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=b(await G(this,X,"f").query({query:v`query agentGetEntanglementProofs {
721
743
  agentGetEntanglementProofs {
722
- ${zn}
744
+ ${Hn}
723
745
  }
724
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=S(await G(this,X,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
746
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=b(await G(this,X,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
725
747
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
726
- ${zn}
748
+ ${Hn}
727
749
  }
728
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){G(this,Qr,"f").push(e)}addAppChangedListener(e){G(this,Wr,"f").push(e)}subscribeAgentUpdated(){G(this,X,"f").subscribe({query:v` subscription {
729
- agentUpdated { ${Ur} }
750
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){G(this,Kr,"f").push(e)}addAppChangedListener(e){G(this,zr,"f").push(e)}subscribeAgentUpdated(){G(this,X,"f").subscribe({query:v` subscription {
751
+ agentUpdated { ${Or} }
730
752
  }
731
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;G(this,Qr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){G(this,X,"f").subscribe({query:v` subscription {
753
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;G(this,Kr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){G(this,X,"f").subscribe({query:v` subscription {
732
754
  agentAppsChanged {
733
755
  ${Vn}
734
756
  }
735
757
  }
736
- `}).subscribe({next:e=>{G(this,Wr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){G(this,Gr,"f").push(e)}subscribeAgentStatusChanged(){G(this,X,"f").subscribe({query:v` subscription {
737
- agentStatusChanged { ${ar} }
758
+ `}).subscribe({next:e=>{G(this,zr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){G(this,Wr,"f").push(e)}subscribeAgentStatusChanged(){G(this,X,"f").subscribe({query:v` subscription {
759
+ agentStatusChanged { ${nr} }
738
760
  }
739
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;G(this,Gr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=S(await G(this,X,"f").mutate({mutation:v`
761
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;G(this,Wr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=b(await G(this,X,"f").mutate({mutation:v`
740
762
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
741
763
  agentRequestCapability(authInfo: $authInfo)
742
764
  }
743
- `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=S(await G(this,X,"f").mutate({mutation:v`
765
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=b(await G(this,X,"f").mutate({mutation:v`
744
766
  mutation agentPermitCapability($auth: String!) {
745
767
  agentPermitCapability(auth: $auth)
746
768
  }
747
- `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=S(await G(this,X,"f").mutate({mutation:v`
769
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=b(await G(this,X,"f").mutate({mutation:v`
748
770
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
749
771
  agentGenerateJwt(requestId: $requestId, rand: $rand)
750
772
  }
751
- `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=S(await G(this,X,"f").mutate({mutation:v`query agentGetApps {
773
+ `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=b(await G(this,X,"f").mutate({mutation:v`query agentGetApps {
752
774
  agentGetApps {
753
775
  ${Vn}
754
776
  }
755
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
777
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
756
778
  agentRemoveApp(requestId: $requestId) {
757
779
  ${Vn}
758
780
  }
759
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
781
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
760
782
  agentRevokeToken(requestId: $requestId) {
761
783
  ${Vn}
762
784
  }
763
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=S(await G(this,X,"f").mutate({mutation:v`
785
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=b(await G(this,X,"f").mutate({mutation:v`
764
786
  query agentIsLocked {
765
787
  agentIsLocked
766
788
  }
767
- `}));return e}async signMessage(e){let{agentSignMessage:t}=S(await G(this,X,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
789
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=b(await G(this,X,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
768
790
  agentSignMessage(message: $message) {
769
- ${$d}
791
+ ${Cd}
770
792
  }
771
- }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=S(await G(this,X,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
793
+ }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=b(await G(this,X,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
772
794
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
773
795
  did
774
796
  success
775
797
  error
776
798
  }
777
- }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=S(await G(this,X,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
799
+ }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=b(await G(this,X,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
778
800
  runtimeLoginUser(email: $email, password: $password)
779
- }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=S(await G(this,X,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
801
+ }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=b(await G(this,X,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
780
802
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
781
803
  success
782
804
  message
783
805
  requiresPassword
784
806
  isExistingUser
785
807
  }
786
- }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=S(await G(this,X,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
808
+ }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=b(await G(this,X,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
787
809
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
788
- }`,variables:{email:e,code:t,verificationType:r}}));return n}};X=new WeakMap,Wr=new WeakMap,Qr=new WeakMap,Gr=new WeakMap;var Ad=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},qt=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ft,ic=`
810
+ }`,variables:{email:e,code:t,verificationType:r}}));return n}};X=new WeakMap,zr=new WeakMap,Kr=new WeakMap,Wr=new WeakMap;var Ld=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},qt=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},lt,nc=`
789
811
  name
790
812
  address
791
813
  settings
792
814
  icon { code }
793
815
  constructorIcon { code }
794
816
  settingsIcon { code }
795
- `,rc=`
817
+ `,ac=`
796
818
  name
797
819
  address
798
820
  description
@@ -802,45 +824,45 @@ neighbourhood {
802
824
  templateAppliedParams
803
825
  possibleTemplateParams
804
826
  sourceCodeLink
805
- `,js=class{constructor(e){ft.set(this,void 0),Ad(this,ft,e,"f")}async byAddress(e){let{language:t}=S(await qt(this,ft,"f").query({query:v`query byAddress($address: String!) {
827
+ `,Bs=class{constructor(e){lt.set(this,void 0),Ld(this,lt,e,"f")}async byAddress(e){let{language:t}=b(await qt(this,lt,"f").query({query:v`query byAddress($address: String!) {
806
828
  language(address: $address) {
807
- ${ic}
829
+ ${nc}
808
830
  }
809
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=S(await qt(this,ft,"f").query({query:v`query byFilter($filter: String!) {
831
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=b(await qt(this,lt,"f").query({query:v`query byFilter($filter: String!) {
810
832
  languages(filter: $filter) {
811
- ${ic}
833
+ ${nc}
812
834
  }
813
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=S(await qt(this,ft,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
835
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=b(await qt(this,lt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
814
836
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
815
- }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=S(await qt(this,ft,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
837
+ }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=b(await qt(this,lt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
816
838
  $sourceLanguageHash: String!,
817
839
  $templateData: String!,
818
840
  ) {
819
841
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
820
842
  name, address
821
843
  }
822
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=S(await qt(this,ft,"f").mutate({mutation:v`mutation languagePublish(
844
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=b(await qt(this,lt,"f").mutate({mutation:v`mutation languagePublish(
823
845
  $languagePath: String!,
824
846
  $languageMeta: LanguageMetaInput!,
825
847
  ) {
826
848
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
827
- ${rc}
849
+ ${ac}
828
850
  }
829
- }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=S(await qt(this,ft,"f").query({query:v`query languageMeta(
851
+ }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=b(await qt(this,lt,"f").query({query:v`query languageMeta(
830
852
  $address: String!,
831
853
  ) {
832
854
  languageMeta(address: $address) {
833
- ${rc}
855
+ ${ac}
834
856
  }
835
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=S(await qt(this,ft,"f").query({query:v`query languageSource(
857
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=b(await qt(this,lt,"f").query({query:v`query languageSource(
836
858
  $address: String!,
837
859
  ) {
838
860
  languageSource(address: $address)
839
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=S(await qt(this,ft,"f").mutate({mutation:v`mutation languageRemove(
861
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=b(await qt(this,lt,"f").mutate({mutation:v`mutation languageRemove(
840
862
  $address: String!,
841
863
  ) {
842
864
  languageRemove(address: $address)
843
- }`,variables:{address:e}}));return t}};ft=new WeakMap;var Id=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Re=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},qe,dr,qs=class{constructor(e){qe.set(this,void 0),dr.set(this,new Map),Id(this,qe,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
865
+ }`,variables:{address:e}}));return t}};lt=new WeakMap;var Nd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ce=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Me,ur,qs=class{constructor(e){Me.set(this,void 0),ur.set(this,new Map),Nd(this,Me,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
844
866
  $linkLanguage: String!,
845
867
  $meta: PerspectiveInput!,
846
868
  $perspectiveUUID: String!
@@ -850,39 +872,39 @@ neighbourhood {
850
872
  meta: $meta,
851
873
  perspectiveUUID: $perspectiveUUID
852
874
  )
853
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
875
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
854
876
  neighbourhoodJoinFromUrl(url: $url) {
855
877
  uuid
856
878
  name
857
879
  sharedUrl
858
880
  state
859
- neighbourhood {
881
+ neighbourhood {
860
882
  data {
861
- linkLanguage
862
- meta {
883
+ linkLanguage
884
+ meta {
863
885
  links
864
886
  {
865
887
  author
866
888
  timestamp
867
889
  data { source, predicate, target }
868
890
  proof { valid, invalid, signature, key }
869
- }
870
- }
891
+ }
892
+ }
871
893
  }
872
894
  author
873
895
  }
874
896
  }
875
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=S(await Re(this,qe,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
897
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=b(await Ce(this,Me,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
876
898
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
877
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=S(await Re(this,qe,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
899
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=b(await Ce(this,Me,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
878
900
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
879
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=S(await Re(this,qe,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
901
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=b(await Ce(this,Me,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
880
902
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
881
903
  did
882
904
  status {
883
905
  author
884
906
  timestamp
885
- data {
907
+ data {
886
908
  links {
887
909
  author
888
910
  timestamp
@@ -893,7 +915,7 @@ neighbourhood {
893
915
  proof { valid, invalid, signature, key }
894
916
  }
895
917
  }
896
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
918
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
897
919
  $perspectiveUUID: String!,
898
920
  $status: PerspectiveInput!
899
921
  ) {
@@ -901,7 +923,7 @@ neighbourhood {
901
923
  perspectiveUUID: $perspectiveUUID,
902
924
  status: $status
903
925
  )
904
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
926
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
905
927
  $perspectiveUUID: String!,
906
928
  $status: PerspectiveUnsignedInput!
907
929
  ) {
@@ -909,7 +931,7 @@ neighbourhood {
909
931
  perspectiveUUID: $perspectiveUUID,
910
932
  status: $status
911
933
  )
912
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
934
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
913
935
  $perspectiveUUID: String!,
914
936
  $remoteAgentDid: String!,
915
937
  $payload: PerspectiveInput!
@@ -919,7 +941,7 @@ neighbourhood {
919
941
  remoteAgentDid: $remoteAgentDid,
920
942
  payload: $payload
921
943
  )
922
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
944
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
923
945
  $perspectiveUUID: String!,
924
946
  $remoteAgentDid: String!,
925
947
  $payload: PerspectiveUnsignedInput!
@@ -929,7 +951,7 @@ neighbourhood {
929
951
  remoteAgentDid: $remoteAgentDid,
930
952
  payload: $payload
931
953
  )
932
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
954
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
933
955
  $perspectiveUUID: String!,
934
956
  $payload: PerspectiveInput!,
935
957
  $loopback: Boolean
@@ -939,7 +961,7 @@ neighbourhood {
939
961
  payload: $payload,
940
962
  loopback: $loopback
941
963
  )
942
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=S(await Re(this,qe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
964
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=b(await Ce(this,Me,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
943
965
  $perspectiveUUID: String!,
944
966
  $payload: PerspectiveUnsignedInput!,
945
967
  $loopback: Boolean
@@ -949,7 +971,7 @@ neighbourhood {
949
971
  payload: $payload,
950
972
  loopback: $loopback
951
973
  )
952
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Re(this,dr,"f").get(e);r&&r.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await Re(this,qe,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
974
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Ce(this,ur,"f").get(e);if(r)for(let n of r)try{n(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;Ce(this,Me,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
953
975
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
954
976
  author
955
977
  timestamp
@@ -960,11 +982,11 @@ neighbourhood {
960
982
  timestamp
961
983
  data { source, predicate, target }
962
984
  proof { valid, invalid, signature, key }
963
- }
985
+ }
964
986
  }
965
987
  proof { valid, invalid, signature, key }
966
988
  }
967
- }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{let{neighbourhoodSignal:n}=S(r);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let r=Re(this,dr,"f").get(e);r||(r=[],Re(this,dr,"f").set(e,r),await this.subscribeToSignals(e)),r.push(t)}removeSignalHandler(e,t){let r=Re(this,dr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};qe=new WeakMap,dr=new WeakMap;var Hn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},F=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},V,Zr,Jr,Yr,El,Kn=`
989
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=b(r);t.dispatchSignal(e,n)}catch(n){console.error("Error in signal subscription:",n)}},error:r=>{console.error("Signal subscription error for perspective",e,r)}})}async addSignalHandler(e,t){let r=Ce(this,ur,"f").get(e);r?r.push(t):(r=[],Ce(this,ur,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Ce(this,ur,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Me=new WeakMap,ur=new WeakMap;var zn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},U=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},V,Qr,Gr,Zr,Al,Kn=`
968
990
  author
969
991
  timestamp
970
992
  data {
@@ -976,7 +998,7 @@ data {
976
998
  }
977
999
  }
978
1000
  proof { valid, invalid, signature, key }
979
- `,kd=`
1001
+ `,Rd=`
980
1002
  description
981
1003
  appName
982
1004
  appUrl
@@ -985,72 +1007,72 @@ trigger
985
1007
  perspectiveIds
986
1008
  webhookUrl
987
1009
  webhookAuth
988
- `,xl=`
1010
+ `,kl=`
989
1011
  id
990
1012
  granted
991
- ${kd}
992
- `,Td=`
993
- notification { ${xl} }
1013
+ ${Rd}
1014
+ `,Pd=`
1015
+ notification { ${kl} }
994
1016
  perspectiveId
995
1017
  triggerMatch
996
- `,Vs=class{constructor(e,t=!0){V.set(this,void 0),Zr.set(this,void 0),Jr.set(this,void 0),Yr.set(this,void 0),El.set(this,void 0),Hn(this,V,e,"f"),Hn(this,Zr,[],"f"),Hn(this,Jr,[],"f"),Hn(this,Yr,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=S(await F(this,V,"f").query({query:v`query runtimeInfo {
1018
+ `,Vs=class{constructor(e,t=!0){V.set(this,void 0),Qr.set(this,void 0),Gr.set(this,void 0),Zr.set(this,void 0),Al.set(this,void 0),zn(this,V,e,"f"),zn(this,Qr,[],"f"),zn(this,Gr,[],"f"),zn(this,Zr,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=b(await U(this,V,"f").query({query:v`query runtimeInfo {
997
1019
  runtimeInfo {
998
1020
  ad4mExecutorVersion,
999
1021
  isInitialized,
1000
1022
  isUnlocked
1001
1023
  }
1002
- }`}));return e}async quit(){return S(await F(this,V,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1024
+ }`}));return e}async quit(){return b(await U(this,V,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1003
1025
  runtimeOpenLink(url: $url)
1004
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=S(await F(this,V,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1026
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=b(await U(this,V,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1005
1027
  addTrustedAgents(agents: $agents)
1006
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=S(await F(this,V,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1028
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=b(await U(this,V,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1007
1029
  deleteTrustedAgents(agents: $agents)
1008
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=S(await F(this,V,"f").query({query:v`query getTrustedAgents {
1030
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=b(await U(this,V,"f").query({query:v`query getTrustedAgents {
1009
1031
  getTrustedAgents
1010
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1032
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1011
1033
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
1012
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1034
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1013
1035
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
1014
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=S(await F(this,V,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1036
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=b(await U(this,V,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1015
1037
  runtimeKnownLinkLanguageTemplates
1016
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1038
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1017
1039
  runtimeAddFriends(dids: $dids)
1018
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1040
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1019
1041
  runtimeRemoveFriends(dids: $dids)
1020
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=S(await F(this,V,"f").query({query:v`query runtimeFriends {
1042
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=b(await U(this,V,"f").query({query:v`query runtimeFriends {
1021
1043
  runtimeFriends
1022
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=S(await F(this,V,"f").query({query:v`query runtimeHcAgentInfos {
1044
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=b(await U(this,V,"f").query({query:v`query runtimeHcAgentInfos {
1023
1045
  runtimeHcAgentInfos
1024
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=S(await F(this,V,"f").query({query:v`query runtimeGetNetworkMetrics {
1046
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=b(await U(this,V,"f").query({query:v`query runtimeGetNetworkMetrics {
1025
1047
  runtimeGetNetworkMetrics
1026
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1048
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1027
1049
  runtimeRestartHolochain
1028
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1050
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1029
1051
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
1030
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=S(await F(this,V,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1052
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=b(await U(this,V,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1031
1053
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
1032
- }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1054
+ }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1033
1055
  runtimeSetStatus(status: $status)
1034
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=S(await F(this,V,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1056
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=b(await U(this,V,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1035
1057
  runtimeFriendStatus(did: $did) { ${Kn} }
1036
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1058
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1037
1059
  runtimeFriendSendMessage(did: $did, message: $message)
1038
- }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=S(await F(this,V,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1060
+ }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=b(await U(this,V,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1039
1061
  runtimeMessageInbox(filter: $filter) { ${Kn} }
1040
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=S(await F(this,V,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1062
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=b(await U(this,V,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1041
1063
  runtimeMessageOutbox(filter: $filter) {
1042
1064
  recipient,
1043
1065
  message {
1044
1066
  ${Kn}
1045
1067
  }
1046
1068
  }
1047
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1069
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1048
1070
  runtimeRequestInstallNotification(notification: $notification)
1049
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1071
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1050
1072
  runtimeGrantNotification(id: $id)
1051
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1073
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1052
1074
  runtimeExportDb(filePath: $filePath)
1053
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1075
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1054
1076
  runtimeImportDb(filePath: $filePath) {
1055
1077
  perspectives { total imported failed omitted errors }
1056
1078
  links { total imported failed omitted errors }
@@ -1064,51 +1086,51 @@ triggerMatch
1064
1086
  trustedAgents { total imported failed omitted errors }
1065
1087
  knownLinkLanguages { total imported failed omitted errors }
1066
1088
  }
1067
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=S(await F(this,V,"f").query({query:v`query runtimeNotifications {
1068
- runtimeNotifications { ${xl} }
1069
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1089
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=b(await U(this,V,"f").query({query:v`query runtimeNotifications {
1090
+ runtimeNotifications { ${kl} }
1091
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1070
1092
  runtimeUpdateNotification(id: $id, notification: $notification)
1071
- }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1093
+ }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1072
1094
  runtimeRemoveNotification(id: $id)
1073
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1095
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1074
1096
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
1075
- }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1097
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1076
1098
  runtimeImportPerspective(filePath: $filePath)
1077
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=S(await F(this,V,"f").query({query:v`query runtimeMultiUserEnabled {
1099
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=b(await U(this,V,"f").query({query:v`query runtimeMultiUserEnabled {
1078
1100
  runtimeMultiUserEnabled
1079
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1101
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1080
1102
  runtimeSetMultiUserEnabled(enabled: $enabled)
1081
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=S(await F(this,V,"f").query({query:v`query runtimeListUsers {
1103
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=b(await U(this,V,"f").query({query:v`query runtimeListUsers {
1082
1104
  runtimeListUsers {
1083
1105
  email
1084
1106
  did
1085
1107
  lastSeen
1086
1108
  perspectiveCount
1087
1109
  }
1088
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1110
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1089
1111
  runtimeEmailTestModeEnable
1090
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1112
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1091
1113
  runtimeEmailTestModeDisable
1092
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1114
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1093
1115
  runtimeEmailTestGetCode(email: $email)
1094
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1116
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1095
1117
  runtimeEmailTestClearCodes
1096
- }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=S(await F(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1118
+ }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=b(await U(this,V,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1097
1119
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
1098
- }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){F(this,Yr,"f").push(e)}subscribeNotificationTriggered(){F(this,V,"f").subscribe({query:v` subscription {
1099
- runtimeNotificationTriggered { ${Td} }
1120
+ }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){U(this,Zr,"f").push(e)}subscribeNotificationTriggered(){U(this,V,"f").subscribe({query:v` subscription {
1121
+ runtimeNotificationTriggered { ${Pd} }
1100
1122
  }
1101
- `}).subscribe({next:e=>{F(this,Yr,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){F(this,Zr,"f").push(e)}subscribeMessageReceived(){F(this,V,"f").subscribe({query:v` subscription {
1123
+ `}).subscribe({next:e=>{U(this,Zr,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){U(this,Qr,"f").push(e)}subscribeMessageReceived(){U(this,V,"f").subscribe({query:v` subscription {
1102
1124
  runtimeMessageReceived { ${Kn} }
1103
1125
  }
1104
- `}).subscribe({next:e=>{F(this,Zr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){F(this,Jr,"f").push(e)}subscribeExceptionOccurred(){F(this,V,"f").subscribe({query:v` subscription {
1126
+ `}).subscribe({next:e=>{U(this,Qr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){U(this,Gr,"f").push(e)}subscribeExceptionOccurred(){U(this,V,"f").subscribe({query:v` subscription {
1105
1127
  exceptionOccurred {
1106
1128
  title
1107
1129
  message
1108
1130
  type
1109
1131
  addon
1110
1132
  }
1111
- }`}).subscribe({next:e=>{F(this,Jr,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};V=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap,El=new WeakMap;var Cd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},sr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Rt,zs=class{constructor(e){Rt.set(this,void 0),Cd(this,Rt,e,"f")}async get(e,t=!1){if(!t)try{let n=ae.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:r}=S(await sr(this,Rt,"f").query({query:v`query expression($url: String!) {
1133
+ }`}).subscribe({next:e=>{U(this,Gr,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};V=new WeakMap,Qr=new WeakMap,Gr=new WeakMap,Zr=new WeakMap,Al=new WeakMap;var Od=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ar=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Pt,Hs=class{constructor(e){Pt.set(this,void 0),Od(this,Pt,e,"f")}async get(e,t=!1){if(!t)try{let n=ae.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:r}=b(await ar(this,Pt,"f").query({query:v`query expression($url: String!) {
1112
1134
  expression(url: $url) {
1113
1135
  author
1114
1136
  timestamp
@@ -1121,7 +1143,7 @@ triggerMatch
1121
1143
  invalid
1122
1144
  }
1123
1145
  }
1124
- }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=S(await sr(this,Rt,"f").query({query:v`query expressionMany($urls: [String!]!) {
1146
+ }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=b(await ar(this,Pt,"f").query({query:v`query expressionMany($urls: [String!]!) {
1125
1147
  expressionMany(urls: $urls) {
1126
1148
  author
1127
1149
  timestamp
@@ -1134,19 +1156,19 @@ triggerMatch
1134
1156
  invalid
1135
1157
  }
1136
1158
  }
1137
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=S(await sr(this,Rt,"f").query({query:v`query expressionRaw($url: String!) {
1159
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=b(await ar(this,Pt,"f").query({query:v`query expressionRaw($url: String!) {
1138
1160
  expressionRaw(url: $url)
1139
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=S(await sr(this,Rt,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1161
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=b(await ar(this,Pt,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1140
1162
  expressionCreate(content: $content, languageAddress: $languageAddress)
1141
- }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=S(await sr(this,Rt,"f").query({query:v`query expressionInteractions($url: String!) {
1163
+ }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=b(await ar(this,Pt,"f").query({query:v`query expressionInteractions($url: String!) {
1142
1164
  expressionInteractions(url: $url) {
1143
1165
  label
1144
1166
  name
1145
1167
  parameters { name, type }
1146
1168
  }
1147
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=S(await sr(this,Rt,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1169
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=b(await ar(this,Pt,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1148
1170
  expressionInteract(url: $url, interactionCall: $interactionCall)
1149
- }`,variables:{url:e,interactionCall:t}}));return r}};Rt=new WeakMap;var Va={};Va.byteLength=Nd;Va.toByteArray=Rd;Va.fromByteArray=Ud;var wt=[],ot=[],Ld=typeof Uint8Array<"u"?Uint8Array:Array,ys="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(yi=0,nc=ys.length;yi<nc;++yi)wt[yi]=ys[yi],ot[ys.charCodeAt(yi)]=yi;var yi,nc;ot["-".charCodeAt(0)]=62;ot["_".charCodeAt(0)]=63;function $l(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Nd(i){var e=$l(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Pd(i,e,t){return(e+t)*3/4-t}function Rd(i){var e,t=$l(i),r=t[0],n=t[1],a=new Ld(Pd(i,r,n)),s=0,o=n>0?r-4:r,c;for(c=0;c<o;c+=4)e=ot[i.charCodeAt(c)]<<18|ot[i.charCodeAt(c+1)]<<12|ot[i.charCodeAt(c+2)]<<6|ot[i.charCodeAt(c+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=ot[i.charCodeAt(c)]<<2|ot[i.charCodeAt(c+1)]>>4,a[s++]=e&255),n===1&&(e=ot[i.charCodeAt(c)]<<10|ot[i.charCodeAt(c+1)]<<4|ot[i.charCodeAt(c+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Od(i){return wt[i>>18&63]+wt[i>>12&63]+wt[i>>6&63]+wt[i&63]}function Dd(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(Od(r));return n.join("")}function Ud(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(Dd(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(wt[e>>2]+wt[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(wt[e>>10]+wt[e>>4&63]+wt[e<<2&63]+"=")),n.join("")}var Md=4,ac=0,sc=1,Fd=2;function Ir(i){let e=i.length;for(;--e>=0;)i[e]=0}var Bd=0,Al=1,jd=2,qd=3,Vd=258,lo=29,xn=256,fn=xn+1+lo,hr=30,uo=19,Il=2*fn+1,ki=15,vs=16,zd=7,po=256,kl=16,Tl=17,Cl=18,Hs=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]),ua=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]),Hd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Ll=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kd=512,Ot=new Array((fn+2)*2);Ir(Ot);var sn=new Array(hr*2);Ir(sn);var hn=new Array(Kd);Ir(hn);var gn=new Array(Vd-qd+1);Ir(gn);var fo=new Array(lo);Ir(fo);var La=new Array(hr);Ir(La);function bs(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var Nl,Pl,Rl;function Ss(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Ol=i=>i<256?hn[i]:hn[256+(i>>>7)],mn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Qe=(i,e,t)=>{i.bi_valid>vs-t?(i.bi_buf|=e<<i.bi_valid&65535,mn(i,i.bi_buf),i.bi_buf=e>>vs-i.bi_valid,i.bi_valid+=t-vs):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},_t=(i,e,t)=>{Qe(i,t[e*2],t[e*2+1])},Dl=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Wd=i=>{i.bi_valid===16?(mn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},Qd=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,u,m,p,d,f,y=0;for(p=0;p<=ki;p++)i.bl_count[p]=0;for(t[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Il;l++)u=i.heap[l],p=t[t[u*2+1]*2+1]+1,p>c&&(p=c,y++),t[u*2+1]=p,!(u>r)&&(i.bl_count[p]++,d=0,u>=o&&(d=s[u-o]),f=t[u*2],i.opt_len+=f*(p+d),a&&(i.static_len+=f*(n[u*2+1]+d)));if(y!==0){do{for(p=c-1;i.bl_count[p]===0;)p--;i.bl_count[p]--,i.bl_count[p+1]+=2,i.bl_count[c]--,y-=2}while(y>0);for(p=c;p!==0;p--)for(u=i.bl_count[p];u!==0;)m=i.heap[--l],!(m>r)&&(t[m*2+1]!==p&&(i.opt_len+=(p-t[m*2+1])*t[m*2],t[m*2+1]=p),u--)}},Ul=(i,e,t)=>{let r=new Array(ki+1),n=0,a,s;for(a=1;a<=ki;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=Dl(r[o]++,o))}},Gd=()=>{let i,e,t,r,n,a=new Array(ki+1);for(t=0,r=0;r<lo-1;r++)for(fo[r]=t,i=0;i<1<<Hs[r];i++)gn[t++]=r;for(gn[t-1]=r,n=0,r=0;r<16;r++)for(La[r]=n,i=0;i<1<<ua[r];i++)hn[n++]=r;for(n>>=7;r<hr;r++)for(La[r]=n<<7,i=0;i<1<<ua[r]-7;i++)hn[256+n++]=r;for(e=0;e<=ki;e++)a[e]=0;for(i=0;i<=143;)Ot[i*2+1]=8,i++,a[8]++;for(;i<=255;)Ot[i*2+1]=9,i++,a[9]++;for(;i<=279;)Ot[i*2+1]=7,i++,a[7]++;for(;i<=287;)Ot[i*2+1]=8,i++,a[8]++;for(Ul(Ot,fn+1,a),i=0;i<hr;i++)sn[i*2+1]=5,sn[i*2]=Dl(i,5);Nl=new bs(Ot,Hs,xn+1,fn,ki),Pl=new bs(sn,ua,0,hr,ki),Rl=new bs(new Array(0),Hd,0,uo,zd)},Ml=i=>{let e;for(e=0;e<fn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<hr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<uo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[po*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Fl=i=>{i.bi_valid>8?mn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},oc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},ws=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&oc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!oc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},cc=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?_t(i,n,e):(s=gn[n],_t(i,s+xn+1,e),o=Hs[s],o!==0&&(n-=fo[s],Qe(i,n,o)),r--,s=Ol(r),_t(i,s,t),o=ua[s],o!==0&&(r-=La[s],Qe(i,r,o)));while(a<i.sym_next);_t(i,po,e)},Ks=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,c=-1,l;for(i.heap_len=0,i.heap_max=Il,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=c=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=c<2?++c:0,t[l*2]=1,i.depth[l]=0,i.opt_len--,n&&(i.static_len-=r[l*2+1]);for(e.max_code=c,s=i.heap_len>>1;s>=1;s--)ws(i,t,s);l=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],ws(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[l*2]=t[s*2]+t[o*2],i.depth[l]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=l,i.heap[1]=l++,ws(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Qd(i,e),Ul(t,c,i.bl_count)},lc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)&&(o<l?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[kl*2]++):o<=10?i.bl_tree[Tl*2]++:i.bl_tree[Cl*2]++,o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4))},uc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)){if(o<l)do _t(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(_t(i,a,i.bl_tree),o--),_t(i,kl,i.bl_tree),Qe(i,o-3,2)):o<=10?(_t(i,Tl,i.bl_tree),Qe(i,o-3,3)):(_t(i,Cl,i.bl_tree),Qe(i,o-11,7));o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4)}},Zd=i=>{let e;for(lc(i,i.dyn_ltree,i.l_desc.max_code),lc(i,i.dyn_dtree,i.d_desc.max_code),Ks(i,i.bl_desc),e=uo-1;e>=3&&i.bl_tree[Ll[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Jd=(i,e,t,r)=>{let n;for(Qe(i,e-257,5),Qe(i,t-1,5),Qe(i,r-4,4),n=0;n<r;n++)Qe(i,i.bl_tree[Ll[n]*2+1],3);uc(i,i.dyn_ltree,e-1),uc(i,i.dyn_dtree,t-1)},Yd=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return ac;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return sc;for(t=32;t<xn;t++)if(i.dyn_ltree[t*2]!==0)return sc;return ac},dc=!1,Xd=i=>{dc||(Gd(),dc=!0),i.l_desc=new Ss(i.dyn_ltree,Nl),i.d_desc=new Ss(i.dyn_dtree,Pl),i.bl_desc=new Ss(i.bl_tree,Rl),i.bi_buf=0,i.bi_valid=0,Ml(i)},Bl=(i,e,t,r)=>{Qe(i,(Bd<<1)+(r?1:0),3),Fl(i),mn(i,t),mn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},ep=i=>{Qe(i,Al<<1,3),_t(i,po,Ot),Wd(i)},tp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===Fd&&(i.strm.data_type=Yd(i)),Ks(i,i.l_desc),Ks(i,i.d_desc),s=Zd(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Bl(i,e,t,r):i.strategy===Md||a===n?(Qe(i,(Al<<1)+(r?1:0),3),cc(i,Ot,sn)):(Qe(i,(jd<<1)+(r?1:0),3),Jd(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),cc(i,i.dyn_ltree,i.dyn_dtree)),Ml(i),r&&Fl(i)},ip=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(gn[t]+xn+1)*2]++,i.dyn_dtree[Ol(e)*2]++),i.sym_next===i.sym_end),rp=Xd,np=Bl,ap=tp,sp=ip,op=ep,cp={_tr_init:rp,_tr_stored_block:np,_tr_flush_block:ap,_tr_tally:sp,_tr_align:op},lp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},yn=lp,up=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},dp=new Uint32Array(up()),pp=(i,e,t,r)=>{let n=dp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},$e=pp,Mi={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"},Wi={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:fp,_tr_stored_block:Ws,_tr_flush_block:hp,_tr_tally:Yt,_tr_align:gp}=cp,{Z_NO_FLUSH:Xt,Z_PARTIAL_FLUSH:mp,Z_FULL_FLUSH:yp,Z_FINISH:lt,Z_BLOCK:pc,Z_OK:Le,Z_STREAM_END:fc,Z_STREAM_ERROR:xt,Z_DATA_ERROR:vp,Z_BUF_ERROR:_s,Z_DEFAULT_COMPRESSION:bp,Z_FILTERED:Sp,Z_HUFFMAN_ONLY:Wn,Z_RLE:wp,Z_FIXED:_p,Z_DEFAULT_STRATEGY:Ep,Z_UNKNOWN:xp,Z_DEFLATED:za}=Wi,$p=9,Ap=15,Ip=8,kp=29,Tp=256,Qs=Tp+1+kp,Cp=30,Lp=19,Np=2*Qs+1,Pp=15,J=3,Wt=258,$t=Wt+J+1,Rp=32,br=42,ho=57,Gs=69,Zs=73,Js=91,Ys=103,Ti=113,Xr=666,Ve=1,kr=2,Fi=3,Tr=4,Op=3,Ci=(i,e)=>(i.msg=Mi[e],e),hc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},Dp=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},Up=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ei=Up,Je=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},et=(i,e)=>{hp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Je(i.strm)},te=(i,e)=>{i.pending_buf[i.pending++]=e},Mr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},Xs=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=yn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=$e(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},jl=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,c=i.strstart>i.w_size-$t?i.strstart-(i.w_size-$t):0,l=i.window,u=i.w_mask,m=i.prev,p=i.strstart+Wt,d=l[r+s-1],f=l[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(l[n+s]!==f||l[n+s-1]!==d||l[n]!==l[r]||l[++n]!==l[r+1])){r+=2,n++;do;while(l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&r<p);if(a=Wt-(p-r),r=p-Wt,a>s){if(i.match_start=e,s=a,a>=o)break;d=l[r+s-1],f=l[r+s]}}while((e=m[e&u])>c&&--t!==0);return s<=i.lookahead?s:i.lookahead},Sr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-$t)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),Dp(i),r+=e),i.strm.avail_in===0)break;if(t=Xs(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=J)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=ei(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ei(i,i.ins_h,i.window[n+J-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<J)););}while(i.lookahead<$t&&i.strm.avail_in!==0)},ql=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==lt||e===Xt||r!==n+i.strm.avail_in)))break;s=e===lt&&r===n+i.strm.avail_in?1:0,Ws(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Je(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(Xs(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?Tr:e!==Xt&&e!==lt&&i.strm.avail_in===0&&i.strstart===i.block_start?kr:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(Xs(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===lt)&&e!==Xt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===lt&&i.strm.avail_in===0&&r===n?1:0,Ws(i,i.block_start,r,s),i.block_start+=r,Je(i.strm)),s?Fi:Ve)},Es=(i,e)=>{let t,r;for(;;){if(i.lookahead<$t){if(Sr(i),i.lookahead<$t&&e===Xt)return Ve;if(i.lookahead===0)break}if(t=0,i.lookahead>=J&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+J-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-$t&&(i.match_length=jl(i,t)),i.match_length>=J)if(r=Yt(i,i.strstart-i.match_start,i.match_length-J),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=J){i.match_length--;do i.strstart++,i.ins_h=ei(i,i.ins_h,i.window[i.strstart+J-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=ei(i,i.ins_h,i.window[i.strstart+1]);else r=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(et(i,!1),i.strm.avail_out===0))return Ve}return i.insert=i.strstart<J-1?i.strstart:J-1,e===lt?(et(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?Ve:kr},or=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<$t){if(Sr(i),i.lookahead<$t&&e===Xt)return Ve;if(i.lookahead===0)break}if(t=0,i.lookahead>=J&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+J-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=J-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-$t&&(i.match_length=jl(i,t),i.match_length<=5&&(i.strategy===Sp||i.match_length===J&&i.strstart-i.match_start>4096)&&(i.match_length=J-1)),i.prev_length>=J&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-J,r=Yt(i,i.strstart-1-i.prev_match,i.prev_length-J),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+J-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=J-1,i.strstart++,r&&(et(i,!1),i.strm.avail_out===0))return Ve}else if(i.match_available){if(r=Yt(i,0,i.window[i.strstart-1]),r&&et(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return Ve}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Yt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<J-1?i.strstart:J-1,e===lt?(et(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?Ve:kr},Mp=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Wt){if(Sr(i),i.lookahead<=Wt&&e===Xt)return Ve;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=J&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Wt;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=Wt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=J?(t=Yt(i,1,i.match_length-J),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(et(i,!1),i.strm.avail_out===0))return Ve}return i.insert=0,e===lt?(et(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?Ve:kr},Fp=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(Sr(i),i.lookahead===0)){if(e===Xt)return Ve;break}if(i.match_length=0,t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(et(i,!1),i.strm.avail_out===0))return Ve}return i.insert=0,e===lt?(et(i,!0),i.strm.avail_out===0?Fi:Tr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?Ve:kr};function yt(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var en=[new yt(0,0,0,0,ql),new yt(4,4,8,4,Es),new yt(4,5,16,8,Es),new yt(4,6,32,32,Es),new yt(4,4,16,16,or),new yt(8,16,32,32,or),new yt(8,16,128,128,or),new yt(8,32,128,256,or),new yt(32,128,258,1024,or),new yt(32,258,258,4096,or)],Bp=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=en[i.level].max_lazy,i.good_match=en[i.level].good_length,i.nice_match=en[i.level].nice_length,i.max_chain_length=en[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=J-1,i.match_available=0,i.ins_h=0};function jp(){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=za,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(Np*2),this.dyn_dtree=new Uint16Array((2*Cp+1)*2),this.bl_tree=new Uint16Array((2*Lp+1)*2),Kt(this.dyn_ltree),Kt(this.dyn_dtree),Kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Pp+1),this.heap=new Uint16Array(2*Qs+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Qs+1),Kt(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 $n=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==br&&e.status!==ho&&e.status!==Gs&&e.status!==Zs&&e.status!==Js&&e.status!==Ys&&e.status!==Ti&&e.status!==Xr?1:0},Vl=i=>{if($n(i))return Ci(i,xt);i.total_in=i.total_out=0,i.data_type=xp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ho:e.wrap?br:Ti,i.adler=e.wrap===2?0:1,e.last_flush=-2,fp(e),Le},zl=i=>{let e=Vl(i);return e===Le&&Bp(i.state),e},qp=(i,e)=>$n(i)||i.state.wrap!==2?xt:(i.state.gzhead=e,Le),Hl=(i,e,t,r,n,a)=>{if(!i)return xt;let s=1;if(e===bp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>$p||t!==za||r<8||r>15||e<0||e>9||a<0||a>_p||r===8&&s!==1)return Ci(i,xt);r===8&&(r=9);let o=new jp;return i.state=o,o.strm=i,o.status=br,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+J-1)/J),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,zl(i)},Vp=(i,e)=>Hl(i,e,za,Ap,Ip,Ep),zp=(i,e)=>{if($n(i)||e>pc||e<0)return i?Ci(i,xt):xt;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===Xr&&e!==lt)return Ci(i,i.avail_out===0?_s:xt);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Je(i),i.avail_out===0)return t.last_flush=-1,Le}else if(i.avail_in===0&&hc(e)<=hc(r)&&e!==lt)return Ci(i,_s);if(t.status===Xr&&i.avail_in!==0)return Ci(i,_s);if(t.status===br&&t.wrap===0&&(t.status=Ti),t.status===br){let n=za+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Wn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Rp),n+=31-n%31,Mr(t,n),t.strstart!==0&&(Mr(t,i.adler>>>16),Mr(t,i.adler&65535)),i.adler=1,t.status=Ti,Je(i),t.pending!==0)return t.last_flush=-1,Le}if(t.status===ho){if(i.adler=0,te(t,31),te(t,139),te(t,8),t.gzhead)te(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)),te(t,t.gzhead.time&255),te(t,t.gzhead.time>>8&255),te(t,t.gzhead.time>>16&255),te(t,t.gzhead.time>>24&255),te(t,t.level===9?2:t.strategy>=Wn||t.level<2?4:0),te(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(te(t,t.gzhead.extra.length&255),te(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=$e(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Gs;else if(te(t,0),te(t,0),te(t,0),te(t,0),te(t,0),te(t,t.level===9?2:t.strategy>=Wn||t.level<2?4:0),te(t,Op),t.status=Ti,Je(i),t.pending!==0)return t.last_flush=-1,Le}if(t.status===Gs){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 o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Je(i),t.pending!==0)return t.last_flush=-1,Le;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Zs}if(t.status===Zs){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n)),Je(i),t.pending!==0)return t.last_flush=-1,Le;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Js}if(t.status===Js){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n)),Je(i),t.pending!==0)return t.last_flush=-1,Le;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=$e(i.adler,t.pending_buf,t.pending-n,n))}t.status=Ys}if(t.status===Ys){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Je(i),t.pending!==0))return t.last_flush=-1,Le;te(t,i.adler&255),te(t,i.adler>>8&255),i.adler=0}if(t.status=Ti,Je(i),t.pending!==0)return t.last_flush=-1,Le}if(i.avail_in!==0||t.lookahead!==0||e!==Xt&&t.status!==Xr){let n=t.level===0?ql(t,e):t.strategy===Wn?Fp(t,e):t.strategy===wp?Mp(t,e):en[t.level].func(t,e);if((n===Fi||n===Tr)&&(t.status=Xr),n===Ve||n===Fi)return i.avail_out===0&&(t.last_flush=-1),Le;if(n===kr&&(e===mp?gp(t):e!==pc&&(Ws(t,0,0,!1),e===yp&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Je(i),i.avail_out===0))return t.last_flush=-1,Le}return e!==lt?Le:t.wrap<=0?fc:(t.wrap===2?(te(t,i.adler&255),te(t,i.adler>>8&255),te(t,i.adler>>16&255),te(t,i.adler>>24&255),te(t,i.total_in&255),te(t,i.total_in>>8&255),te(t,i.total_in>>16&255),te(t,i.total_in>>24&255)):(Mr(t,i.adler>>>16),Mr(t,i.adler&65535)),Je(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Le:fc)},Hp=i=>{if($n(i))return xt;let e=i.state.status;return i.state=null,e===Ti?Ci(i,vp):Le},Kp=(i,e)=>{let t=e.length;if($n(i))return xt;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==br||r.lookahead)return xt;if(n===1&&(i.adler=yn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Kt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(e.subarray(t-r.w_size,t),0),e=c,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,Sr(r);r.lookahead>=J;){let c=r.strstart,l=r.lookahead-(J-1);do r.ins_h=ei(r,r.ins_h,r.window[c+J-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--l);r.strstart=c,r.lookahead=J-1,Sr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=J-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Le},Wp=Vp,Qp=Hl,Gp=zl,Zp=Vl,Jp=qp,Yp=zp,Xp=Hp,ef=Kp,tf="pako deflate (from Nodeca project)",on={deflateInit:Wp,deflateInit2:Qp,deflateReset:Gp,deflateResetKeep:Zp,deflateSetHeader:Jp,deflate:Yp,deflateEnd:Xp,deflateSetDictionary:ef,deflateInfo:tf},rf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),nf=function(i){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 r in t)rf(t,r)&&(i[r]=t[r])}}return i},af=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},Ha={assign:nf,flattenChunks:af},Kl=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){Kl=!1}var vn=new Uint8Array(256);for(let i=0;i<256;i++)vn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;vn[254]=vn[254]=1;var sf=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-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},of=(i,e)=>{if(e<65534&&i.subarray&&Kl)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},cf=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=vn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return of(a,n)},lf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+vn[i[t]]>e?t:e},bn={string2buf:sf,buf2string:cf,utf8border:lf};function uf(){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 Wl=uf,Ql=Object.prototype.toString,{Z_NO_FLUSH:df,Z_SYNC_FLUSH:pf,Z_FULL_FLUSH:ff,Z_FINISH:hf,Z_OK:Na,Z_STREAM_END:gf,Z_DEFAULT_COMPRESSION:mf,Z_DEFAULT_STRATEGY:yf,Z_DEFLATED:vf}=Wi;function An(i){this.options=Ha.assign({level:mf,method:vf,chunkSize:16384,windowBits:15,memLevel:8,strategy:yf},i||{});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 Wl,this.strm.avail_out=0;let t=on.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Na)throw new Error(Mi[t]);if(e.header&&on.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=bn.string2buf(e.dictionary):Ql.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=on.deflateSetDictionary(this.strm,r),t!==Na)throw new Error(Mi[t]);this._dict_set=!0}}An.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?hf:df,typeof i=="string"?t.input=bn.string2buf(i):Ql.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===pf||a===ff)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=on.deflate(t,a),n===gf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=on.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Na;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};An.prototype.onData=function(i){this.chunks.push(i)};An.prototype.onEnd=function(i){i===Na&&(this.result=Ha.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function go(i,e){let t=new An(e);if(t.push(i,!0),t.err)throw t.msg||Mi[t.err];return t.result}function bf(i,e){return e=e||{},e.raw=!0,go(i,e)}function Sf(i,e){return e=e||{},e.gzip=!0,go(i,e)}var wf=An,_f=go,Ef=bf,xf=Sf,$f=Wi,Af={Deflate:wf,deflate:_f,deflateRaw:Ef,gzip:xf,constants:$f},Qn=16209,If=16191,kf=function i(e,t){let r,n,a,s,o,c,l,u,m,p,d,f,y,$,A,T,N,x,C,D,I,W,L,k,b=e.state;r=e.next_in,L=e.input,n=r+(e.avail_in-5),a=e.next_out,k=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),c=b.dmax,l=b.wsize,u=b.whave,m=b.wnext,p=b.window,d=b.hold,f=b.bits,y=b.lencode,$=b.distcode,A=(1<<b.lenbits)-1,T=(1<<b.distbits)-1;e:do{f<15&&(d+=L[r++]<<f,f+=8,d+=L[r++]<<f,f+=8),N=y[d&A];t:for(;;){if(x=N>>>24,d>>>=x,f-=x,x=N>>>16&255,x===0)k[a++]=N&65535;else if(x&16){C=N&65535,x&=15,x&&(f<x&&(d+=L[r++]<<f,f+=8),C+=d&(1<<x)-1,d>>>=x,f-=x),f<15&&(d+=L[r++]<<f,f+=8,d+=L[r++]<<f,f+=8),N=$[d&T];i:for(;;){if(x=N>>>24,d>>>=x,f-=x,x=N>>>16&255,x&16){if(D=N&65535,x&=15,f<x&&(d+=L[r++]<<f,f+=8,f<x&&(d+=L[r++]<<f,f+=8)),D+=d&(1<<x)-1,D>c){e.msg="invalid distance too far back",b.mode=Qn;break e}if(d>>>=x,f-=x,x=a-s,D>x){if(x=D-x,x>u&&b.sane){e.msg="invalid distance too far back",b.mode=Qn;break e}if(I=0,W=p,m===0){if(I+=l-x,x<C){C-=x;do k[a++]=p[I++];while(--x);I=a-D,W=k}}else if(m<x){if(I+=l+m-x,x-=m,x<C){C-=x;do k[a++]=p[I++];while(--x);if(I=0,m<C){x=m,C-=x;do k[a++]=p[I++];while(--x);I=a-D,W=k}}}else if(I+=m-x,x<C){C-=x;do k[a++]=p[I++];while(--x);I=a-D,W=k}for(;C>2;)k[a++]=W[I++],k[a++]=W[I++],k[a++]=W[I++],C-=3;C&&(k[a++]=W[I++],C>1&&(k[a++]=W[I++]))}else{I=a-D;do k[a++]=k[I++],k[a++]=k[I++],k[a++]=k[I++],C-=3;while(C>2);C&&(k[a++]=k[I++],C>1&&(k[a++]=k[I++]))}}else if((x&64)===0){N=$[(N&65535)+(d&(1<<x)-1)];continue i}else{e.msg="invalid distance code",b.mode=Qn;break e}break}}else if((x&64)===0){N=y[(N&65535)+(d&(1<<x)-1)];continue t}else if(x&32){b.mode=If;break e}else{e.msg="invalid literal/length code",b.mode=Qn;break e}break}}while(r<n&&a<o);C=f>>3,r-=C,f-=C<<3,d&=(1<<f)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),b.hold=d,b.bits=f},cr=15,gc=852,mc=592,yc=0,xs=1,vc=2,Tf=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]),Cf=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]),Lf=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]),Nf=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]),Pf=(i,e,t,r,n,a,s,o)=>{let c=o.bits,l=0,u=0,m=0,p=0,d=0,f=0,y=0,$=0,A=0,T=0,N,x,C,D,I,W=null,L,k=new Uint16Array(cr+1),b=new Uint16Array(cr+1),Ue=null,ke,_e,Tn;for(l=0;l<=cr;l++)k[l]=0;for(u=0;u<r;u++)k[e[t+u]]++;for(d=c,p=cr;p>=1&&k[p]===0;p--);if(d>p&&(d=p),p===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<p&&k[m]===0;m++);for(d<m&&(d=m),$=1,l=1;l<=cr;l++)if($<<=1,$-=k[l],$<0)return-1;if($>0&&(i===yc||p!==1))return-1;for(b[1]=0,l=1;l<cr;l++)b[l+1]=b[l]+k[l];for(u=0;u<r;u++)e[t+u]!==0&&(s[b[e[t+u]]++]=u);if(i===yc?(W=Ue=s,L=20):i===xs?(W=Tf,Ue=Cf,L=257):(W=Lf,Ue=Nf,L=0),T=0,u=0,l=m,I=a,f=d,y=0,C=-1,A=1<<d,D=A-1,i===xs&&A>gc||i===vc&&A>mc)return 1;for(;;){ke=l-y,s[u]+1<L?(_e=0,Tn=s[u]):s[u]>=L?(_e=Ue[s[u]-L],Tn=W[s[u]-L]):(_e=32+64,Tn=0),N=1<<l-y,x=1<<f,m=x;do x-=N,n[I+(T>>y)+x]=ke<<24|_e<<16|Tn|0;while(x!==0);for(N=1<<l-1;T&N;)N>>=1;if(N!==0?(T&=N-1,T+=N):T=0,u++,--k[l]===0){if(l===p)break;l=e[t+s[u]]}if(l>d&&(T&D)!==C){for(y===0&&(y=d),I+=m,f=l-y,$=1<<f;f+y<p&&($-=k[f+y],!($<=0));)f++,$<<=1;if(A+=1<<f,i===xs&&A>gc||i===vc&&A>mc)return 1;C=T&D,n[C]=d<<24|f<<16|I-a|0}}return T!==0&&(n[I+T]=l-y<<24|64<<16|0),o.bits=d,0},cn=Pf,Rf=0,Gl=1,Zl=2,{Z_FINISH:bc,Z_BLOCK:Of,Z_TREES:Gn,Z_OK:Bi,Z_STREAM_END:Df,Z_NEED_DICT:Uf,Z_STREAM_ERROR:ut,Z_DATA_ERROR:Jl,Z_MEM_ERROR:Yl,Z_BUF_ERROR:Mf,Z_DEFLATED:Sc}=Wi,Ka=16180,wc=16181,_c=16182,Ec=16183,xc=16184,$c=16185,Ac=16186,Ic=16187,kc=16188,Tc=16189,Pa=16190,Lt=16191,$s=16192,Cc=16193,As=16194,Lc=16195,Nc=16196,Pc=16197,Rc=16198,Zn=16199,Jn=16200,Oc=16201,Dc=16202,Uc=16203,Mc=16204,Fc=16205,Is=16206,Bc=16207,jc=16208,de=16209,Xl=16210,eu=16211,Ff=852,Bf=592,jf=15,qf=jf,qc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Vf(){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 Qi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Ka||e.mode>eu?1:0},tu=i=>{if(Qi(i))return ut;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Ka,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(Ff),e.distcode=e.distdyn=new Int32Array(Bf),e.sane=1,e.back=-1,Bi},iu=i=>{if(Qi(i))return ut;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,tu(i)},ru=(i,e)=>{let t;if(Qi(i))return ut;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?ut:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,iu(i))},nu=(i,e)=>{if(!i)return ut;let t=new Vf;i.state=t,t.strm=i,t.window=null,t.mode=Ka;let r=ru(i,e);return r!==Bi&&(i.state=null),r},zf=i=>nu(i,qf),Vc=!0,ks,Ts,Hf=i=>{if(Vc){ks=new Int32Array(512),Ts=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(cn(Gl,i.lens,0,288,ks,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;cn(Zl,i.lens,0,32,Ts,0,i.work,{bits:5}),Vc=!1}i.lencode=ks,i.lenbits=9,i.distcode=Ts,i.distbits=5},au=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=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>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Kf=(i,e)=>{let t,r,n,a,s,o,c,l,u,m,p,d,f,y,$=0,A,T,N,x,C,D,I,W,L=new Uint8Array(4),k,b,Ue=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qi(i)||!i.output||!i.input&&i.avail_in!==0)return ut;t=i.state,t.mode===Lt&&(t.mode=$s),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,m=o,p=c,W=Bi;e:for(;;)switch(t.mode){case Ka:if(t.wrap===0){t.mode=$s;break}for(;u<16;){if(o===0)break e;o--,l+=r[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=$e(t.check,L,2,0),l=0,u=0,t.mode=wc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",t.mode=de;break}if((l&15)!==Sc){i.msg="unknown compression method",t.mode=de;break}if(l>>>=4,u-=4,I=(l&15)+8,t.wbits===0&&(t.wbits=I),I>15||I>t.wbits){i.msg="invalid window size",t.mode=de;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=l&512?Tc:Lt,l=0,u=0;break;case wc:for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==Sc){i.msg="unknown compression method",t.mode=de;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=de;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=$e(t.check,L,2,0)),l=0,u=0,t.mode=_c;case _c:for(;u<32;){if(o===0)break e;o--,l+=r[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=$e(t.check,L,4,0)),l=0,u=0,t.mode=Ec;case Ec:for(;u<16;){if(o===0)break e;o--,l+=r[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=$e(t.check,L,2,0)),l=0,u=0,t.mode=xc;case xc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,l+=r[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=$e(t.check,L,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=$c;case $c:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(I=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),I)),t.flags&512&&t.wrap&4&&(t.check=$e(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Ac;case Ac:if(t.flags&2048){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=$e(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Ic;case Ic:if(t.flags&4096){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=$e(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.comment=null);t.mode=kc;case kc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){i.msg="header crc mismatch",t.mode=de;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Lt;break;case Tc:for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}i.adler=t.check=qc(l),l=0,u=0,t.mode=Pa;case Pa:if(t.havedict===0)return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,Uf;i.adler=t.check=1,t.mode=Lt;case Lt:if(e===Of||e===Gn)break e;case $s:if(t.last){l>>>=u&7,u-=u&7,t.mode=Is;break}for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Cc;break;case 1:if(Hf(t),t.mode=Zn,e===Gn){l>>>=2,u-=2;break e}break;case 2:t.mode=Nc;break;case 3:i.msg="invalid block type",t.mode=de}l>>>=2,u-=2;break;case Cc:for(l>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",t.mode=de;break}if(t.length=l&65535,l=0,u=0,t.mode=As,e===Gn)break e;case As:t.mode=Lc;case Lc:if(d=t.length,d){if(d>o&&(d=o),d>c&&(d=c),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,c-=d,s+=d,t.length-=d;break}t.mode=Lt;break;case Nc:for(;u<14;){if(o===0)break e;o--,l+=r[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){i.msg="too many length or distance symbols",t.mode=de;break}t.have=0,t.mode=Pc;case Pc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.lens[Ue[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[Ue[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},W=cn(Rf,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,W){i.msg="invalid code lengths set",t.mode=de;break}t.have=0,t.mode=Rc;case Rc:for(;t.have<t.nlen+t.ndist;){for(;$=t.lencode[l&(1<<t.lenbits)-1],A=$>>>24,T=$>>>16&255,N=$&65535,!(A<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(N<16)l>>>=A,u-=A,t.lens[t.have++]=N;else{if(N===16){for(b=A+2;u<b;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(l>>>=A,u-=A,t.have===0){i.msg="invalid bit length repeat",t.mode=de;break}I=t.lens[t.have-1],d=3+(l&3),l>>>=2,u-=2}else if(N===17){for(b=A+3;u<b;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=A,u-=A,I=0,d=3+(l&7),l>>>=3,u-=3}else{for(b=A+7;u<b;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=A,u-=A,I=0,d=11+(l&127),l>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=de;break}for(;d--;)t.lens[t.have++]=I}}if(t.mode===de)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=de;break}if(t.lenbits=9,k={bits:t.lenbits},W=cn(Gl,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,W){i.msg="invalid literal/lengths set",t.mode=de;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},W=cn(Zl,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,W){i.msg="invalid distances set",t.mode=de;break}if(t.mode=Zn,e===Gn)break e;case Zn:t.mode=Jn;case Jn:if(o>=6&&c>=258){i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,kf(i,p),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,t.mode===Lt&&(t.back=-1);break}for(t.back=0;$=t.lencode[l&(1<<t.lenbits)-1],A=$>>>24,T=$>>>16&255,N=$&65535,!(A<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(T&&(T&240)===0){for(x=A,C=T,D=N;$=t.lencode[D+((l&(1<<x+C)-1)>>x)],A=$>>>24,T=$>>>16&255,N=$&65535,!(x+A<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=x,u-=x,t.back+=x}if(l>>>=A,u-=A,t.back+=A,t.length=N,T===0){t.mode=Fc;break}if(T&32){t.back=-1,t.mode=Lt;break}if(T&64){i.msg="invalid literal/length code",t.mode=de;break}t.extra=T&15,t.mode=Oc;case Oc:if(t.extra){for(b=t.extra;u<b;){if(o===0)break e;o--,l+=r[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=Dc;case Dc:for(;$=t.distcode[l&(1<<t.distbits)-1],A=$>>>24,T=$>>>16&255,N=$&65535,!(A<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((T&240)===0){for(x=A,C=T,D=N;$=t.distcode[D+((l&(1<<x+C)-1)>>x)],A=$>>>24,T=$>>>16&255,N=$&65535,!(x+A<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=x,u-=x,t.back+=x}if(l>>>=A,u-=A,t.back+=A,T&64){i.msg="invalid distance code",t.mode=de;break}t.offset=N,t.extra=T&15,t.mode=Uc;case Uc:if(t.extra){for(b=t.extra;u<b;){if(o===0)break e;o--,l+=r[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){i.msg="invalid distance too far back",t.mode=de;break}t.mode=Mc;case Mc:if(c===0)break e;if(d=p-c,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=de;break}d>t.wnext?(d-=t.wnext,f=t.wsize-d):f=t.wnext-d,d>t.length&&(d=t.length),y=t.window}else y=n,f=s-t.offset,d=t.length;d>c&&(d=c),c-=d,t.length-=d;do n[s++]=y[f++];while(--d);t.length===0&&(t.mode=Jn);break;case Fc:if(c===0)break e;n[s++]=t.length,c--,t.mode=Jn;break;case Is:if(t.wrap){for(;u<32;){if(o===0)break e;o--,l|=r[a++]<<u,u+=8}if(p-=c,i.total_out+=p,t.total+=p,t.wrap&4&&p&&(i.adler=t.check=t.flags?$e(t.check,n,p,s-p):yn(t.check,n,p,s-p)),p=c,t.wrap&4&&(t.flags?l:qc(l))!==t.check){i.msg="incorrect data check",t.mode=de;break}l=0,u=0}t.mode=Bc;case Bc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=de;break}l=0,u=0}t.mode=jc;case jc:W=Df;break e;case de:W=Jl;break e;case Xl:return Yl;case eu:default:return ut}return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,(t.wsize||p!==i.avail_out&&t.mode<de&&(t.mode<Is||e!==bc))&&au(i,i.output,i.next_out,p-i.avail_out),m-=i.avail_in,p-=i.avail_out,i.total_in+=m,i.total_out+=p,t.total+=p,t.wrap&4&&p&&(i.adler=t.check=t.flags?$e(t.check,n,p,i.next_out-p):yn(t.check,n,p,i.next_out-p)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Lt?128:0)+(t.mode===Zn||t.mode===As?256:0),(m===0&&p===0||e===bc)&&W===Bi&&(W=Mf),W},Wf=i=>{if(Qi(i))return ut;let e=i.state;return e.window&&(e.window=null),i.state=null,Bi},Qf=(i,e)=>{if(Qi(i))return ut;let t=i.state;return(t.wrap&2)===0?ut:(t.head=e,e.done=!1,Bi)},Gf=(i,e)=>{let t=e.length,r,n,a;return Qi(i)||(r=i.state,r.wrap!==0&&r.mode!==Pa)?ut:r.mode===Pa&&(n=1,n=yn(n,e,t,0),n!==r.check)?Jl:(a=au(i,e,t,t),a?(r.mode=Xl,Yl):(r.havedict=1,Bi))},Zf=iu,Jf=ru,Yf=tu,Xf=zf,eh=nu,th=Kf,ih=Wf,rh=Qf,nh=Gf,ah="pako inflate (from Nodeca project)",Dt={inflateReset:Zf,inflateReset2:Jf,inflateResetKeep:Yf,inflateInit:Xf,inflateInit2:eh,inflate:th,inflateEnd:ih,inflateGetHeader:rh,inflateSetDictionary:nh,inflateInfo:ah};function sh(){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 oh=sh,su=Object.prototype.toString,{Z_NO_FLUSH:ch,Z_FINISH:lh,Z_OK:Sn,Z_STREAM_END:Cs,Z_NEED_DICT:Ls,Z_STREAM_ERROR:uh,Z_DATA_ERROR:zc,Z_MEM_ERROR:dh}=Wi;function In(i){this.options=Ha.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});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&&!(i&&i.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 Wl,this.strm.avail_out=0;let t=Dt.inflateInit2(this.strm,e.windowBits);if(t!==Sn)throw new Error(Mi[t]);if(this.header=new oh,Dt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=bn.string2buf(e.dictionary):su.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Dt.inflateSetDictionary(this.strm,e.dictionary),t!==Sn)))throw new Error(Mi[t])}In.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?lh:ch,su.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Dt.inflate(t,s),a===Ls&&n&&(a=Dt.inflateSetDictionary(t,n),a===Sn?a=Dt.inflate(t,s):a===zc&&(a=Ls));t.avail_in>0&&a===Cs&&t.state.wrap>0&&i[t.next_in]!==0;)Dt.inflateReset(t),a=Dt.inflate(t,s);switch(a){case uh:case zc:case Ls:case dh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Cs))if(this.options.to==="string"){let c=bn.utf8border(t.output,t.next_out),l=t.next_out-c,u=bn.buf2string(t.output,c);t.next_out=l,t.avail_out=r-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===Sn&&o===0)){if(a===Cs)return a=Dt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};In.prototype.onData=function(i){this.chunks.push(i)};In.prototype.onEnd=function(i){i===Sn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ha.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function mo(i,e){let t=new In(e);if(t.push(i),t.err)throw t.msg||Mi[t.err];return t.result}function ph(i,e){return e=e||{},e.raw=!0,mo(i,e)}var fh=In,hh=mo,gh=ph,mh=mo,yh=Wi,vh={Inflate:fh,inflate:hh,inflateRaw:gh,ungzip:mh,constants:yh},{Deflate:bh,deflate:Sh,deflateRaw:wh,gzip:_h}=Af,{Inflate:Eh,inflate:xh,inflateRaw:$h,ungzip:Ah}=vh,Ih=bh,kh=Sh,Th=wh,Ch=_h,Lh=Eh,Nh=xh,Ph=$h,Rh=Ah,Oh=Wi,Dh={Deflate:Ih,deflate:kh,deflateRaw:Th,gzip:Ch,Inflate:Lh,inflate:Nh,inflateRaw:Ph,ungzip:Rh,constants:Oh},oe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ce=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ra=class{constructor(e,t){this.input=e,this.output=t}};oe([h(),ce("design:type",String)],Ra.prototype,"input",void 0);oe([h(),ce("design:type",String)],Ra.prototype,"output",void 0);Ra=oe([Ie(),ce("design:paramtypes",[String,String])],Ra);var Oa=class{constructor(e,t){this.input=e,this.output=t}};oe([h(),ce("design:type",String)],Oa.prototype,"input",void 0);oe([h(),ce("design:type",String)],Oa.prototype,"output",void 0);Oa=oe([q(),ce("design:paramtypes",[String,String])],Oa);var ni=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};oe([h(),ce("design:type",String)],ni.prototype,"name",void 0);oe([h(),ce("design:type",String)],ni.prototype,"modelId",void 0);oe([h(),ce("design:type",String)],ni.prototype,"systemPrompt",void 0);oe([h(),ce("design:type",Array)],ni.prototype,"promptExamples",void 0);oe([h(),ce("design:type",String)],ni.prototype,"metaData",void 0);ni=oe([Ie(),ce("design:paramtypes",[String,String,String,Array,String])],ni);var kt=class{constructor(e,t,r,n,a,s,o,c){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=c}};oe([h(),ce("design:type",String)],kt.prototype,"name",void 0);oe([h(),ce("design:type",String)],kt.prototype,"modelId",void 0);oe([h(),ce("design:type",String)],kt.prototype,"taskId",void 0);oe([h(),ce("design:type",String)],kt.prototype,"systemPrompt",void 0);oe([h(),ce("design:type",Array)],kt.prototype,"promptExamples",void 0);oe([h(),ce("design:type",String)],kt.prototype,"metaData",void 0);oe([h(),ce("design:type",String)],kt.prototype,"createdAt",void 0);oe([h(),ce("design:type",String)],kt.prototype,"updatedAt",void 0);kt=oe([q(),ce("design:paramtypes",[String,String,String,String,Array,String,String,String])],kt);var ji=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};oe([h(),ce("design:type",String)],ji.prototype,"model",void 0);oe([h(),ce("design:type",String)],ji.prototype,"status",void 0);oe([h(),ce("design:type",Number)],ji.prototype,"progress",void 0);oe([h(),ce("design:type",Boolean)],ji.prototype,"downloaded",void 0);oe([h(),ce("design:type",Boolean)],ji.prototype,"loaded",void 0);ji=oe([q(),ce("design:paramtypes",[String,String,Number,Boolean,Boolean])],ji);var Uh=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},we=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},be,da,eo=class{constructor(e,t=!0){be.set(this,void 0),da.set(this,new Map),Uh(this,be,e,"f")}async getModels(){let e=await we(this,be,"f").query({query:v`
1171
+ }`,variables:{url:e,interactionCall:t}}));return r}};Pt=new WeakMap;var Va={};Va.byteLength=Md;Va.toByteArray=Fd;Va.fromByteArray=qd;var St=[],rt=[],Dd=typeof Uint8Array<"u"?Uint8Array:Array,ys="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(mi=0,sc=ys.length;mi<sc;++mi)St[mi]=ys[mi],rt[ys.charCodeAt(mi)]=mi;var mi,sc;rt["-".charCodeAt(0)]=62;rt["_".charCodeAt(0)]=63;function Il(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Md(i){var e=Il(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Ud(i,e,t){return(e+t)*3/4-t}function Fd(i){var e,t=Il(i),r=t[0],n=t[1],a=new Dd(Ud(i,r,n)),s=0,o=n>0?r-4:r,c;for(c=0;c<o;c+=4)e=rt[i.charCodeAt(c)]<<18|rt[i.charCodeAt(c+1)]<<12|rt[i.charCodeAt(c+2)]<<6|rt[i.charCodeAt(c+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=rt[i.charCodeAt(c)]<<2|rt[i.charCodeAt(c+1)]>>4,a[s++]=e&255),n===1&&(e=rt[i.charCodeAt(c)]<<10|rt[i.charCodeAt(c+1)]<<4|rt[i.charCodeAt(c+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function jd(i){return St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}function Bd(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(jd(r));return n.join("")}function qd(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(Bd(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(St[e>>2]+St[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(St[e>>10]+St[e>>4&63]+St[e<<2&63]+"=")),n.join("")}var Vd=4,oc=0,cc=1,Hd=2;function $r(i){let e=i.length;for(;--e>=0;)i[e]=0}var zd=0,Tl=1,Kd=2,Wd=3,Qd=258,co=29,En=256,pn=En+1+co,pr=30,lo=19,Cl=2*pn+1,ki=15,vs=16,Gd=7,uo=256,Ll=16,Nl=17,Rl=18,zs=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]),ua=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]),Zd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Pl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jd=512,Ot=new Array((pn+2)*2);$r(Ot);var an=new Array(pr*2);$r(an);var fn=new Array(Jd);$r(fn);var hn=new Array(Qd-Wd+1);$r(hn);var po=new Array(co);$r(po);var Ta=new Array(pr);$r(Ta);function bs(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var Ol,Dl,Ml;function Ss(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Ul=i=>i<256?fn[i]:fn[256+(i>>>7)],gn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},He=(i,e,t)=>{i.bi_valid>vs-t?(i.bi_buf|=e<<i.bi_valid&65535,gn(i,i.bi_buf),i.bi_buf=e>>vs-i.bi_valid,i.bi_valid+=t-vs):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},wt=(i,e,t)=>{He(i,t[e*2],t[e*2+1])},Fl=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Yd=i=>{i.bi_valid===16?(gn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},Xd=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,u,y,g,d,p,h=0;for(g=0;g<=ki;g++)i.bl_count[g]=0;for(t[i.heap[i.heap_max]*2+1]=0,l=i.heap_max+1;l<Cl;l++)u=i.heap[l],g=t[t[u*2+1]*2+1]+1,g>c&&(g=c,h++),t[u*2+1]=g,!(u>r)&&(i.bl_count[g]++,d=0,u>=o&&(d=s[u-o]),p=t[u*2],i.opt_len+=p*(g+d),a&&(i.static_len+=p*(n[u*2+1]+d)));if(h!==0){do{for(g=c-1;i.bl_count[g]===0;)g--;i.bl_count[g]--,i.bl_count[g+1]+=2,i.bl_count[c]--,h-=2}while(h>0);for(g=c;g!==0;g--)for(u=i.bl_count[g];u!==0;)y=i.heap[--l],!(y>r)&&(t[y*2+1]!==g&&(i.opt_len+=(g-t[y*2+1])*t[y*2],t[y*2+1]=g),u--)}},jl=(i,e,t)=>{let r=new Array(ki+1),n=0,a,s;for(a=1;a<=ki;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=Fl(r[o]++,o))}},ep=()=>{let i,e,t,r,n,a=new Array(ki+1);for(t=0,r=0;r<co-1;r++)for(po[r]=t,i=0;i<1<<zs[r];i++)hn[t++]=r;for(hn[t-1]=r,n=0,r=0;r<16;r++)for(Ta[r]=n,i=0;i<1<<ua[r];i++)fn[n++]=r;for(n>>=7;r<pr;r++)for(Ta[r]=n<<7,i=0;i<1<<ua[r]-7;i++)fn[256+n++]=r;for(e=0;e<=ki;e++)a[e]=0;for(i=0;i<=143;)Ot[i*2+1]=8,i++,a[8]++;for(;i<=255;)Ot[i*2+1]=9,i++,a[9]++;for(;i<=279;)Ot[i*2+1]=7,i++,a[7]++;for(;i<=287;)Ot[i*2+1]=8,i++,a[8]++;for(jl(Ot,pn+1,a),i=0;i<pr;i++)an[i*2+1]=5,an[i*2]=Fl(i,5);Ol=new bs(Ot,zs,En+1,pn,ki),Dl=new bs(an,ua,0,pr,ki),Ml=new bs(new Array(0),Zd,0,lo,Gd)},Bl=i=>{let e;for(e=0;e<pn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<pr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<lo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[uo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},ql=i=>{i.bi_valid>8?gn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},lc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},ws=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&lc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!lc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},uc=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?wt(i,n,e):(s=hn[n],wt(i,s+En+1,e),o=zs[s],o!==0&&(n-=po[s],He(i,n,o)),r--,s=Ul(r),wt(i,s,t),o=ua[s],o!==0&&(r-=Ta[s],He(i,r,o)));while(a<i.sym_next);wt(i,uo,e)},Ks=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,c=-1,l;for(i.heap_len=0,i.heap_max=Cl,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=c=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)l=i.heap[++i.heap_len]=c<2?++c:0,t[l*2]=1,i.depth[l]=0,i.opt_len--,n&&(i.static_len-=r[l*2+1]);for(e.max_code=c,s=i.heap_len>>1;s>=1;s--)ws(i,t,s);l=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],ws(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[l*2]=t[s*2]+t[o*2],i.depth[l]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=l,i.heap[1]=l++,ws(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Xd(i,e),jl(t,c,i.bl_count)},dc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)&&(o<l?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[Ll*2]++):o<=10?i.bl_tree[Nl*2]++:i.bl_tree[Rl*2]++,o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4))},pc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<c&&a===s)){if(o<l)do wt(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(wt(i,a,i.bl_tree),o--),wt(i,Ll,i.bl_tree),He(i,o-3,2)):o<=10?(wt(i,Nl,i.bl_tree),He(i,o-3,3)):(wt(i,Rl,i.bl_tree),He(i,o-11,7));o=0,n=a,s===0?(c=138,l=3):a===s?(c=6,l=3):(c=7,l=4)}},tp=i=>{let e;for(dc(i,i.dyn_ltree,i.l_desc.max_code),dc(i,i.dyn_dtree,i.d_desc.max_code),Ks(i,i.bl_desc),e=lo-1;e>=3&&i.bl_tree[Pl[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},ip=(i,e,t,r)=>{let n;for(He(i,e-257,5),He(i,t-1,5),He(i,r-4,4),n=0;n<r;n++)He(i,i.bl_tree[Pl[n]*2+1],3);pc(i,i.dyn_ltree,e-1),pc(i,i.dyn_dtree,t-1)},rp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return oc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return cc;for(t=32;t<En;t++)if(i.dyn_ltree[t*2]!==0)return cc;return oc},fc=!1,np=i=>{fc||(ep(),fc=!0),i.l_desc=new Ss(i.dyn_ltree,Ol),i.d_desc=new Ss(i.dyn_dtree,Dl),i.bl_desc=new Ss(i.bl_tree,Ml),i.bi_buf=0,i.bi_valid=0,Bl(i)},Vl=(i,e,t,r)=>{He(i,(zd<<1)+(r?1:0),3),ql(i),gn(i,t),gn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},ap=i=>{He(i,Tl<<1,3),wt(i,uo,Ot),Yd(i)},sp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===Hd&&(i.strm.data_type=rp(i)),Ks(i,i.l_desc),Ks(i,i.d_desc),s=tp(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Vl(i,e,t,r):i.strategy===Vd||a===n?(He(i,(Tl<<1)+(r?1:0),3),uc(i,Ot,an)):(He(i,(Kd<<1)+(r?1:0),3),ip(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),uc(i,i.dyn_ltree,i.dyn_dtree)),Bl(i),r&&ql(i)},op=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(hn[t]+En+1)*2]++,i.dyn_dtree[Ul(e)*2]++),i.sym_next===i.sym_end),cp=np,lp=Vl,up=sp,dp=op,pp=ap,fp={_tr_init:cp,_tr_stored_block:lp,_tr_flush_block:up,_tr_tally:dp,_tr_align:pp},hp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},mn=hp,gp=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},mp=new Uint32Array(gp()),yp=(i,e,t,r)=>{let n=mp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},_e=yp,Mi={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"},Ki={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:vp,_tr_stored_block:Ws,_tr_flush_block:bp,_tr_tally:Jt,_tr_align:Sp}=fp,{Z_NO_FLUSH:Yt,Z_PARTIAL_FLUSH:wp,Z_FULL_FLUSH:_p,Z_FINISH:at,Z_BLOCK:hc,Z_OK:ke,Z_STREAM_END:gc,Z_STREAM_ERROR:xt,Z_DATA_ERROR:Ep,Z_BUF_ERROR:_s,Z_DEFAULT_COMPRESSION:xp,Z_FILTERED:$p,Z_HUFFMAN_ONLY:Wn,Z_RLE:Ap,Z_FIXED:kp,Z_DEFAULT_STRATEGY:Ip,Z_UNKNOWN:Tp,Z_DEFLATED:Ha}=Ki,Cp=9,Lp=15,Np=8,Rp=29,Pp=256,Qs=Pp+1+Rp,Op=30,Dp=19,Mp=2*Qs+1,Up=15,Z=3,Wt=258,$t=Wt+Z+1,Fp=32,yr=42,fo=57,Gs=69,Zs=73,Js=91,Ys=103,Ii=113,Jr=666,Ue=1,Ar=2,Ui=3,kr=4,jp=3,Ti=(i,e)=>(i.msg=Mi[e],e),mc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},Bp=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},qp=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,Xt=qp,Qe=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Ze=(i,e)=>{bp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Qe(i.strm)},ie=(i,e)=>{i.pending_buf[i.pending++]=e},Dr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},Xs=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=mn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=_e(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Hl=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,c=i.strstart>i.w_size-$t?i.strstart-(i.w_size-$t):0,l=i.window,u=i.w_mask,y=i.prev,g=i.strstart+Wt,d=l[r+s-1],p=l[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(l[n+s]!==p||l[n+s-1]!==d||l[n]!==l[r]||l[++n]!==l[r+1])){r+=2,n++;do;while(l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&l[++r]===l[++n]&&r<g);if(a=Wt-(g-r),r=g-Wt,a>s){if(i.match_start=e,s=a,a>=o)break;d=l[r+s-1],p=l[r+s]}}while((e=y[e&u])>c&&--t!==0);return s<=i.lookahead?s:i.lookahead},vr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-$t)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),Bp(i),r+=e),i.strm.avail_in===0)break;if(t=Xs(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=Z)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=Xt(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=Xt(i,i.ins_h,i.window[n+Z-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<Z)););}while(i.lookahead<$t&&i.strm.avail_in!==0)},zl=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==at||e===Yt||r!==n+i.strm.avail_in)))break;s=e===at&&r===n+i.strm.avail_in?1:0,Ws(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Qe(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(Xs(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?kr:e!==Yt&&e!==at&&i.strm.avail_in===0&&i.strstart===i.block_start?Ar:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(Xs(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===at)&&e!==Yt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===at&&i.strm.avail_in===0&&r===n?1:0,Ws(i,i.block_start,r,s),i.block_start+=r,Qe(i.strm)),s?Ui:Ue)},Es=(i,e)=>{let t,r;for(;;){if(i.lookahead<$t){if(vr(i),i.lookahead<$t&&e===Yt)return Ue;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Xt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-$t&&(i.match_length=Hl(i,t)),i.match_length>=Z)if(r=Jt(i,i.strstart-i.match_start,i.match_length-Z),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Z){i.match_length--;do i.strstart++,i.ins_h=Xt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Xt(i,i.ins_h,i.window[i.strstart+1]);else r=Jt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(Ze(i,!1),i.strm.avail_out===0))return Ue}return i.insert=i.strstart<Z-1?i.strstart:Z-1,e===at?(Ze(i,!0),i.strm.avail_out===0?Ui:kr):i.sym_next&&(Ze(i,!1),i.strm.avail_out===0)?Ue:Ar},sr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<$t){if(vr(i),i.lookahead<$t&&e===Yt)return Ue;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Xt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Z-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-$t&&(i.match_length=Hl(i,t),i.match_length<=5&&(i.strategy===$p||i.match_length===Z&&i.strstart-i.match_start>4096)&&(i.match_length=Z-1)),i.prev_length>=Z&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-Z,r=Jt(i,i.strstart-1-i.prev_match,i.prev_length-Z),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=Xt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Z-1,i.strstart++,r&&(Ze(i,!1),i.strm.avail_out===0))return Ue}else if(i.match_available){if(r=Jt(i,0,i.window[i.strstart-1]),r&&Ze(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return Ue}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Jt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Z-1?i.strstart:Z-1,e===at?(Ze(i,!0),i.strm.avail_out===0?Ui:kr):i.sym_next&&(Ze(i,!1),i.strm.avail_out===0)?Ue:Ar},Vp=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Wt){if(vr(i),i.lookahead<=Wt&&e===Yt)return Ue;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Z&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Wt;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=Wt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Z?(t=Jt(i,1,i.match_length-Z),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Jt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(Ze(i,!1),i.strm.avail_out===0))return Ue}return i.insert=0,e===at?(Ze(i,!0),i.strm.avail_out===0?Ui:kr):i.sym_next&&(Ze(i,!1),i.strm.avail_out===0)?Ue:Ar},Hp=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(vr(i),i.lookahead===0)){if(e===Yt)return Ue;break}if(i.match_length=0,t=Jt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(Ze(i,!1),i.strm.avail_out===0))return Ue}return i.insert=0,e===at?(Ze(i,!0),i.strm.avail_out===0?Ui:kr):i.sym_next&&(Ze(i,!1),i.strm.avail_out===0)?Ue:Ar};function gt(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var Yr=[new gt(0,0,0,0,zl),new gt(4,4,8,4,Es),new gt(4,5,16,8,Es),new gt(4,6,32,32,Es),new gt(4,4,16,16,sr),new gt(8,16,32,32,sr),new gt(8,16,128,128,sr),new gt(8,32,128,256,sr),new gt(32,128,258,1024,sr),new gt(32,258,258,4096,sr)],zp=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=Yr[i.level].max_lazy,i.good_match=Yr[i.level].good_length,i.nice_match=Yr[i.level].nice_length,i.max_chain_length=Yr[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Z-1,i.match_available=0,i.ins_h=0};function Kp(){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=Ha,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(Mp*2),this.dyn_dtree=new Uint16Array((2*Op+1)*2),this.bl_tree=new Uint16Array((2*Dp+1)*2),Kt(this.dyn_ltree),Kt(this.dyn_dtree),Kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Up+1),this.heap=new Uint16Array(2*Qs+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Qs+1),Kt(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 xn=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==yr&&e.status!==fo&&e.status!==Gs&&e.status!==Zs&&e.status!==Js&&e.status!==Ys&&e.status!==Ii&&e.status!==Jr?1:0},Kl=i=>{if(xn(i))return Ti(i,xt);i.total_in=i.total_out=0,i.data_type=Tp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?fo:e.wrap?yr:Ii,i.adler=e.wrap===2?0:1,e.last_flush=-2,vp(e),ke},Wl=i=>{let e=Kl(i);return e===ke&&zp(i.state),e},Wp=(i,e)=>xn(i)||i.state.wrap!==2?xt:(i.state.gzhead=e,ke),Ql=(i,e,t,r,n,a)=>{if(!i)return xt;let s=1;if(e===xp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>Cp||t!==Ha||r<8||r>15||e<0||e>9||a<0||a>kp||r===8&&s!==1)return Ti(i,xt);r===8&&(r=9);let o=new Kp;return i.state=o,o.strm=i,o.status=yr,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Z-1)/Z),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,Wl(i)},Qp=(i,e)=>Ql(i,e,Ha,Lp,Np,Ip),Gp=(i,e)=>{if(xn(i)||e>hc||e<0)return i?Ti(i,xt):xt;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===Jr&&e!==at)return Ti(i,i.avail_out===0?_s:xt);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Qe(i),i.avail_out===0)return t.last_flush=-1,ke}else if(i.avail_in===0&&mc(e)<=mc(r)&&e!==at)return Ti(i,_s);if(t.status===Jr&&i.avail_in!==0)return Ti(i,_s);if(t.status===yr&&t.wrap===0&&(t.status=Ii),t.status===yr){let n=Ha+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Wn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Fp),n+=31-n%31,Dr(t,n),t.strstart!==0&&(Dr(t,i.adler>>>16),Dr(t,i.adler&65535)),i.adler=1,t.status=Ii,Qe(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===fo){if(i.adler=0,ie(t,31),ie(t,139),ie(t,8),t.gzhead)ie(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)),ie(t,t.gzhead.time&255),ie(t,t.gzhead.time>>8&255),ie(t,t.gzhead.time>>16&255),ie(t,t.gzhead.time>>24&255),ie(t,t.level===9?2:t.strategy>=Wn||t.level<2?4:0),ie(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ie(t,t.gzhead.extra.length&255),ie(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=_e(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Gs;else if(ie(t,0),ie(t,0),ie(t,0),ie(t,0),ie(t,0),ie(t,t.level===9?2:t.strategy>=Wn||t.level<2?4:0),ie(t,jp),t.status=Ii,Qe(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===Gs){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 o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Qe(i),t.pending!==0)return t.last_flush=-1,ke;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Zs}if(t.status===Zs){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n)),Qe(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ie(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Js}if(t.status===Js){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n)),Qe(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ie(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=_e(i.adler,t.pending_buf,t.pending-n,n))}t.status=Ys}if(t.status===Ys){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Qe(i),t.pending!==0))return t.last_flush=-1,ke;ie(t,i.adler&255),ie(t,i.adler>>8&255),i.adler=0}if(t.status=Ii,Qe(i),t.pending!==0)return t.last_flush=-1,ke}if(i.avail_in!==0||t.lookahead!==0||e!==Yt&&t.status!==Jr){let n=t.level===0?zl(t,e):t.strategy===Wn?Hp(t,e):t.strategy===Ap?Vp(t,e):Yr[t.level].func(t,e);if((n===Ui||n===kr)&&(t.status=Jr),n===Ue||n===Ui)return i.avail_out===0&&(t.last_flush=-1),ke;if(n===Ar&&(e===wp?Sp(t):e!==hc&&(Ws(t,0,0,!1),e===_p&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Qe(i),i.avail_out===0))return t.last_flush=-1,ke}return e!==at?ke:t.wrap<=0?gc:(t.wrap===2?(ie(t,i.adler&255),ie(t,i.adler>>8&255),ie(t,i.adler>>16&255),ie(t,i.adler>>24&255),ie(t,i.total_in&255),ie(t,i.total_in>>8&255),ie(t,i.total_in>>16&255),ie(t,i.total_in>>24&255)):(Dr(t,i.adler>>>16),Dr(t,i.adler&65535)),Qe(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ke:gc)},Zp=i=>{if(xn(i))return xt;let e=i.state.status;return i.state=null,e===Ii?Ti(i,Ep):ke},Jp=(i,e)=>{let t=e.length;if(xn(i))return xt;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==yr||r.lookahead)return xt;if(n===1&&(i.adler=mn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Kt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(e.subarray(t-r.w_size,t),0),e=c,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,vr(r);r.lookahead>=Z;){let c=r.strstart,l=r.lookahead-(Z-1);do r.ins_h=Xt(r,r.ins_h,r.window[c+Z-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--l);r.strstart=c,r.lookahead=Z-1,vr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Z-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,ke},Yp=Qp,Xp=Ql,ef=Wl,tf=Kl,rf=Wp,nf=Gp,af=Zp,sf=Jp,of="pako deflate (from Nodeca project)",sn={deflateInit:Yp,deflateInit2:Xp,deflateReset:ef,deflateResetKeep:tf,deflateSetHeader:rf,deflate:nf,deflateEnd:af,deflateSetDictionary:sf,deflateInfo:of},cf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),lf=function(i){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 r in t)cf(t,r)&&(i[r]=t[r])}}return i},uf=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},za={assign:lf,flattenChunks:uf},Gl=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){Gl=!1}var yn=new Uint8Array(256);for(let i=0;i<256;i++)yn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;yn[254]=yn[254]=1;var df=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-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},pf=(i,e)=>{if(e<65534&&i.subarray&&Gl)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},ff=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=yn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return pf(a,n)},hf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+yn[i[t]]>e?t:e},vn={string2buf:df,buf2string:ff,utf8border:hf};function gf(){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 Zl=gf,Jl=Object.prototype.toString,{Z_NO_FLUSH:mf,Z_SYNC_FLUSH:yf,Z_FULL_FLUSH:vf,Z_FINISH:bf,Z_OK:Ca,Z_STREAM_END:Sf,Z_DEFAULT_COMPRESSION:wf,Z_DEFAULT_STRATEGY:_f,Z_DEFLATED:Ef}=Ki;function $n(i){this.options=za.assign({level:wf,method:Ef,chunkSize:16384,windowBits:15,memLevel:8,strategy:_f},i||{});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 Zl,this.strm.avail_out=0;let t=sn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ca)throw new Error(Mi[t]);if(e.header&&sn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=vn.string2buf(e.dictionary):Jl.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=sn.deflateSetDictionary(this.strm,r),t!==Ca)throw new Error(Mi[t]);this._dict_set=!0}}$n.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?bf:mf,typeof i=="string"?t.input=vn.string2buf(i):Jl.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===yf||a===vf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=sn.deflate(t,a),n===Sf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=sn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ca;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};$n.prototype.onData=function(i){this.chunks.push(i)};$n.prototype.onEnd=function(i){i===Ca&&(this.result=za.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ho(i,e){let t=new $n(e);if(t.push(i,!0),t.err)throw t.msg||Mi[t.err];return t.result}function xf(i,e){return e=e||{},e.raw=!0,ho(i,e)}function $f(i,e){return e=e||{},e.gzip=!0,ho(i,e)}var Af=$n,kf=ho,If=xf,Tf=$f,Cf=Ki,Lf={Deflate:Af,deflate:kf,deflateRaw:If,gzip:Tf,constants:Cf},Qn=16209,Nf=16191,Rf=function i(e,t){let r,n,a,s,o,c,l,u,y,g,d,p,h,w,E,I,k,S,T,O,C,W,B,L,_=e.state;r=e.next_in,B=e.input,n=r+(e.avail_in-5),a=e.next_out,L=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),c=_.dmax,l=_.wsize,u=_.whave,y=_.wnext,g=_.window,d=_.hold,p=_.bits,h=_.lencode,w=_.distcode,E=(1<<_.lenbits)-1,I=(1<<_.distbits)-1;e:do{p<15&&(d+=B[r++]<<p,p+=8,d+=B[r++]<<p,p+=8),k=h[d&E];t:for(;;){if(S=k>>>24,d>>>=S,p-=S,S=k>>>16&255,S===0)L[a++]=k&65535;else if(S&16){T=k&65535,S&=15,S&&(p<S&&(d+=B[r++]<<p,p+=8),T+=d&(1<<S)-1,d>>>=S,p-=S),p<15&&(d+=B[r++]<<p,p+=8,d+=B[r++]<<p,p+=8),k=w[d&I];i:for(;;){if(S=k>>>24,d>>>=S,p-=S,S=k>>>16&255,S&16){if(O=k&65535,S&=15,p<S&&(d+=B[r++]<<p,p+=8,p<S&&(d+=B[r++]<<p,p+=8)),O+=d&(1<<S)-1,O>c){e.msg="invalid distance too far back",_.mode=Qn;break e}if(d>>>=S,p-=S,S=a-s,O>S){if(S=O-S,S>u&&_.sane){e.msg="invalid distance too far back",_.mode=Qn;break e}if(C=0,W=g,y===0){if(C+=l-S,S<T){T-=S;do L[a++]=g[C++];while(--S);C=a-O,W=L}}else if(y<S){if(C+=l+y-S,S-=y,S<T){T-=S;do L[a++]=g[C++];while(--S);if(C=0,y<T){S=y,T-=S;do L[a++]=g[C++];while(--S);C=a-O,W=L}}}else if(C+=y-S,S<T){T-=S;do L[a++]=g[C++];while(--S);C=a-O,W=L}for(;T>2;)L[a++]=W[C++],L[a++]=W[C++],L[a++]=W[C++],T-=3;T&&(L[a++]=W[C++],T>1&&(L[a++]=W[C++]))}else{C=a-O;do L[a++]=L[C++],L[a++]=L[C++],L[a++]=L[C++],T-=3;while(T>2);T&&(L[a++]=L[C++],T>1&&(L[a++]=L[C++]))}}else if((S&64)===0){k=w[(k&65535)+(d&(1<<S)-1)];continue i}else{e.msg="invalid distance code",_.mode=Qn;break e}break}}else if((S&64)===0){k=h[(k&65535)+(d&(1<<S)-1)];continue t}else if(S&32){_.mode=Nf;break e}else{e.msg="invalid literal/length code",_.mode=Qn;break e}break}}while(r<n&&a<o);T=p>>3,r-=T,p-=T<<3,d&=(1<<p)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),_.hold=d,_.bits=p},or=15,yc=852,vc=592,bc=0,xs=1,Sc=2,Pf=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]),Of=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]),Df=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]),Mf=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]),Uf=(i,e,t,r,n,a,s,o)=>{let c=o.bits,l=0,u=0,y=0,g=0,d=0,p=0,h=0,w=0,E=0,I=0,k,S,T,O,C,W=null,B,L=new Uint16Array(or+1),_=new Uint16Array(or+1),Ke=null,wo,In,Tn;for(l=0;l<=or;l++)L[l]=0;for(u=0;u<r;u++)L[e[t+u]]++;for(d=c,g=or;g>=1&&L[g]===0;g--);if(d>g&&(d=g),g===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(y=1;y<g&&L[y]===0;y++);for(d<y&&(d=y),w=1,l=1;l<=or;l++)if(w<<=1,w-=L[l],w<0)return-1;if(w>0&&(i===bc||g!==1))return-1;for(_[1]=0,l=1;l<or;l++)_[l+1]=_[l]+L[l];for(u=0;u<r;u++)e[t+u]!==0&&(s[_[e[t+u]]++]=u);if(i===bc?(W=Ke=s,B=20):i===xs?(W=Pf,Ke=Of,B=257):(W=Df,Ke=Mf,B=0),I=0,u=0,l=y,C=a,p=d,h=0,T=-1,E=1<<d,O=E-1,i===xs&&E>yc||i===Sc&&E>vc)return 1;for(;;){wo=l-h,s[u]+1<B?(In=0,Tn=s[u]):s[u]>=B?(In=Ke[s[u]-B],Tn=W[s[u]-B]):(In=32+64,Tn=0),k=1<<l-h,S=1<<p,y=S;do S-=k,n[C+(I>>h)+S]=wo<<24|In<<16|Tn|0;while(S!==0);for(k=1<<l-1;I&k;)k>>=1;if(k!==0?(I&=k-1,I+=k):I=0,u++,--L[l]===0){if(l===g)break;l=e[t+s[u]]}if(l>d&&(I&O)!==T){for(h===0&&(h=d),C+=y,p=l-h,w=1<<p;p+h<g&&(w-=L[p+h],!(w<=0));)p++,w<<=1;if(E+=1<<p,i===xs&&E>yc||i===Sc&&E>vc)return 1;T=I&O,n[T]=d<<24|p<<16|C-a|0}}return I!==0&&(n[C+I]=l-h<<24|64<<16|0),o.bits=d,0},on=Uf,Ff=0,Yl=1,Xl=2,{Z_FINISH:wc,Z_BLOCK:jf,Z_TREES:Gn,Z_OK:Fi,Z_STREAM_END:Bf,Z_NEED_DICT:qf,Z_STREAM_ERROR:st,Z_DATA_ERROR:eu,Z_MEM_ERROR:tu,Z_BUF_ERROR:Vf,Z_DEFLATED:_c}=Ki,Ka=16180,Ec=16181,xc=16182,$c=16183,Ac=16184,kc=16185,Ic=16186,Tc=16187,Cc=16188,Lc=16189,La=16190,Lt=16191,$s=16192,Nc=16193,As=16194,Rc=16195,Pc=16196,Oc=16197,Dc=16198,Zn=16199,Jn=16200,Mc=16201,Uc=16202,Fc=16203,jc=16204,Bc=16205,ks=16206,qc=16207,Vc=16208,le=16209,iu=16210,ru=16211,Hf=852,zf=592,Kf=15,Wf=Kf,Hc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Qf(){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 Wi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Ka||e.mode>ru?1:0},nu=i=>{if(Wi(i))return st;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Ka,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(Hf),e.distcode=e.distdyn=new Int32Array(zf),e.sane=1,e.back=-1,Fi},au=i=>{if(Wi(i))return st;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,nu(i)},su=(i,e)=>{let t;if(Wi(i))return st;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?st:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,au(i))},ou=(i,e)=>{if(!i)return st;let t=new Qf;i.state=t,t.strm=i,t.window=null,t.mode=Ka;let r=su(i,e);return r!==Fi&&(i.state=null),r},Gf=i=>ou(i,Wf),zc=!0,Is,Ts,Zf=i=>{if(zc){Is=new Int32Array(512),Ts=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(on(Yl,i.lens,0,288,Is,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;on(Xl,i.lens,0,32,Ts,0,i.work,{bits:5}),zc=!1}i.lencode=Is,i.lenbits=9,i.distcode=Ts,i.distbits=5},cu=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=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>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Jf=(i,e)=>{let t,r,n,a,s,o,c,l,u,y,g,d,p,h,w=0,E,I,k,S,T,O,C,W,B=new Uint8Array(4),L,_,Ke=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Wi(i)||!i.output||!i.input&&i.avail_in!==0)return st;t=i.state,t.mode===Lt&&(t.mode=$s),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,y=o,g=c,W=Fi;e:for(;;)switch(t.mode){case Ka:if(t.wrap===0){t.mode=$s;break}for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,B[0]=l&255,B[1]=l>>>8&255,t.check=_e(t.check,B,2,0),l=0,u=0,t.mode=Ec;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){i.msg="incorrect header check",t.mode=le;break}if((l&15)!==_c){i.msg="unknown compression method",t.mode=le;break}if(l>>>=4,u-=4,C=(l&15)+8,t.wbits===0&&(t.wbits=C),C>15||C>t.wbits){i.msg="invalid window size",t.mode=le;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=l&512?Lc:Lt,l=0,u=0;break;case Ec:for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==_c){i.msg="unknown compression method",t.mode=le;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=le;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(B[0]=l&255,B[1]=l>>>8&255,t.check=_e(t.check,B,2,0)),l=0,u=0,t.mode=xc;case xc:for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(B[0]=l&255,B[1]=l>>>8&255,B[2]=l>>>16&255,B[3]=l>>>24&255,t.check=_e(t.check,B,4,0)),l=0,u=0,t.mode=$c;case $c:for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(B[0]=l&255,B[1]=l>>>8&255,t.check=_e(t.check,B,2,0)),l=0,u=0,t.mode=Ac;case Ac:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(B[0]=l&255,B[1]=l>>>8&255,t.check=_e(t.check,B,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=kc;case kc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(C=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),C)),t.flags&512&&t.wrap&4&&(t.check=_e(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Ic;case Ic:if(t.flags&2048){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.name+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=_e(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Tc;case Tc:if(t.flags&4096){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.comment+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=_e(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.comment=null);t.mode=Cc;case Cc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){i.msg="header crc mismatch",t.mode=le;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Lt;break;case Lc:for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}i.adler=t.check=Hc(l),l=0,u=0,t.mode=La;case La:if(t.havedict===0)return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,qf;i.adler=t.check=1,t.mode=Lt;case Lt:if(e===jf||e===Gn)break e;case $s:if(t.last){l>>>=u&7,u-=u&7,t.mode=ks;break}for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Nc;break;case 1:if(Zf(t),t.mode=Zn,e===Gn){l>>>=2,u-=2;break e}break;case 2:t.mode=Pc;break;case 3:i.msg="invalid block type",t.mode=le}l>>>=2,u-=2;break;case Nc:for(l>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){i.msg="invalid stored block lengths",t.mode=le;break}if(t.length=l&65535,l=0,u=0,t.mode=As,e===Gn)break e;case As:t.mode=Rc;case Rc:if(d=t.length,d){if(d>o&&(d=o),d>c&&(d=c),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,c-=d,s+=d,t.length-=d;break}t.mode=Lt;break;case Pc:for(;u<14;){if(o===0)break e;o--,l+=r[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){i.msg="too many length or distance symbols",t.mode=le;break}t.have=0,t.mode=Oc;case Oc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}t.lens[Ke[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[Ke[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,L={bits:t.lenbits},W=on(Ff,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,W){i.msg="invalid code lengths set",t.mode=le;break}t.have=0,t.mode=Dc;case Dc:for(;t.have<t.nlen+t.ndist;){for(;w=t.lencode[l&(1<<t.lenbits)-1],E=w>>>24,I=w>>>16&255,k=w&65535,!(E<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(k<16)l>>>=E,u-=E,t.lens[t.have++]=k;else{if(k===16){for(_=E+2;u<_;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(l>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=le;break}C=t.lens[t.have-1],d=3+(l&3),l>>>=2,u-=2}else if(k===17){for(_=E+3;u<_;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=E,u-=E,C=0,d=3+(l&7),l>>>=3,u-=3}else{for(_=E+7;u<_;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=E,u-=E,C=0,d=11+(l&127),l>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=le;break}for(;d--;)t.lens[t.have++]=C}}if(t.mode===le)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=le;break}if(t.lenbits=9,L={bits:t.lenbits},W=on(Yl,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,W){i.msg="invalid literal/lengths set",t.mode=le;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},W=on(Xl,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,W){i.msg="invalid distances set",t.mode=le;break}if(t.mode=Zn,e===Gn)break e;case Zn:t.mode=Jn;case Jn:if(o>=6&&c>=258){i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,Rf(i,g),s=i.next_out,n=i.output,c=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,l=t.hold,u=t.bits,t.mode===Lt&&(t.back=-1);break}for(t.back=0;w=t.lencode[l&(1<<t.lenbits)-1],E=w>>>24,I=w>>>16&255,k=w&65535,!(E<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(I&&(I&240)===0){for(S=E,T=I,O=k;w=t.lencode[O+((l&(1<<S+T)-1)>>S)],E=w>>>24,I=w>>>16&255,k=w&65535,!(S+E<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=S,u-=S,t.back+=S}if(l>>>=E,u-=E,t.back+=E,t.length=k,I===0){t.mode=Bc;break}if(I&32){t.back=-1,t.mode=Lt;break}if(I&64){i.msg="invalid literal/length code",t.mode=le;break}t.extra=I&15,t.mode=Mc;case Mc:if(t.extra){for(_=t.extra;u<_;){if(o===0)break e;o--,l+=r[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=Uc;case Uc:for(;w=t.distcode[l&(1<<t.distbits)-1],E=w>>>24,I=w>>>16&255,k=w&65535,!(E<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if((I&240)===0){for(S=E,T=I,O=k;w=t.distcode[O+((l&(1<<S+T)-1)>>S)],E=w>>>24,I=w>>>16&255,k=w&65535,!(S+E<=u);){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}l>>>=S,u-=S,t.back+=S}if(l>>>=E,u-=E,t.back+=E,I&64){i.msg="invalid distance code",t.mode=le;break}t.offset=k,t.extra=I&15,t.mode=Fc;case Fc:if(t.extra){for(_=t.extra;u<_;){if(o===0)break e;o--,l+=r[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){i.msg="invalid distance too far back",t.mode=le;break}t.mode=jc;case jc:if(c===0)break e;if(d=g-c,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=le;break}d>t.wnext?(d-=t.wnext,p=t.wsize-d):p=t.wnext-d,d>t.length&&(d=t.length),h=t.window}else h=n,p=s-t.offset,d=t.length;d>c&&(d=c),c-=d,t.length-=d;do n[s++]=h[p++];while(--d);t.length===0&&(t.mode=Jn);break;case Bc:if(c===0)break e;n[s++]=t.length,c--,t.mode=Jn;break;case ks:if(t.wrap){for(;u<32;){if(o===0)break e;o--,l|=r[a++]<<u,u+=8}if(g-=c,i.total_out+=g,t.total+=g,t.wrap&4&&g&&(i.adler=t.check=t.flags?_e(t.check,n,g,s-g):mn(t.check,n,g,s-g)),g=c,t.wrap&4&&(t.flags?l:Hc(l))!==t.check){i.msg="incorrect data check",t.mode=le;break}l=0,u=0}t.mode=qc;case qc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,l+=r[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=le;break}l=0,u=0}t.mode=Vc;case Vc:W=Bf;break e;case le:W=eu;break e;case iu:return tu;case ru:default:return st}return i.next_out=s,i.avail_out=c,i.next_in=a,i.avail_in=o,t.hold=l,t.bits=u,(t.wsize||g!==i.avail_out&&t.mode<le&&(t.mode<ks||e!==wc))&&cu(i,i.output,i.next_out,g-i.avail_out),y-=i.avail_in,g-=i.avail_out,i.total_in+=y,i.total_out+=g,t.total+=g,t.wrap&4&&g&&(i.adler=t.check=t.flags?_e(t.check,n,g,i.next_out-g):mn(t.check,n,g,i.next_out-g)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Lt?128:0)+(t.mode===Zn||t.mode===As?256:0),(y===0&&g===0||e===wc)&&W===Fi&&(W=Vf),W},Yf=i=>{if(Wi(i))return st;let e=i.state;return e.window&&(e.window=null),i.state=null,Fi},Xf=(i,e)=>{if(Wi(i))return st;let t=i.state;return(t.wrap&2)===0?st:(t.head=e,e.done=!1,Fi)},eh=(i,e)=>{let t=e.length,r,n,a;return Wi(i)||(r=i.state,r.wrap!==0&&r.mode!==La)?st:r.mode===La&&(n=1,n=mn(n,e,t,0),n!==r.check)?eu:(a=cu(i,e,t,t),a?(r.mode=iu,tu):(r.havedict=1,Fi))},th=au,ih=su,rh=nu,nh=Gf,ah=ou,sh=Jf,oh=Yf,ch=Xf,lh=eh,uh="pako inflate (from Nodeca project)",Dt={inflateReset:th,inflateReset2:ih,inflateResetKeep:rh,inflateInit:nh,inflateInit2:ah,inflate:sh,inflateEnd:oh,inflateGetHeader:ch,inflateSetDictionary:lh,inflateInfo:uh};function dh(){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 ph=dh,lu=Object.prototype.toString,{Z_NO_FLUSH:fh,Z_FINISH:hh,Z_OK:bn,Z_STREAM_END:Cs,Z_NEED_DICT:Ls,Z_STREAM_ERROR:gh,Z_DATA_ERROR:Kc,Z_MEM_ERROR:mh}=Ki;function An(i){this.options=za.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});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&&!(i&&i.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 Zl,this.strm.avail_out=0;let t=Dt.inflateInit2(this.strm,e.windowBits);if(t!==bn)throw new Error(Mi[t]);if(this.header=new ph,Dt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=vn.string2buf(e.dictionary):lu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Dt.inflateSetDictionary(this.strm,e.dictionary),t!==bn)))throw new Error(Mi[t])}An.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?hh:fh,lu.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Dt.inflate(t,s),a===Ls&&n&&(a=Dt.inflateSetDictionary(t,n),a===bn?a=Dt.inflate(t,s):a===Kc&&(a=Ls));t.avail_in>0&&a===Cs&&t.state.wrap>0&&i[t.next_in]!==0;)Dt.inflateReset(t),a=Dt.inflate(t,s);switch(a){case gh:case Kc:case Ls:case mh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Cs))if(this.options.to==="string"){let c=vn.utf8border(t.output,t.next_out),l=t.next_out-c,u=vn.buf2string(t.output,c);t.next_out=l,t.avail_out=r-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===bn&&o===0)){if(a===Cs)return a=Dt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};An.prototype.onData=function(i){this.chunks.push(i)};An.prototype.onEnd=function(i){i===bn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=za.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function go(i,e){let t=new An(e);if(t.push(i),t.err)throw t.msg||Mi[t.err];return t.result}function yh(i,e){return e=e||{},e.raw=!0,go(i,e)}var vh=An,bh=go,Sh=yh,wh=go,_h=Ki,Eh={Inflate:vh,inflate:bh,inflateRaw:Sh,ungzip:wh,constants:_h},{Deflate:xh,deflate:$h,deflateRaw:Ah,gzip:kh}=Lf,{Inflate:Ih,inflate:Th,inflateRaw:Ch,ungzip:Lh}=Eh,Nh=xh,Rh=$h,Ph=Ah,Oh=kh,Dh=Ih,Mh=Th,Uh=Ch,Fh=Lh,jh=Ki,Bh={Deflate:Nh,deflate:Rh,deflateRaw:Ph,gzip:Oh,Inflate:Dh,inflate:Mh,inflateRaw:Uh,ungzip:Fh,constants:jh},se=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},oe=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Na=class{constructor(e,t){this.input=e,this.output=t}};se([f(),oe("design:type",String)],Na.prototype,"input",void 0);se([f(),oe("design:type",String)],Na.prototype,"output",void 0);Na=se([xe(),oe("design:paramtypes",[String,String])],Na);var Ra=class{constructor(e,t){this.input=e,this.output=t}};se([f(),oe("design:type",String)],Ra.prototype,"input",void 0);se([f(),oe("design:type",String)],Ra.prototype,"output",void 0);Ra=se([q(),oe("design:paramtypes",[String,String])],Ra);var ri=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};se([f(),oe("design:type",String)],ri.prototype,"name",void 0);se([f(),oe("design:type",String)],ri.prototype,"modelId",void 0);se([f(),oe("design:type",String)],ri.prototype,"systemPrompt",void 0);se([f(),oe("design:type",Array)],ri.prototype,"promptExamples",void 0);se([f(),oe("design:type",String)],ri.prototype,"metaData",void 0);ri=se([xe(),oe("design:paramtypes",[String,String,String,Array,String])],ri);var It=class{constructor(e,t,r,n,a,s,o,c){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=c}};se([f(),oe("design:type",String)],It.prototype,"name",void 0);se([f(),oe("design:type",String)],It.prototype,"modelId",void 0);se([f(),oe("design:type",String)],It.prototype,"taskId",void 0);se([f(),oe("design:type",String)],It.prototype,"systemPrompt",void 0);se([f(),oe("design:type",Array)],It.prototype,"promptExamples",void 0);se([f(),oe("design:type",String)],It.prototype,"metaData",void 0);se([f(),oe("design:type",String)],It.prototype,"createdAt",void 0);se([f(),oe("design:type",String)],It.prototype,"updatedAt",void 0);It=se([q(),oe("design:paramtypes",[String,String,String,String,Array,String,String,String])],It);var ji=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};se([f(),oe("design:type",String)],ji.prototype,"model",void 0);se([f(),oe("design:type",String)],ji.prototype,"status",void 0);se([f(),oe("design:type",Number)],ji.prototype,"progress",void 0);se([f(),oe("design:type",Boolean)],ji.prototype,"downloaded",void 0);se([f(),oe("design:type",Boolean)],ji.prototype,"loaded",void 0);ji=se([q(),oe("design:paramtypes",[String,String,Number,Boolean,Boolean])],ji);var qh=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},be=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ye,da,eo=class{constructor(e,t=!0){ye.set(this,void 0),da.set(this,new Map),qh(this,ye,e,"f")}async getModels(){let e=await be(this,ye,"f").query({query:v`
1150
1172
  query {
1151
1173
  aiGetModels {
1152
1174
  id
@@ -1170,23 +1192,23 @@ triggerMatch
1170
1192
  modelType
1171
1193
  }
1172
1194
  }
1173
- `});return S(e).aiGetModels}async addModel(e){let t=await we(this,be,"f").mutate({mutation:v`
1195
+ `});return b(e).aiGetModels}async addModel(e){let t=await be(this,ye,"f").mutate({mutation:v`
1174
1196
  mutation($model: ModelInput!) {
1175
1197
  aiAddModel(model: $model)
1176
1198
  }
1177
- `,variables:{model:e}});return S(t).aiAddModel}async updateModel(e,t){let r=await we(this,be,"f").mutate({mutation:v`
1199
+ `,variables:{model:e}});return b(t).aiAddModel}async updateModel(e,t){let r=await be(this,ye,"f").mutate({mutation:v`
1178
1200
  mutation($modelId: String!, $model: ModelInput!) {
1179
1201
  aiUpdateModel(modelId: $modelId, model: $model)
1180
1202
  }
1181
- `,variables:{modelId:e,model:t}});return S(r).aiUpdateModel}async removeModel(e){let t=await we(this,be,"f").mutate({mutation:v`
1203
+ `,variables:{modelId:e,model:t}});return b(r).aiUpdateModel}async removeModel(e){let t=await be(this,ye,"f").mutate({mutation:v`
1182
1204
  mutation($modelId: String!) {
1183
1205
  aiRemoveModel(modelId: $modelId)
1184
1206
  }
1185
- `,variables:{modelId:e}});return S(t).aiRemoveModel}async setDefaultModel(e,t){let r=await we(this,be,"f").mutate({mutation:v`
1207
+ `,variables:{modelId:e}});return b(t).aiRemoveModel}async setDefaultModel(e,t){let r=await be(this,ye,"f").mutate({mutation:v`
1186
1208
  mutation($modelType: ModelType!, $modelId: String!) {
1187
1209
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
1188
1210
  }
1189
- `,variables:{modelId:t,modelType:e}});return S(r).aiSetDefaultModel}async getDefaultModel(e){let t=await we(this,be,"f").query({query:v`
1211
+ `,variables:{modelId:t,modelType:e}});return b(r).aiSetDefaultModel}async getDefaultModel(e){let t=await be(this,ye,"f").query({query:v`
1190
1212
  query($modelType: ModelType!) {
1191
1213
  aiGetDefaultModel(modelType: $modelType) {
1192
1214
  id
@@ -1210,7 +1232,7 @@ triggerMatch
1210
1232
  modelType
1211
1233
  }
1212
1234
  }
1213
- `,variables:{modelType:e}});return S(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=S(await we(this,be,"f").query({query:v`
1235
+ `,variables:{modelType:e}});return b(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=b(await be(this,ye,"f").query({query:v`
1214
1236
  query {
1215
1237
  aiTasks {
1216
1238
  name
@@ -1226,7 +1248,7 @@ triggerMatch
1226
1248
  updatedAt
1227
1249
  }
1228
1250
  }
1229
- `}));return e}async addTask(e,t,r,n,a){let s=new ni(e,t,r,n,a),{aiAddTask:o}=S(await we(this,be,"f").mutate({mutation:v`
1251
+ `}));return e}async addTask(e,t,r,n,a){let s=new ri(e,t,r,n,a),{aiAddTask:o}=b(await be(this,ye,"f").mutate({mutation:v`
1230
1252
  mutation AiAddTask($task: AITaskInput!) {
1231
1253
  aiAddTask(task: $task) {
1232
1254
  name
@@ -1242,7 +1264,7 @@ triggerMatch
1242
1264
  updatedAt
1243
1265
  }
1244
1266
  }
1245
- `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=S(await we(this,be,"f").mutate({mutation:v`
1267
+ `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=b(await be(this,ye,"f").mutate({mutation:v`
1246
1268
  mutation AiRemoveTask($taskId: String!) {
1247
1269
  aiRemoveTask(taskId: $taskId) {
1248
1270
  name
@@ -1258,7 +1280,7 @@ triggerMatch
1258
1280
  updatedAt
1259
1281
  }
1260
1282
  }
1261
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=S(await we(this,be,"f").mutate({mutation:v`
1283
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=b(await be(this,ye,"f").mutate({mutation:v`
1262
1284
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
1263
1285
  aiUpdateTask(taskId: $taskId, task: $task) {
1264
1286
  name
@@ -1274,7 +1296,7 @@ triggerMatch
1274
1296
  updatedAt
1275
1297
  }
1276
1298
  }
1277
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=S(await we(this,be,"f").query({query:v`
1299
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=b(await be(this,ye,"f").query({query:v`
1278
1300
  query AiModelLoadingStatus($model: String!) {
1279
1301
  aiModelLoadingStatus(model: $model) {
1280
1302
  model
@@ -1284,52 +1306,29 @@ triggerMatch
1284
1306
  downloaded
1285
1307
  }
1286
1308
  }
1287
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=S(await we(this,be,"f").mutate({mutation:v`
1309
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=b(await be(this,ye,"f").mutate({mutation:v`
1288
1310
  mutation AiPrompt($taskId: String!, $prompt: String!) {
1289
1311
  aiPrompt(taskId: $taskId, prompt: $prompt)
1290
1312
  }
1291
- `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=S(await we(this,be,"f").mutate({mutation:v`
1313
+ `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=b(await be(this,ye,"f").mutate({mutation:v`
1292
1314
  mutation aiEmbed($modelId: String!, $text: String!) {
1293
1315
  aiEmbed(modelId: $modelId, text: $text)
1294
1316
  }
1295
- `,variables:{modelId:e,text:t}})),n=Va.toByteArray(r);return JSON.parse(Dh.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=S(await we(this,be,"f").mutate({mutation:v`
1317
+ `,variables:{modelId:e,text:t}})),n=Va.toByteArray(r);return JSON.parse(Bh.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=b(await be(this,ye,"f").mutate({mutation:v`
1296
1318
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
1297
1319
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
1298
1320
  }
1299
- `,variables:{modelId:e,params:r}})),a=we(this,be,"f").subscribe({query:v` subscription {
1321
+ `,variables:{modelId:e,params:r}})),a=be(this,ye,"f").subscribe({query:v` subscription {
1300
1322
  aiTranscriptionText(streamId: "${n}")
1301
- }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return we(this,da,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=S(await we(this,be,"f").mutate({mutation:v`
1323
+ }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return be(this,da,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=b(await be(this,ye,"f").mutate({mutation:v`
1302
1324
  mutation aiCloseTranscriptionStream($streamId: String!) {
1303
1325
  aiCloseTranscriptionStream(streamId: $streamId)
1304
1326
  }
1305
- `,variables:{streamId:e}})),r=we(this,da,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=S(await we(this,be,"f").mutate({mutation:v`
1327
+ `,variables:{streamId:e}})),r=be(this,da,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=b(await be(this,ye,"f").mutate({mutation:v`
1306
1328
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
1307
1329
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
1308
1330
  }
1309
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};be=new WeakMap,da=new WeakMap;var Vt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ve=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},St,pa,tn,fa,rn,$i,ha,nn,Hc=class{constructor(e,t=!0){St.set(this,void 0),pa.set(this,void 0),tn.set(this,void 0),fa.set(this,void 0),rn.set(this,void 0),$i.set(this,void 0),ha.set(this,void 0),nn.set(this,void 0),Vt(this,St,e,"f"),Vt(this,pa,new pn(ve(this,St,"f"),t),"f"),Vt(this,tn,new zs(ve(this,St,"f")),"f"),Vt(this,fa,new js(ve(this,St,"f")),"f"),Vt(this,rn,new qs(ve(this,St,"f")),"f"),Vt(this,nn,new eo(ve(this,St,"f"),t),"f"),Vt(this,$i,new Ca(ve(this,St,"f"),t),"f"),ve(this,$i,"f").setExpressionClient(ve(this,tn,"f")),ve(this,$i,"f").setNeighbourhoodClient(ve(this,rn,"f")),ve(this,$i,"f").setAIClient(ve(this,nn,"f")),Vt(this,ha,new Vs(ve(this,St,"f"),t),"f")}get agent(){return ve(this,pa,"f")}get expression(){return ve(this,tn,"f")}get languages(){return ve(this,fa,"f")}get neighbourhood(){return ve(this,rn,"f")}get perspective(){return ve(this,$i,"f")}get runtime(){return ve(this,ha,"f")}get ai(){return ve(this,nn,"f")}};St=new WeakMap,pa=new WeakMap,tn=new WeakMap,fa=new WeakMap,rn=new WeakMap,$i=new WeakMap,ha=new WeakMap,nn=new WeakMap;var to;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(to||(to={}));var yo=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},vo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Li=class{constructor(e,t){this.language=e,this.expression=t}};yo([h(),vo("design:type",Et)],Li.prototype,"language",void 0);yo([h(),vo("design:type",String)],Li.prototype,"expression",void 0);Li=yo([q(),vo("design:paramtypes",[Et,String])],Li);function _y(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function Ey(i){if(i.startsWith("literal://")){let a=new Et;a.address="literal",a.name="literal";let s=i.substring(10);return new Li(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new Et;return o.address=a,new Li(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new Et;return a.address="did",new Li(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var nt=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Tt=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Da=class{};nt([h(),Tt("design:type",String)],Da.prototype,"name",void 0);nt([h(),Tt("design:type",String)],Da.prototype,"type",void 0);Da=nt([q()],Da);var wn=class{};nt([h(),Tt("design:type",String)],wn.prototype,"label",void 0);nt([h(),Tt("design:type",String)],wn.prototype,"name",void 0);nt([h(),Tt("design:type",Array)],wn.prototype,"parameters",void 0);wn=nt([q()],wn);var Ua=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};nt([h(),Tt("design:type",String)],Ua.prototype,"name",void 0);nt([h(),Tt("design:type",String)],Ua.prototype,"parametersStringified",void 0);Ua=nt([Ie(),Tt("design:paramtypes",[String,Object])],Ua);var Ma=class{};nt([h(),Tt("design:type",String)],Ma.prototype,"did",void 0);nt([h(),Tt("design:type",Di)],Ma.prototype,"status",void 0);Ma=nt([q()],Ma);var Kc=class{},Gi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Cr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ai=class{};Gi([h(),Cr("design:type",String)],ai.prototype,"name",void 0);Gi([h(),Cr("design:type",String)],ai.prototype,"address",void 0);Gi([h(),Cr("design:type",String)],ai.prototype,"settings",void 0);Gi([h(),Cr("design:type",Ri)],ai.prototype,"icon",void 0);Gi([h(),Cr("design:type",Ri)],ai.prototype,"constructorIcon",void 0);Gi([h(),Cr("design:type",Ri)],ai.prototype,"settingsIcon",void 0);ai=Gi([q()],ai);var ze=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ge=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ht=class{};ze([h(),Ge("design:type",String)],ht.prototype,"name",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"address",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"description",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"author",void 0);ze([h(),Ge("design:type",Boolean)],ht.prototype,"templated",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"templateSourceLanguageAddress",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"templateAppliedParams",void 0);ze([h(),Ge("design:type",Array)],ht.prototype,"possibleTemplateParams",void 0);ze([h(),Ge("design:type",String)],ht.prototype,"sourceCodeLink",void 0);ht=ze([q()],ht);var wr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ze([h(),Ge("design:type",String)],wr.prototype,"name",void 0);ze([h(),Ge("design:type",String)],wr.prototype,"description",void 0);ze([h(),Ge("design:type",Array)],wr.prototype,"possibleTemplateParams",void 0);ze([h(),Ge("design:type",String)],wr.prototype,"sourceCodeLink",void 0);wr=ze([Ie(),Ge("design:paramtypes",[String,String])],wr);var Wc=class{},Qc=class extends ci(){},Gc=class{},Wa=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Wa([h(),bo("design:type",String)],Fa.prototype,"linkLanguage",void 0);Wa([h(),bo("design:type",At)],Fa.prototype,"meta",void 0);Fa=Wa([q(),bo("design:paramtypes",[String,At])],Fa);var io=class extends ci(){};io=Wa([q()],io);var Zi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ji=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ro;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(ro||(ro={}));var si=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=ro.Private}};Zi([h(),Ji("design:type",String)],si.prototype,"uuid",void 0);Zi([h(),Ji("design:type",String)],si.prototype,"name",void 0);Zi([h(),Ji("design:type",String)],si.prototype,"state",void 0);Zi([h(),Ji("design:type",String)],si.prototype,"sharedUrl",void 0);Zi([h(),Ji("design:type",io)],si.prototype,"neighbourhood",void 0);Zi([h(),Ji("design:type",Array)],si.prototype,"owners",void 0);si=Zi([q(),Ji("design:paramtypes",[String,String,String])],si);var Qa=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ou=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ba=class{};Qa([h(),ou("design:type",Array)],Ba.prototype,"additions",void 0);Qa([h(),ou("design:type",Array)],Ba.prototype,"removals",void 0);Ba=Qa([q()],Ba);var Zc=class extends ci(){};Zc=Qa([q()],Zc);var Jc=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},lr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},an,Ai,Yn="smart_literal://content";function Mh(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var _n=class{constructor(e,t){an.set(this,void 0),Ai.set(this,void 0),Jc(this,an,e,"f"),Jc(this,Ai,t,"f")}get base(){return lr(this,Ai,"f")}static async create(e,t){let r=ae.from(Mh(10)).toUrl(),n=new _n(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new se({source:t,predicate:Yn}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new se({predicate:Yn}))).map(r=>new _n(e,r.data.source))}async get(){let e=await lr(this,an,"f").getSingleTarget(new se({source:lr(this,Ai,"f"),predicate:Yn}));if(!e)throw`No content for smart literal ${lr(this,Ai,"f")}`;return ae.fromUrl(e).get()}async set(e){let t=ae.from(e);await lr(this,an,"f").setSingleTarget(new Ye({source:lr(this,Ai,"f"),predicate:Yn,target:t.toUrl()}))}};an=new WeakMap,Ai=new WeakMap;var Yc=class{};function Dy(i,e,t){return{action:"addLink",source:i,predicate:e,target:t}}function Uy(i){return`triple(this, "${i}", _)`}function My(i){return function(e,t,r){if(typeof r.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");r.value=async function(a){let s=[],o=e.name,c=`subject_class("${o}", C), instance(C, Instance)`;if(i&&i.where)for(let u in i.where){let m=i.where[u];c+=`, property_getter(C, Instance, "${u}", "${m}")`}i&&i.prologCondition&&(c+=", "+i.prologCondition);try{let u=await a.infer(c);if(u&&u!==!1&&typeof u!="string"&&u.length>0){for(let m of u){let p=m.Instance,d=new fr(a,p,o);await d.init(),s.push(d)}return s}}catch{}let l=await a.getAllSubjectInstances(e);if(i&&i.where){let u=[];for(let m of l){let p=!0;for(let d in i.where){let f=i.where[d];if(await m[d]!==f){p=!1;break}}p&&u.push(m)}return u}return l}}}function cu(i){return function(e,t){if(typeof i.writable>"u"&&i.through&&(i.writable=!0),i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...i},i.writable){let r=t;e[`set${Zt(r)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Fy(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.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:i.through,required:!0,initial:i.value,flag:!0},e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function By(i){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=i;let r=t;e[`add${Zt(r)}`]=()=>{},e[`remove${Zt(r)}`]=()=>{},e[`setCollection${Zt(r)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function lu(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function Fh(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){let t="",r=i.name,n=e.prototype,a=lu(8);t+=`subject_class("${r}", ${a}).
1310
- `;let s=[],o=[];n.subjectConstructor&&n.subjectConstructor.length&&(o=o.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let l=[],u=n.__properties||{};for(let f in u){let y=`property(${a}, "${f}").
1311
- `,{through:$,initial:A,required:T,resolveLanguage:N,writable:x,flag:C,prologGetter:D,prologSetter:I,local:W}=u[f];if(N&&(y+=`property_resolve(${a}, "${f}").
1312
- `,y+=`property_resolve_language(${a}, "${f}", "${N}").
1313
- `),D?y+=`property_getter(${a}, Base, "${f}", Value) :- ${D}.
1314
- `:$&&(y+=`property_getter(${a}, Base, "${f}", Value) :- triple(Base, "${$}", Value).
1315
- `,T&&(C?c.push(`triple(Base, "${$}", "${A}")`):c.push(`triple(Base, "${$}", _)`))),I)y+=`property_setter(${a}, "${f}", Actions) :- ${I}.
1316
- `;else if(x&&$&&typeof n[ka(f)]=="function"){let k=[{action:"setSingleTarget",source:"this",predicate:$,target:"value",...W&&{local:!0}}];y+=`property_setter(${a}, "${f}", '${vi(k)}').
1317
- `}l.push(y),A&&(o.push({action:"addLink",source:"this",predicate:$,target:A}),s.push({action:"removeLink",source:"this",predicate:$,target:"*"}))}let m=[],p=n.__collections||{};for(let f in p){let y=`collection(${a}, "${f}").
1318
- `,{through:$,where:A,local:T}=p[f];if($){if(A){if(!A.isInstance&&!A.prologCondition&&!A.condition)throw"'where' needs one of 'isInstance', 'prologCondition', or 'condition'";let D=[];if(A.isInstance){let I;A.isInstance.name?I=A.isInstance.name:I=A.isInstance,D.push(`instance(OtherClass, Target), subject_class("${I}", OtherClass)`)}if(A.prologCondition&&D.push(A.prologCondition),D.length>0){let I=D.join(", ");y+=`collection_getter(${a}, Base, "${f}", List) :- setof(Target, (triple(Base, "${$}", Target), ${I}), List).
1319
- `}else y+=`collection_getter(${a}, Base, "${f}", List) :- findall(C, triple(Base, "${$}", C), List).
1320
- `}else y+=`collection_getter(${a}, Base, "${f}", List) :- findall(C, triple(Base, "${$}", C), List).
1321
- `;let N=[{action:"addLink",source:"this",predicate:$,target:"value",...T&&{local:!0}}],x=[{action:"removeLink",source:"this",predicate:$,target:"value"}],C=[{action:"collectionSetter",source:"this",predicate:$,target:"value",...T&&{local:!0}}];y+=`collection_adder(${a}, "${f}", '${vi(N)}').
1322
- `,y+=`collection_remover(${a}, "${f}", '${vi(x)}').
1323
- `,y+=`collection_setter(${a}, "${f}", '${vi(C)}').
1324
- `}m.push(y)}let d=vi(o);if(t+=`constructor(${a}, '${d}').
1325
- `,c.length>0){let f=c.join(", ");t+=`instance(${a}, Base) :- ${f}.
1326
- `,t+=`
1327
- `}return t+=`destructor(${a}, '${vi(s)}').
1328
- `,t+=`
1329
- `,t+=l.join(`
1330
- `),t+=`
1331
- `,t+=m.join(`
1332
- `),{sdna:t,name:r}},e.generateSHACL=function(){let t=i.name,r=e.prototype,n="ad4m://",a=r.__properties||{},s=r.__collections||{};if(Object.keys(a).length>0){let p=a[Object.keys(a)[0]];if(p.through){let d=p.through.match(/^([^:]+:\/\/)/);d&&(n=d[1])}}else if(Object.keys(s).length>0){let p=s[Object.keys(s)[0]];if(p.through){let d=p.through.match(/^([^:]+:\/\/)/);d&&(n=d[1])}}let o=`${n}${t}Shape`,c=`${n}${t}`,l=new Jt(o,c),u=[];r.subjectConstructor&&r.subjectConstructor.length&&(u=u.concat(r.subjectConstructor));let m=[];for(let p in a){let d=a[p];if(!d.through)continue;let f={name:p,path:d.through};if(d.resolveLanguage==="literal")f.datatype="xsd://string";else if(d.initial){let y=typeof r[p];y==="number"?f.datatype="xsd://integer":y==="boolean"?f.datatype="xsd://boolean":y==="string"&&(f.datatype="xsd://string")}d.required&&(f.minCount=1),d.collection||(f.maxCount=1),d.flag&&d.initial&&(f.hasValue=d.initial),d.local!==void 0&&(f.local=d.local),d.writable!==void 0&&(f.writable=d.writable),d.resolveLanguage&&(f.resolveLanguage=d.resolveLanguage),d.setter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${p}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):d.writable&&d.through&&typeof r[ka(p)]=="function"&&(f.setter=[{action:"setSingleTarget",source:"this",predicate:d.through,target:"value",...d.local&&{local:!0}}]),d.initial&&(u.push({action:"addLink",source:"this",predicate:d.through,target:d.initial}),m.push({action:"removeLink",source:"this",predicate:d.through,target:"*"})),l.addProperty(f)}for(let p in s){let d=s[p];if(!d.through)continue;let f={name:p,path:d.through};d.where?.isInstance,f.nodeKind="IRI",d.local!==void 0&&(f.local=d.local),d.writable!==void 0&&(f.writable=d.writable),f.adder=[{action:"addLink",source:"this",predicate:d.through,target:"value",...d.local&&{local:!0}}],f.remover=[{action:"removeLink",source:"this",predicate:d.through,target:"value",...d.local&&{local:!0}}],l.addProperty(f)}return u.length>0&&l.setConstructorActions(u),m.length>0&&l.setDestructorActions(m),{shape:l,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function jy(i){return cu({...i,required:!0,writable:!0,initial:i.initial||"literal://string:uninitialized"})}function qy(i){return cu({...i,writable:!1})}var Vy=`
1331
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};ye=new WeakMap,da=new WeakMap;var Vt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},me=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},vt,pa,Xr,fa,en,xi,ha,tn,Wc=class{constructor(e,t=!0){vt.set(this,void 0),pa.set(this,void 0),Xr.set(this,void 0),fa.set(this,void 0),en.set(this,void 0),xi.set(this,void 0),ha.set(this,void 0),tn.set(this,void 0),Vt(this,vt,e,"f"),Vt(this,pa,new dn(me(this,vt,"f"),t),"f"),Vt(this,Xr,new Hs(me(this,vt,"f")),"f"),Vt(this,fa,new Bs(me(this,vt,"f")),"f"),Vt(this,en,new qs(me(this,vt,"f")),"f"),Vt(this,tn,new eo(me(this,vt,"f"),t),"f"),Vt(this,xi,new Ia(me(this,vt,"f"),t),"f"),me(this,xi,"f").setExpressionClient(me(this,Xr,"f")),me(this,xi,"f").setNeighbourhoodClient(me(this,en,"f")),me(this,xi,"f").setAIClient(me(this,tn,"f")),Vt(this,ha,new Vs(me(this,vt,"f"),t),"f")}get agent(){return me(this,pa,"f")}get expression(){return me(this,Xr,"f")}get languages(){return me(this,fa,"f")}get neighbourhood(){return me(this,en,"f")}get perspective(){return me(this,xi,"f")}get runtime(){return me(this,ha,"f")}get ai(){return me(this,tn,"f")}};vt=new WeakMap,pa=new WeakMap,Xr=new WeakMap,fa=new WeakMap,en=new WeakMap,xi=new WeakMap,ha=new WeakMap,tn=new WeakMap;var to;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(to||(to={}));var mo=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},yo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Li=class{constructor(e,t){this.language=e,this.expression=t}};mo([f(),yo("design:type",_t)],Li.prototype,"language",void 0);mo([f(),yo("design:type",String)],Li.prototype,"expression",void 0);Li=mo([q(),yo("design:paramtypes",[_t,String])],Li);function Uy(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function Fy(i){if(i.startsWith("literal://")){let a=new _t;a.address="literal",a.name="literal";let s=i.substring(10);return new Li(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new _t;return o.address=a,new Li(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new _t;return a.address="did",new Li(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var et=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Tt=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Pa=class{};et([f(),Tt("design:type",String)],Pa.prototype,"name",void 0);et([f(),Tt("design:type",String)],Pa.prototype,"type",void 0);Pa=et([q()],Pa);var Sn=class{};et([f(),Tt("design:type",String)],Sn.prototype,"label",void 0);et([f(),Tt("design:type",String)],Sn.prototype,"name",void 0);et([f(),Tt("design:type",Array)],Sn.prototype,"parameters",void 0);Sn=et([q()],Sn);var Oa=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};et([f(),Tt("design:type",String)],Oa.prototype,"name",void 0);et([f(),Tt("design:type",String)],Oa.prototype,"parametersStringified",void 0);Oa=et([xe(),Tt("design:paramtypes",[String,Object])],Oa);var Da=class{};et([f(),Tt("design:type",String)],Da.prototype,"did",void 0);et([f(),Tt("design:type",Oi)],Da.prototype,"status",void 0);Da=et([q()],Da);var Qc=class{},Qi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ir=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ni=class{};Qi([f(),Ir("design:type",String)],ni.prototype,"name",void 0);Qi([f(),Ir("design:type",String)],ni.prototype,"address",void 0);Qi([f(),Ir("design:type",String)],ni.prototype,"settings",void 0);Qi([f(),Ir("design:type",Ri)],ni.prototype,"icon",void 0);Qi([f(),Ir("design:type",Ri)],ni.prototype,"constructorIcon",void 0);Qi([f(),Ir("design:type",Ri)],ni.prototype,"settingsIcon",void 0);ni=Qi([q()],ni);var Fe=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},pt=class{};Fe([f(),ze("design:type",String)],pt.prototype,"name",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"address",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"description",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"author",void 0);Fe([f(),ze("design:type",Boolean)],pt.prototype,"templated",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"templateSourceLanguageAddress",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"templateAppliedParams",void 0);Fe([f(),ze("design:type",Array)],pt.prototype,"possibleTemplateParams",void 0);Fe([f(),ze("design:type",String)],pt.prototype,"sourceCodeLink",void 0);pt=Fe([q()],pt);var br=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};Fe([f(),ze("design:type",String)],br.prototype,"name",void 0);Fe([f(),ze("design:type",String)],br.prototype,"description",void 0);Fe([f(),ze("design:type",Array)],br.prototype,"possibleTemplateParams",void 0);Fe([f(),ze("design:type",String)],br.prototype,"sourceCodeLink",void 0);br=Fe([xe(),ze("design:paramtypes",[String,String])],br);var Gc=class{},Zc=class extends oi(){},Jc=class{},Wa=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},vo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Wa([f(),vo("design:type",String)],Ma.prototype,"linkLanguage",void 0);Wa([f(),vo("design:type",At)],Ma.prototype,"meta",void 0);Ma=Wa([q(),vo("design:paramtypes",[String,At])],Ma);var io=class extends oi(){};io=Wa([q()],io);var Gi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Zi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ro;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(ro||(ro={}));var ai=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=ro.Private}};Gi([f(),Zi("design:type",String)],ai.prototype,"uuid",void 0);Gi([f(),Zi("design:type",String)],ai.prototype,"name",void 0);Gi([f(),Zi("design:type",String)],ai.prototype,"state",void 0);Gi([f(),Zi("design:type",String)],ai.prototype,"sharedUrl",void 0);Gi([f(),Zi("design:type",io)],ai.prototype,"neighbourhood",void 0);Gi([f(),Zi("design:type",Array)],ai.prototype,"owners",void 0);ai=Gi([q(),Zi("design:paramtypes",[String,String,String])],ai);var Qa=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},uu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ua=class{};Qa([f(),uu("design:type",Array)],Ua.prototype,"additions",void 0);Qa([f(),uu("design:type",Array)],Ua.prototype,"removals",void 0);Ua=Qa([q()],Ua);var Yc=class extends oi(){};Yc=Qa([q()],Yc);var Xc=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},cr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},rn,$i,Yn="smart_literal://content";function Vh(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var wn=class{constructor(e,t){rn.set(this,void 0),$i.set(this,void 0),Xc(this,rn,e,"f"),Xc(this,$i,t,"f")}get base(){return cr(this,$i,"f")}static async create(e,t){let r=ae.from(Vh(10)).toUrl(),n=new wn(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new te({source:t,predicate:Yn}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new te({predicate:Yn}))).map(r=>new wn(e,r.data.source))}async get(){let e=await cr(this,rn,"f").getSingleTarget(new te({source:cr(this,$i,"f"),predicate:Yn}));if(!e)throw`No content for smart literal ${cr(this,$i,"f")}`;return ae.fromUrl(e).get()}async set(e){let t=ae.from(e);await cr(this,rn,"f").setSingleTarget(new Ve({source:cr(this,$i,"f"),predicate:Yn,target:t.toUrl()}))}};rn=new WeakMap,$i=new WeakMap;var Yy=`
1333
1332
  type AIModelLoadingStatus {
1334
1333
  downloaded: Boolean!
1335
1334
  loaded: Boolean!
@@ -1915,7 +1914,7 @@ input VoiceActivityParamsInput {
1915
1914
  startWindow: Float
1916
1915
  timeBeforeSpeech: Float
1917
1916
  }
1918
- `,E=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},g=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},H=function(i,e){return function(t,r){e(t,r,i)}},kn=new ti;kn.author="did:ad4m:test";kn.timestamp=Date.now();kn.data={source:"root",target:"neighbourhood://Qm12345"};kn.proof={signature:"",key:"",valid:!0};var Qt=new Di;Qt.author="did:ad4m:test";Qt.timestamp=Date.now().toString();Qt.proof=new Ut("","");Qt.data=new At([kn]);var ja=class{};E([h(),g("design:type",String)],ja.prototype,"recipient",void 0);E([h(),g("design:type",Di)],ja.prototype,"message",void 0);ja=E([q()],ja);var _r=class{};E([h(),g("design:type",String)],_r.prototype,"ad4mExecutorVersion",void 0);E([h(),g("design:type",Boolean)],_r.prototype,"isInitialized",void 0);E([h(),g("design:type",Boolean)],_r.prototype,"isUnlocked",void 0);_r=E([q()],_r);var qi=class{};E([h(),g("design:type",String)],qi.prototype,"title",void 0);E([h(),g("design:type",String)],qi.prototype,"message",void 0);E([h(),g("design:type",String)],qi.prototype,"type",void 0);E([h(),g("design:type",String)],qi.prototype,"addon",void 0);qi=E([q()],qi);var dt=class{};E([h(),g("design:type",String)],dt.prototype,"description",void 0);E([h(),g("design:type",String)],dt.prototype,"appName",void 0);E([h(),g("design:type",String)],dt.prototype,"appUrl",void 0);E([h(),g("design:type",String)],dt.prototype,"appIconPath",void 0);E([h(),g("design:type",String)],dt.prototype,"trigger",void 0);E([h(),g("design:type",Array)],dt.prototype,"perspectiveIds",void 0);E([h(),g("design:type",String)],dt.prototype,"webhookUrl",void 0);E([h(),g("design:type",String)],dt.prototype,"webhookAuth",void 0);dt=E([Ie()],dt);var tt=class{};E([h(),g("design:type",String)],tt.prototype,"id",void 0);E([h(),g("design:type",Boolean)],tt.prototype,"granted",void 0);E([h(),g("design:type",String)],tt.prototype,"description",void 0);E([h(),g("design:type",String)],tt.prototype,"appName",void 0);E([h(),g("design:type",String)],tt.prototype,"appUrl",void 0);E([h(),g("design:type",String)],tt.prototype,"appIconPath",void 0);E([h(),g("design:type",String)],tt.prototype,"trigger",void 0);E([h(),g("design:type",Array)],tt.prototype,"perspectiveIds",void 0);E([h(),g("design:type",String)],tt.prototype,"webhookUrl",void 0);E([h(),g("design:type",String)],tt.prototype,"webhookAuth",void 0);tt=E([q()],tt);var Er=class{};E([h(),g("design:type",tt)],Er.prototype,"notification",void 0);E([h(),g("design:type",String)],Er.prototype,"perspectiveId",void 0);E([h(),g("design:type",String)],Er.prototype,"triggerMatch",void 0);Er=E([q()],Er);var Ae=class{};E([h(),g("design:type",Number)],Ae.prototype,"total",void 0);E([h(),g("design:type",Number)],Ae.prototype,"imported",void 0);E([h(),g("design:type",Number)],Ae.prototype,"failed",void 0);E([h(),g("design:type",Number)],Ae.prototype,"omitted",void 0);E([h(),g("design:type",Array)],Ae.prototype,"errors",void 0);Ae=E([q()],Ae);var it=class{};E([h(),g("design:type",Ae)],it.prototype,"perspectives",void 0);E([h(),g("design:type",Ae)],it.prototype,"links",void 0);E([h(),g("design:type",Ae)],it.prototype,"expressions",void 0);E([h(),g("design:type",Ae)],it.prototype,"perspectiveDiffs",void 0);E([h(),g("design:type",Ae)],it.prototype,"notifications",void 0);E([h(),g("design:type",Ae)],it.prototype,"models",void 0);E([h(),g("design:type",Ae)],it.prototype,"defaultModels",void 0);E([h(),g("design:type",Ae)],it.prototype,"tasks",void 0);E([h(),g("design:type",Ae)],it.prototype,"friends",void 0);E([h(),g("design:type",Ae)],it.prototype,"trustedAgents",void 0);E([h(),g("design:type",Ae)],it.prototype,"knownLinkLanguages",void 0);it=E([q()],it);var xr=class{};E([h(),g("design:type",String)],xr.prototype,"email",void 0);E([h(),g("design:type",String)],xr.prototype,"did",void 0);E([h(),g("design:type",String)],xr.prototype,"lastSeen",void 0);E([h(),g("design:type",Number)],xr.prototype,"perspectiveCount",void 0);xr=E([q()],xr);var Vi=class{};E([h(),g("design:type",Boolean)],Vi.prototype,"success",void 0);E([h(),g("design:type",String)],Vi.prototype,"message",void 0);E([h(),g("design:type",Boolean)],Vi.prototype,"requiresPassword",void 0);E([h(),g("design:type",Boolean)],Vi.prototype,"isExistingUser",void 0);Vi=E([q()],Vi);var U=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,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Qt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Qt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Qt}]}runtimeMessageReceived(){return Qt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:to.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,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Ui("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,r){return!0}};E([re(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",_r)],U.prototype,"runtimeInfo",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"addTrustedAgents",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"getTrustedAgents",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeFriends",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);E([re(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);E([rt(),H(0,z()),H(1,z()),H(2,z()),H(3,z()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[At]),g("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);E([rt(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Di)],U.prototype,"runtimeFriendStatus",null);E([re(),H(0,z()),H(1,z()),g("design:type",Function),g("design:paramtypes",[String,xa]),g("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);E([rt(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);E([rt(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);E([ao(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Di)],U.prototype,"runtimeMessageReceived",null);E([ao(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",qi)],U.prototype,"exceptionOccurred",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[dt]),g("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeNotifications",null);E([re(),H(0,z()),H(1,z()),g("design:type",Function),g("design:paramtypes",[String,dt]),g("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);E([ao(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Er)],U.prototype,"runtimeNotificationTriggered",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);E([re(),H(0,z()),H(1,z()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);E([rt(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeListUsers",null);E([re(),H(0,z()),H(1,z()),g("design:type",Function),g("design:paramtypes",[String,It]),g("design:returntype",Vi)],U.prototype,"runtimeRequestLoginVerification",null);E([re(),H(0,z()),H(1,z()),H(2,z()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);E([re(),H(0,z()),H(1,z()),H(2,z()),g("design:type",Function),g("design:paramtypes",[String,String,It]),g("design:returntype",Ui)],U.prototype,"runtimeCreateUser",null);E([re(),H(0,z()),H(1,z()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],U.prototype,"runtimeLoginUser",null);E([re(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);E([re(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);E([re(),H(0,z()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);E([re(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);E([re(),H(0,z()),H(1,z()),H(2,z()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);U=E([Sd()],U);var Fr=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Z=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Oe,ga,ma,le;function ya(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Xc(i){return i?`triple("${i}", "ad4m://has_child", Base)`:""}function el(){return`
1917
+ `,A=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},m=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},z=function(i,e){return function(t,r){e(t,r,i)}},kn=new ei;kn.author="did:ad4m:test";kn.timestamp=Date.now();kn.data={source:"root",target:"neighbourhood://Qm12345"};kn.proof={signature:"",key:"",valid:!0};var Qt=new Oi;Qt.author="did:ad4m:test";Qt.timestamp=Date.now().toString();Qt.proof=new Mt("","");Qt.data=new At([kn]);var Fa=class{};A([f(),m("design:type",String)],Fa.prototype,"recipient",void 0);A([f(),m("design:type",Oi)],Fa.prototype,"message",void 0);Fa=A([q()],Fa);var Sr=class{};A([f(),m("design:type",String)],Sr.prototype,"ad4mExecutorVersion",void 0);A([f(),m("design:type",Boolean)],Sr.prototype,"isInitialized",void 0);A([f(),m("design:type",Boolean)],Sr.prototype,"isUnlocked",void 0);Sr=A([q()],Sr);var Bi=class{};A([f(),m("design:type",String)],Bi.prototype,"title",void 0);A([f(),m("design:type",String)],Bi.prototype,"message",void 0);A([f(),m("design:type",String)],Bi.prototype,"type",void 0);A([f(),m("design:type",String)],Bi.prototype,"addon",void 0);Bi=A([q()],Bi);var ot=class{};A([f(),m("design:type",String)],ot.prototype,"description",void 0);A([f(),m("design:type",String)],ot.prototype,"appName",void 0);A([f(),m("design:type",String)],ot.prototype,"appUrl",void 0);A([f(),m("design:type",String)],ot.prototype,"appIconPath",void 0);A([f(),m("design:type",String)],ot.prototype,"trigger",void 0);A([f(),m("design:type",Array)],ot.prototype,"perspectiveIds",void 0);A([f(),m("design:type",String)],ot.prototype,"webhookUrl",void 0);A([f(),m("design:type",String)],ot.prototype,"webhookAuth",void 0);ot=A([xe()],ot);var Je=class{};A([f(),m("design:type",String)],Je.prototype,"id",void 0);A([f(),m("design:type",Boolean)],Je.prototype,"granted",void 0);A([f(),m("design:type",String)],Je.prototype,"description",void 0);A([f(),m("design:type",String)],Je.prototype,"appName",void 0);A([f(),m("design:type",String)],Je.prototype,"appUrl",void 0);A([f(),m("design:type",String)],Je.prototype,"appIconPath",void 0);A([f(),m("design:type",String)],Je.prototype,"trigger",void 0);A([f(),m("design:type",Array)],Je.prototype,"perspectiveIds",void 0);A([f(),m("design:type",String)],Je.prototype,"webhookUrl",void 0);A([f(),m("design:type",String)],Je.prototype,"webhookAuth",void 0);Je=A([q()],Je);var wr=class{};A([f(),m("design:type",Je)],wr.prototype,"notification",void 0);A([f(),m("design:type",String)],wr.prototype,"perspectiveId",void 0);A([f(),m("design:type",String)],wr.prototype,"triggerMatch",void 0);wr=A([q()],wr);var Ee=class{};A([f(),m("design:type",Number)],Ee.prototype,"total",void 0);A([f(),m("design:type",Number)],Ee.prototype,"imported",void 0);A([f(),m("design:type",Number)],Ee.prototype,"failed",void 0);A([f(),m("design:type",Number)],Ee.prototype,"omitted",void 0);A([f(),m("design:type",Array)],Ee.prototype,"errors",void 0);Ee=A([q()],Ee);var Ye=class{};A([f(),m("design:type",Ee)],Ye.prototype,"perspectives",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"links",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"expressions",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"perspectiveDiffs",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"notifications",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"models",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"defaultModels",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"tasks",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"friends",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"trustedAgents",void 0);A([f(),m("design:type",Ee)],Ye.prototype,"knownLinkLanguages",void 0);Ye=A([q()],Ye);var _r=class{};A([f(),m("design:type",String)],_r.prototype,"email",void 0);A([f(),m("design:type",String)],_r.prototype,"did",void 0);A([f(),m("design:type",String)],_r.prototype,"lastSeen",void 0);A([f(),m("design:type",Number)],_r.prototype,"perspectiveCount",void 0);_r=A([q()],_r);var qi=class{};A([f(),m("design:type",Boolean)],qi.prototype,"success",void 0);A([f(),m("design:type",String)],qi.prototype,"message",void 0);A([f(),m("design:type",Boolean)],qi.prototype,"requiresPassword",void 0);A([f(),m("design:type",Boolean)],qi.prototype,"isExistingUser",void 0);qi=A([q()],qi);var D=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,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Qt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Qt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Qt}]}runtimeMessageReceived(){return Qt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:to.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,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Di("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,r){return!0}};A([ne(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeQuit",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeOpenLink",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Sr)],D.prototype,"runtimeInfo",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"addTrustedAgents",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"deleteTrustedAgents",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"getTrustedAgents",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeKnownLinkLanguageTemplates",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeAddKnownLinkLanguageTemplates",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeFriends",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeAddFriends",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Array]),m("design:returntype",Array)],D.prototype,"runtimeRemoveFriends",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",String)],D.prototype,"runtimeHcAgentInfos",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",String)],D.prototype,"runtimeGetNetworkMetrics",null);A([ne(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeRestartHolochain",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Object]),m("design:returntype",Boolean)],D.prototype,"runtimeHcAddAgentInfos",null);A([Xe(),z(0,H()),z(1,H()),z(2,H()),z(3,H()),m("design:type",Function),m("design:paramtypes",[String,String,String,String]),m("design:returntype",void 0)],D.prototype,"runtimeVerifyStringSignedByDid",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[At]),m("design:returntype",Boolean)],D.prototype,"runtimeSetStatus",null);A([Xe(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Oi)],D.prototype,"runtimeFriendStatus",null);A([ne(),z(0,H()),z(1,H()),m("design:type",Function),m("design:paramtypes",[String,_a]),m("design:returntype",Boolean)],D.prototype,"runtimeFriendSendMessage",null);A([Xe(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Array)],D.prototype,"runtimeMessageInbox",null);A([Xe(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Array)],D.prototype,"runtimeMessageOutbox",null);A([ao(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Oi)],D.prototype,"runtimeMessageReceived",null);A([ao(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Bi)],D.prototype,"exceptionOccurred",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[ot]),m("design:returntype",String)],D.prototype,"runtimeRequestInstallNotification",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeNotifications",null);A([ne(),z(0,H()),z(1,H()),m("design:type",Function),m("design:paramtypes",[String,ot]),m("design:returntype",Boolean)],D.prototype,"runtimeUpdateNotification",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeRemoveNotification",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeGrantNotification",null);A([ao(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",wr)],D.prototype,"runtimeNotificationTriggered",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeExportDb",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeImportDb",null);A([ne(),z(0,H()),z(1,H()),m("design:type",Function),m("design:paramtypes",[String,String]),m("design:returntype",Boolean)],D.prototype,"runtimeExportPerspective",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeImportPerspective",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeMultiUserEnabled",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[Boolean]),m("design:returntype",Boolean)],D.prototype,"runtimeSetMultiUserEnabled",null);A([Xe(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Array)],D.prototype,"runtimeListUsers",null);A([ne(),z(0,H()),z(1,H()),m("design:type",Function),m("design:paramtypes",[String,kt]),m("design:returntype",qi)],D.prototype,"runtimeRequestLoginVerification",null);A([ne(),z(0,H()),z(1,H()),z(2,H()),m("design:type",Function),m("design:paramtypes",[String,String,String]),m("design:returntype",String)],D.prototype,"runtimeVerifyEmailCode",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",Boolean)],D.prototype,"runtimeTestEmail",null);A([ne(),z(0,H()),z(1,H()),z(2,H()),m("design:type",Function),m("design:paramtypes",[String,String,kt]),m("design:returntype",Di)],D.prototype,"runtimeCreateUser",null);A([ne(),z(0,H()),z(1,H()),m("design:type",Function),m("design:paramtypes",[String,String]),m("design:returntype",String)],D.prototype,"runtimeLoginUser",null);A([ne(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeEnable",null);A([ne(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeDisable",null);A([ne(),z(0,H()),m("design:type",Function),m("design:paramtypes",[String]),m("design:returntype",String)],D.prototype,"runtimeEmailTestGetCode",null);A([ne(),m("design:type",Function),m("design:paramtypes",[]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestClearCodes",null);A([ne(),z(0,H()),z(1,H()),z(2,H()),m("design:type",Function),m("design:paramtypes",[String,String,Number]),m("design:returntype",Boolean)],D.prototype,"runtimeEmailTestSetExpiry",null);D=A([wd()],D);function ga(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Mr(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=bt(t);if(i.field){let n=r[i.field];if(!n)throw new Error(`parent(): field "${i.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(r))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function el(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function tl(){return`
1919
1918
  findall(
1920
1919
  [T, A],
1921
1920
  link(Base, _, _, T, A),
@@ -1923,56 +1922,57 @@ input VoiceActivityParamsInput {
1923
1922
  ),
1924
1923
  sort(AllLinks, SortedLinks),
1925
1924
  SortedLinks = [[Timestamp, Author]|_]
1926
- `}function Bh(i){return`
1925
+ `}function Hh(i){return`
1927
1926
  findall([PropertyName, PropertyValue, Resolve], (
1928
1927
  % Constrain to specified properties if provided
1929
1928
  ${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
1930
1929
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1931
1930
  ), Properties)
1932
- `}function jh(i){return`
1933
- findall([CollectionName, CollectionValues], (
1934
- % Constrain to specified collections if provided
1935
- ${i?`member(CollectionName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
1936
-
1937
- collection(SubjectClass, CollectionName),
1938
- collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1939
- ), Collections)
1940
- `}function tl(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=ya(t);if(Array.isArray(r)){let o=r.map(c=>e(c)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:c,lt:l,lte:u,gt:m,gte:p}=r;if(o!==void 0)if(Array.isArray(o)){let f=o.map(y=>e(y)).join(", ");return n?`\\+ member(${s}, [${f}])`:`${a}, \\+ member(Value${t}, [${f}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${s} >= ${c[0]}, ${s} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let d=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:m,symbol:">"},{value:p,symbol:">="}];for(let{value:f,symbol:y}of d)if(f!==void 0)return n?`${s} ${y} ${f}`:`${a}, Value${t} ${y} ${f}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function il(i){return i?"length(UnsortedInstances, TotalCount)":""}function rl(i){if(!i)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(i)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function nl(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function al(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function sl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function So(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function uu(i,e){return So(i.type)===e}function ol(i){return uu(i,"array")}function cl(i){return uu(i,"object")}function qh(i){let e=So(i.type);return e==="number"||e==="integer"}var Ni=class{static async getClassName(e){if(this===Ni)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}get timestamp(){return this.createdAt}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,r={},n=e.__properties||{};for(let[u,m]of Object.entries(n)){let p=m;r[u]={name:u,predicate:p.through||"",required:p.required||!1,writable:p.writable||!1,...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},s=e.__collections||{};for(let[u,m]of Object.entries(s)){let p=m;a[u]={name:u,predicate:p.through||"",...p.where!==void 0&&{where:p.where},...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter}}}let o=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(o||c)&&e.__jsonSchema){let u=e.__jsonSchema,m=e.__jsonSchemaOptions||{};if(u.properties)for(let[p,d]of Object.entries(u.properties)){let f=ol(d),y=this.determinePredicate(u,p,d,this.determineNamespace(u,m),m);if(f)a[p]={name:p,predicate:y,...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}};else{let $=u.required?.includes(p)||!1;r[p]={name:p,predicate:y,required:$,writable:d["x-ad4m"]?.writable!==!1,...d["x-ad4m"]?.resolveLanguage&&{resolveLanguage:d["x-ad4m"].resolveLanguage},...d["x-ad4m"]?.initial&&{initial:d["x-ad4m"].initial},...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}}}}}return{className:t,properties:r,collections:a}}constructor(e,t,r){Oe.set(this,void 0),ga.set(this,void 0),ma.set(this,void 0),le.set(this,void 0),Fr(this,Oe,t||ae.from(lu(24)).toUrl(),"f"),Fr(this,le,e,"f"),Fr(this,ma,r||"ad4m://self","f")}get baseExpression(){return Z(this,Oe,"f")}get perspective(){return Z(this,le,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog 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 r=this.getCollectionMetadata(e);if(!r)throw new Error(`Collection "${e}" has no metadata defined`);if(!r.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){let n=Object.fromEntries(await Promise.all(r.map(async([s,o,c])=>{let l=o;if(!c&&typeof o=="string"){let m=Array.from(o,f=>f.codePointAt(0)),p=m.every(f=>f<=255),d=m.some(f=>f>=128);if(p&&d)try{let f=Uint8Array.from(m),y=new TextDecoder("utf-8",{fatal:!0}).decode(f);y!==o&&(l=y)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${s}"`,{value:o,error:f})}}if(c){let m=await e.getExpression(o);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=t.__properties?.[s]?.transform;return u&&typeof u=="function"&&(l=u(l)),[s,l]}))),a=Object.fromEntries(Object.entries(n).filter(([s])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),s);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(t,a)}async getData(){try{let e=this.constructor,t=e.getModelMetadata(),n=`
1931
+ `}function il(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=t==="id"?"Base":ga(t);if(Array.isArray(r)){let o=r.map(c=>e(c)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:c,lt:l,lte:u,gt:y,gte:g}=r;if(o!==void 0)if(Array.isArray(o)){let p=o.map(h=>e(h)).join(", ");return n?`\\+ member(${s}, [${p}])`:`${a}, \\+ member(Value${t}, [${p}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${s} >= ${c[0]}, ${s} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let d=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:y,symbol:">"},{value:g,symbol:">="}];for(let{value:p,symbol:h}of d)if(p!==void 0)return n?`${s} ${h} ${p}`:`${a}, Value${t} ${h} ${p}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function rl(i){return i?"length(UnsortedInstances, TotalCount)":""}function nl(i){if(!i)return"SortedInstances = UnsortedInstances";let e=Object.entries(i);if(e.length===1){let[r,n]=e[0];return`sort_instances(UnsortedInstances, "${r}", "${n}", SortedInstances)`}let t=[];for(let r=e.length-1;r>=0;r--){let[n,a]=e[r],s=r===e.length-1?"UnsortedInstances":`MultiSortIntermediate${r+1}`,o=r===0?"SortedInstances":`MultiSortIntermediate${r}`;t.push(`sort_instances(${s}, "${n}", "${a}", ${o})`)}return t.join(`,
1932
+ `)}function al(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function sl(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function ol(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function bo(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function du(i,e){return bo(i.type)===e}function cl(i){return du(i,"array")}function ll(i){return du(i,"object")}function zh(i){let e=bo(i.type);return e==="number"||e==="integer"}var ut=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===ut)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,r={},n=Ci(this);for(let[y,g]of Object.entries(n)){let d=g;r[y]={name:y,predicate:d.through||"",required:d.required||!1,readOnly:!(d.writable??!1),...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},s=bt(this),o=Object.fromEntries(Object.entries(s).filter(([,y])=>y.kind==="hasMany"||y.kind==="belongsToMany"));for(let[y,g]of Object.entries(o)){let d=g;a[y]={name:y,predicate:d.predicate||"",...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter},direction:d.kind==="belongsToMany"||d.kind==="belongsToOne"?"reverse":"forward"}}let c=Object.keys(r).length>0,l=Object.keys(a).length>0;if(!(c||l)&&e.__jsonSchema){let y=e.__jsonSchema,g=e.__jsonSchemaOptions||{};if(y.properties)for(let[d,p]of Object.entries(y.properties)){let h=cl(p),w=this.determinePredicate(y,d,p,this.determineNamespace(y,g),g);if(h)a[d]={name:d,predicate:w,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let E=y.required?.includes(d)||!1;r[d]={name:d,predicate:w,required:E,readOnly: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:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||ae.from(xl(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Ci(t)[e]}getRelationOptions(e){let t=this.constructor;return bt(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog 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}}]}generateRelationAction(e,t){let r=this.getRelationOptions(e);if(!r)throw new Error(`Relation "${e}" has no metadata defined`);if(!r.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.predicate,target:"value",...r.local&&{local:!0}}]}static async hydratePropertyValue(e,t,r,n){let a=e;if(e!=null&&e!=="")if(t.resolveLanguage!=null&&t.resolveLanguage!=="literal"&&typeof e=="string"&&!e.startsWith("literal://"))try{let s=await r.getExpression(e);if(s)try{a=JSON.parse(s.data)}catch{a=s.data}}catch(s){console.warn(`hydratePropertyValue: failed to resolve expression for "${t.name}":`,s)}else if(t.resolveLanguage==="literal"&&typeof e=="string"&&e.startsWith("literal://"))try{let s=ae.fromUrl(e).get();a=s.data!==void 0?s.data:s}catch{}else typeof e=="string"&&n&&(n==="number"?a=Number(e):n==="boolean"&&(a=e==="true"||e==="1"));return t.transform&&typeof t.transform=="function"&&(a=t.transform(a)),a}static async hydrateFromLinks(e,t,r,n,a){if(!t||t.length===0)return;let s=null,o=null,c=null,l=a&&a.length>0?new Set(a):null,u=new Map;for(let[p,h]of Object.entries(r.properties))h.getter||l&&!l.has(p)||u.set(h.predicate,[p,h]);let y=new Map;for(let[p,h]of Object.entries(r.relations))h.getter||y.set(h.predicate,[p,h]);let g=new Map,d=new Map;for(let p=0;p<t.length;p++){let h=t[p],{predicate:w,target:E,author:I,timestamp:k}=h;if(E==="None"||E===void 0||E===null)continue;k!=null&&((s==null||k<s)&&(s=k,c=I??null),(o==null||k>o)&&(o=k));let S=u.get(w);if(S){g.get(S[0]),g.set(S[0],{target:E,timestamp:k});continue}let T=y.get(w);if(T){let[O]=T,C=d.get(O);C||(C=[],d.set(O,C)),C.push({target:E,timestamp:k??"",index:p})}}for(let[p,{target:h}]of g){let[,w]=u.get(r.properties[p].predicate),E=typeof e[p];e[p]=await this.hydratePropertyValue(h,w,n,E!=="undefined"?E:void 0)}for(let[p,h]of d)h.sort((w,E)=>{let I=String(w.timestamp).localeCompare(String(E.timestamp));return I!==0?I:w.index-E.index}),e[p]=h.map(w=>w.target).filter(w=>w!=null&&w!==""&&w!=="None");c&&(e.author=c),s!=null&&(e.createdAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s),o!=null&&(e.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}static async assignValuesToInstance(e,t,r){let n=Object.fromEntries(await Promise.all(r.map(async([s,o,c])=>{let l=o;if(!c&&typeof o=="string"){let g=Array.from(o,h=>h.codePointAt(0)),d=g.every(h=>h<=255),p=g.some(h=>h>=128);if(d&&p)try{let h=Uint8Array.from(g),w=new TextDecoder("utf-8",{fatal:!0}).decode(h);w!==o&&(l=w)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${s}"`,{value:o,error:h})}}if(c){let g=await e.getExpression(o);if(g)try{l=JSON.parse(g.data)}catch{l=g.data}}let y=Ci(t.constructor)[s]?.transform;return y&&typeof y=="function"&&(l=y(l)),[s,l]}))),a=Object.fromEntries(Object.entries(n).filter(([s])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),s);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(t,a)}static normalizeValue(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&typeof t.id=="string"?t.id:t):e}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=ut.normalizeValue(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=ut.normalizeValue(Array.isArray(s)?[...s]:s)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in r.relations){let s=this[a];n[a]=ut.normalizeValue(Array.isArray(s)?[...s]:s)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let r=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let s=ut.normalizeValue(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let c=Array.isArray(s)?[...s].sort():[],l=Array.isArray(o)?[...o].sort():[];(c.length!==l.length||c.some((u,y)=>u!==l[y]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
1941
1933
  SELECT id, predicate, out.uri AS target, author, timestamp
1942
1934
  FROM link
1943
- WHERE in.uri = ${e.formatSurrealValue(Z(this,Oe,"f"))}
1935
+ WHERE in.uri = ${t.formatSurrealValue(this._baseExpression)}
1944
1936
  ORDER BY timestamp ASC
1945
- `,a=await Z(this,le,"f").querySurrealDB(n);if(a&&a.length>0){let s=null,o=null,c=null,l=null;for(let[u,m]of Object.entries(t.properties)){if(m.getter)continue;let p=a.filter(d=>d.predicate===m.predicate);if(p.length>0){let d=p[p.length-1],f=d.target;if(d.timestamp&&((!s||d.timestamp<s)&&(s=d.timestamp,l=d.author),(!o||d.timestamp>o)&&(o=d.timestamp,c=d.author)),m.resolveLanguage&&m.resolveLanguage!=="literal")try{let y=await Z(this,le,"f").getExpression(f);if(y)try{f=JSON.parse(y.data)}catch{f=y.data}}catch(y){console.warn(`Failed to resolve expression for ${u}:`,y)}else if(m.resolveLanguage==="literal"&&typeof f=="string"&&f.startsWith("literal://"))try{let y=ae.fromUrl(f).get();f=y.data!==void 0?y.data:y}catch{}m.transform&&typeof m.transform=="function"&&(f=m.transform(f)),this[u]=f}}for(let[u,m]of Object.entries(t.collections)){if(m.getter)continue;let d=a.filter(f=>f.predicate===m.predicate).map(f=>f.target);if(m.where?.condition&&d.length>0)try{let f=[];for(let y of d){let $=m.where.condition.replace(/\$perspective/g,`'${Z(this,le,"f").uuid}'`).replace(/\$base/g,`'${Z(this,Oe,"f")}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);$.trim().startsWith("WHERE")&&($=`array::len(SELECT * FROM link ${$}) > 0`);let A=`RETURN ${$}`,T=await Z(this,le,"f").querySurrealDB(A);(T===!0||Array.isArray(T)&&T.length>0&&T[0]===!0)&&f.push(y)}d=f}catch(f){console.warn(`Failed to apply condition filter for ${u}:`,f)}if(m.where?.isInstance&&d.length>0)try{let f=typeof m.where.isInstance=="string"?m.where.isInstance:m.where.isInstance.name,y=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(f);y&&(d=await Z(this,le,"f").batchCheckSubjectInstances(d,y))}catch{}this[u]=d}l&&(this.author=l),s&&(this.createdAt=s),o&&(this.updatedAt=o)}await e.evaluateCustomGettersForInstance(this,Z(this,le,"f"),t);for(let[s,o]of Object.entries(t.collections))if(o.getter&&o.where?.isInstance&&this[s]?.length>0)try{let c=typeof o.where.isInstance=="string"?o.where.isInstance:o.where.isInstance.name,l=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(c);if(l){let u=await Z(this,le,"f").batchCheckSubjectInstances(this[s],l);this[s]=u}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${Z(this,Oe,"f")}:`,e)}return this}static async queryToProlog(e,t,r){let{source:n,properties:a,collections:s,where:o,order:c,offset:l,limit:u,count:m}=t,p=r||await this.getClassName(e),d=[el(),Xc(n),Bh(a),jh(s),tl(o)],f=[il(m),rl(c),nl(l),al(u)];return`
1937
+ `,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await t.hydrateFromLinks(this,s,r,this._perspective,l)}let o=bt(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,u]of Object.entries(o)){if(u.kind!=="belongsToOne"&&u.kind!=="belongsToMany"||c&&!c.has(l))continue;let g=(await this._perspective.get(new te({predicate:u.predicate,target:this._baseExpression}))).filter(d=>d.data.target===this._baseExpression).map(d=>d.data.source);u.kind==="belongsToOne"?this[l]=g.length>0?g[g.length-1]:null:this[l]=g}await t.evaluateCustomGettersForInstance(this,this._perspective,r),e?.include&&await t.hydrateRelations([this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,r){let{properties:n,where:a,order:s,offset:o,limit:c,count:l}=t,u=r||await this.getClassName(e),y=t.parent?Mr(t.parent,this):void 0,g=[tl(),el(t.parent,y),Hh(n),il(a)],d=[rl(l),nl(s),al(o),sl(c)];return`
1946
1938
  findall([Base, Properties, Collections, Timestamp, Author], (
1947
- subject_class("${p}", SubjectClass),
1939
+ subject_class("${u}", SubjectClass),
1948
1940
  instance(SubjectClass, Base),
1949
- ${d.filter($=>$).join(", ")}
1941
+ ${g.filter(h=>h).join(", ")}
1950
1942
  ), UnsortedInstances),
1951
- ${f.filter($=>$).join(", ")}
1952
- `}static async evaluateCustomGettersForInstance(e,t,r){let n=this.formatSurrealValue(e.baseExpression);for(let[a,s]of Object.entries(r.properties))if(s.getter)try{let o=s.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${o}) AS value FROM node WHERE uri = ${n}`);c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null&&c[0].value!=="None"&&c[0].value!==""&&(e[a]=c[0].value)}catch(o){console.warn(`Failed to evaluate getter for ${a}:`,o)}for(let[a,s]of Object.entries(r.collections))if(s.getter)try{let o=s.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${o}) AS value FROM node WHERE uri = ${n}`);if(c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null){let l=c[0].value;e[a]=Array.isArray(l)?l.filter(u=>u!=null&&u!==""&&u!=="None"):l}}catch(o){console.warn(`Failed to evaluate getter for ${a}:`,o)}}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),{source:n,where:a,order:s,offset:o,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[d,f]of Object.entries(r.properties))f.required&&(f.flag&&f.initial?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${ne(f.predicate)}' AND out.uri = '${ne(f.initial)}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${ne(f.predicate)}']) > 0`));if(l.length===0){for(let[d,f]of Object.entries(r.properties))if(f.initial){f.flag?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${ne(f.predicate)}' AND out.uri = '${ne(f.initial)}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${ne(f.predicate)}']) > 0`);break}}let u=this.buildGraphTraversalWhereClause(r,a),m=[];return m.push(...l),u&&m.push(u),m.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1943
+ ${d.filter(h=>h).join(", ")}
1944
+ `}static async evaluateCustomGettersForInstance(e,t,r){let n=this.formatSurrealValue(e.id);for(let[a,s]of Object.entries(r.properties))if(s.getter)try{let o=s.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${o}) AS value FROM node WHERE uri = ${n}`);c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null&&c[0].value!=="None"&&c[0].value!==""&&(e[a]=c[0].value)}catch(o){console.warn(`Failed to evaluate getter for ${a}:`,o)}for(let[a,s]of Object.entries(r.relations))if(s.getter)try{let o=s.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${o}) AS value FROM node WHERE uri = ${n}`);if(c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null){let l=c[0].value;e[a]=Array.isArray(l)?l.filter(u=>u!=null&&u!==""&&u!=="None"):l}}catch(o){console.warn(`Failed to evaluate getter for ${a}:`,o)}}static async hydrateRelations(e,t,r){if(!r||Object.keys(r).length===0)return;let n=bt(this);for(let[a,s]of Object.entries(r)){let o=n[a];if(!o){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=o.target(),l=typeof s=="object"&&s!==null?s:void 0,u=l?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let k=(await t.get(new te({predicate:o.predicate,target:E.id}))).filter(S=>S.data.target===E.id).map(S=>S.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let S=k[k.length-1];try{let T=new c(t,S);await T.get(),E[a]=T}catch{E[a]=null}}else{let S=[];if(l&&(l.where||l.order||l.properties)){let T={id:k,...l.where??{}};S=await c.findAll(t,{where:T,...l.order&&{order:l.order},...l.properties&&{properties:l.properties}})}else await Promise.all(k.map(async T=>{try{let O=new c(t,T);await O.get(l?.properties?{properties:l.properties}:void 0),S.push(O)}catch{}}));if(l?.order&&!(l.where||l.properties)){let T=Object.entries(l.order);S=S.sort((O,C)=>{for(let[W,B]of T){let L=String(O[W]??""),_=String(C[W]??""),Ke=L.localeCompare(_);if(Ke!==0)return B==="DESC"?-Ke:Ke}return 0})}if(l?.offset!=null||l?.limit!=null){let T=l.offset??0,O=l.limit!=null?T+l.limit:void 0;S=S.slice(T,O)}E[a]=S,u&&S.length>0&&await c.hydrateRelations(S,t,u)}}continue}let y=new Set,g=new Map;for(let E of e){let I=E[a];if(g.set(E,Array.isArray(I)?[...I]:I),I!=null)if(Array.isArray(I))for(let k of I)typeof k=="string"?y.add(k):k&&typeof k=="object"&&typeof k.id=="string"&&y.add(k.id);else typeof I=="string"?y.add(I):I&&typeof I=="object"&&typeof I.id=="string"&&y.add(I.id)}if(y.size===0)continue;let d=new Map,h={where:{id:Array.from(y),...l?.where??{}},...l?.order&&{order:l.order},...l?.properties&&{properties:l.properties}},w=await c.findAll(t,h);for(let E of w)d.set(E.id,E);for(let E of e){let I=g.get(E);if(I!=null)if(Array.isArray(I)){let k=I.map(S=>typeof S=="string"?d.has(S)?d.get(S):null:S&&typeof S=="object"&&typeof S.id=="string"?d.has(S.id)?d.get(S.id):S:null).filter(S=>S!==null);if(l?.order){let S=Object.entries(l.order);k=k.sort((T,O)=>{for(let[C,W]of S){let B=String(T[C]??""),L=String(O[C]??""),_=B.localeCompare(L);if(_!==0)return W==="DESC"?-_:_}return 0})}if(l?.offset!=null||l?.limit!=null){let S=l.offset??0,T=l.limit!=null?S+l.limit:void 0;k=k.slice(S,T)}o.maxCount===1?(k.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${k.length} values found; keeping the last`),E[a]=k.length>0?k[k.length-1]:null):E[a]=k}else typeof I=="string"&&d.has(I)?E[a]=d.get(I):I&&typeof I=="object"&&typeof I.id=="string"&&(E[a]=d.has(I.id)?d.get(I.id):I)}if(u){let E=Array.from(d.values());await c.hydrateRelations(E,t,u)}}}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),{where:n,order:a,offset:s,limit:o}=t,c=[];if(t.parent){let g=Mr(t.parent,this);c.push(`count(<-link[WHERE in.uri = ${this.formatSurrealValue(t.parent.id)} AND predicate = '${J(g)}']) > 0`)}for(let[g,d]of Object.entries(r.properties))if(d.required){if(d.getter)continue;d.flag&&d.initial?c.push(`count(->link[WHERE predicate = '${J(d.predicate)}' AND out.uri = '${J(d.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${J(d.predicate)}']) > 0`)}if(c.length===0){for(let[g,d]of Object.entries(r.properties))if(d.initial){d.flag?c.push(`count(->link[WHERE predicate = '${J(d.predicate)}' AND out.uri = '${J(d.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${J(d.predicate)}']) > 0`);break}}if(c.length===0){let g=[];for(let[,d]of Object.entries(r.properties))d.predicate&&g.push(`predicate = '${J(d.predicate)}'`);if(r.relations)for(let[,d]of Object.entries(r.relations))d.predicate&&g.push(`predicate = '${J(d.predicate)}'`);g.length>0&&c.push(`count(->link[WHERE (${g.join(" OR ")})]) > 0`)}let l=this.buildGraphTraversalWhereClause(r,n),u=[];return u.push(...c),l&&u.push(l),u.push("count(->link) > 0"),`
1953
1945
  SELECT
1954
1946
  id AS source,
1955
1947
  uri AS source_uri,
1956
- ->link[WHERE perspective = $perspective] AS links
1948
+ ->link AS links
1957
1949
  FROM node
1958
- WHERE ${m.join(" AND ")}
1959
- `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} 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(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let c=ne(o.predicate),l=o.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let u=a.map(m=>this.formatSurrealValue(m)).join(", ");r.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 p=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} IN [${p}]]) = 0`)}else r.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)&&r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} 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(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let c=ne(o.predicate),l=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(m=>this.formatSurrealValue(m)).join(", ");r.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 p=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${p}])`)}else r.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)&&r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)})`)}return r.join(" AND ")}static buildSurrealSelectFields(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=ne(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}' LIMIT 1) AS ${o}`)}let s=r||Object.keys(e.collections);for(let o of s){let c=e.collections[o];if(!c)continue;let l=ne(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),n.join(`,
1960
- `)}static buildSurrealSelectFieldsWithAggregation(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=ne(c.predicate);n.push(`array::first(target[WHERE predicate = '${l}']) AS ${o}`)}let s=r||Object.keys(e.collections);for(let o of s){let c=e.collections[o];if(!c)continue;let l=ne(c.predicate);n.push(`target[WHERE predicate = '${l}'] AS ${o}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS createdAt"),n.push("array::last(timestamp) AS updatedAt"),n.join(`,
1961
- `)}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,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(r[0].AllInstances.map(async([s,o,c,l,u])=>{try{let m=new this(e,s);n.length&&Object.keys(m).forEach(d=>{n.includes(d)||delete m[d]});let p=[...o,...c,["createdAt",l],["author",u]];return await Ni.assignValuesToInstance(e,m,p),m}catch(m){return console.error(`Failed to process instance ${s}:`,m),null}}))).filter(s=>s!==null),totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=t?.collections||[],o=[];for(let p of r){let d;try{if(d=p.source_uri,!d)continue;let f=p.links||[],y=new this(e,d),$=null,A=null,T=null,N=null;for(let x=0;x<f.length;x++){let C=f[x],D=C.predicate,I=C.target;if(I==="None")continue;C.timestamp&&((!$||C.timestamp<$)&&($=C.timestamp,T=C.author),(!A||C.timestamp>A)&&(A=C.timestamp,N=C.author));let W=!1;for(let[L,k]of Object.entries(n.properties))if(!k.getter&&k.predicate===D){let b=y[L],Ue=typeof b=="object"&&b!==null&&!Array.isArray(b)&&Object.keys(b).length===0;if(!b||b===""||b===0||Ue){let ke=I;if(I!=null&&I!==""){if(k.resolveLanguage!=null&&k.resolveLanguage!=="literal"&&typeof I=="string"&&!I.startsWith("literal://"))try{let _e=await e.getExpression(I);if(_e)try{ke=JSON.parse(_e.data)}catch{ke=_e.data}}catch(_e){console.warn(`Failed to resolve expression for ${L} with target "${I}":`,_e),console.warn("Falling back to raw value"),ke=I}else if(k.resolveLanguage==="literal"&&typeof I=="string"&&I.startsWith("literal://"))try{let _e=ae.fromUrl(I).get();_e.data!==void 0?ke=_e.data:ke=_e}catch{ke=I}else if(typeof I=="string"){let _e=typeof y[L];_e==="number"?ke=Number(I):_e==="boolean"&&(ke=I==="true"||I==="1")}}k.transform&&typeof k.transform=="function"&&(ke=k.transform(ke)),y[L]=ke}W=!0;break}if(!W){for(let[L,k]of Object.entries(n.collections))if(!k.getter&&k.predicate===D){y[L]||(y[L]=[]);let b=`__${L}_timestamps`,Ue=`__${L}_indices`;y[b]||(y[b]=[]),y[Ue]||(y[Ue]=[]),y[L].includes(I)||(y[L].push(I),y[b].push(C.timestamp||""),y[Ue].push(x));break}}}if(T&&(y.author=T),$)if(typeof $=="string"&&$.includes("T"))y.createdAt=new Date($).getTime();else if(typeof $=="string"){let x=parseInt($,10);y.createdAt=isNaN(x)?$:x}else y.createdAt=$;if(A)if(typeof A=="string"&&A.includes("T"))y.updatedAt=new Date(A).getTime();else if(typeof A=="string"){let x=parseInt(A,10);y.updatedAt=isNaN(x)?A:x}else y.updatedAt=A;for(let[x,C]of Object.entries(n.collections)){let D=`__${x}_timestamps`,I=`__${x}_indices`;if(y[x]&&y[D]){let W=y[x].map((L,k)=>({value:L,timestamp:y[D][k]||"",originalIndex:y[I]?.[k]??k}));W.sort((L,k)=>{let b=String(L.timestamp||""),Ue=String(k.timestamp||""),ke=b.localeCompare(Ue);return ke!==0?ke:L.originalIndex-k.originalIndex}),y[x]=W.map(L=>L.value).filter(L=>L!=null&&L!==""&&L!=="None"),delete y[D],delete y[I]}}if(a.length>0||s.length>0){let x=[...a,...s];Object.keys(y).forEach(C=>{!x.includes(C)&&C!=="createdAt"&&C!=="updatedAt"&&C!=="author"&&C!=="baseExpression"&&delete y[C]})}o.push(y)}catch(f){console.error(`Failed to process SurrealDB instance ${d}:`,f)}}for(let p of o)await this.evaluateCustomGettersForInstance(p,e,n);for(let p of o)for(let[d,f]of Object.entries(n.collections))if(f.where?.isInstance&&p[d]?.length>0)try{let y=f.where.isInstance,$=p[d],A=typeof y=="string"?y:y.prototype?.className||y.name,T=await e.getSubjectClassMetadataFromSDNA(A);if(!T)continue;let N=await e.batchCheckSubjectInstances($,T);p[d]=N}catch{}let c=o;t.where&&(c=o.filter(p=>{for(let[d,f]of Object.entries(t.where))if(d!=="base"){if(d==="author"||d==="timestamp"){if(!this.matchesCondition(p[d],f))return!1;continue}if(typeof f=="object"&&f!==null&&!Array.isArray(f)){let y=f;if((y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&!this.matchesCondition(p[d],f))return!1}}return!0}));let l=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(l){let p=Object.keys(l)[0],d=Object.values(l)[0];c.sort((f,y)=>{let $=f[p],A=y[p];if($===void 0&&A===void 0)return 0;if($===void 0)return d==="ASC"?1:-1;if(A===void 0)return d==="ASC"?-1:1;let T=0;return typeof $=="number"&&typeof A=="number"?T=$-A:typeof $=="string"&&typeof A=="string"?T=$.localeCompare(A):T=String($).localeCompare(String(A)),d==="DESC"?-T:T})}let u=c.length,m=c;if(t.offset!==void 0||t.limit!==void 0){let p=t.offset||0,d=t.limit?p+t.limit:void 0;m=c.slice(p,d)}return{results:m,totalCount:u}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let r=t;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(e):e!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return e>=r.between[0]&&e<=r.between[1];let n=!0;return r.gt!==void 0&&(n=n&&e>r.gt),r.gte!==void 0&&(n=n&&e>=r.gte),r.lt!==void 0&&(n=n&&e<r.lt),r.lte!==void 0&&(n=n&&e<=r.lte),r.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(r.contains)):Array.isArray(e)?n=n&&e.includes(r.contains):n=!1),n}return e===t}static async findAll(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findAllAndCount(e,t={},r=!0){if(r){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,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),c=await e.querySurrealDB(o),{results:l,totalCount:u}=await this.instancesFromSurrealResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),c=await e.infer(o),{results:l,totalCount:u}=await this.instancesFromPrologResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{source:n,where:a}=t,s=r||await this.getClassName(e),o=[el(),Xc(n),tl(a)],c=[il(!0),rl(),nl(),al()];return`
1950
+ WHERE ${u.join(" AND ")}
1951
+ FETCH links
1952
+ `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} 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(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let c=bt(this)[n],l=c?.kind==="belongsToOne"||c?.kind==="belongsToMany";if(c){let d=J(c.predicate);if(Array.isArray(a)){let p=a.map(h=>this.formatSurrealValue(h)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${p}]]) > 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${p}]]) > 0`)}else if(typeof a=="object"&&a!==null){let p=a;if(p.not!==void 0)if(Array.isArray(p.not)){let h=p.not.map(w=>this.formatSurrealValue(w)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${h}]]) = 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${h}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${this.formatSurrealValue(p.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${this.formatSurrealValue(p.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${this.formatSurrealValue(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${this.formatSurrealValue(a)}]) > 0`);continue}let u=e.properties[n];if(!u)continue;let y=J(u.predicate),g=u.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let d=a.map(p=>this.formatSurrealValue(p)).join(", ");r.push(`count(->link[WHERE predicate = '${y}' AND ${g} IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let h=d.not.map(w=>this.formatSurrealValue(w)).join(", ");r.push(`count(->link[WHERE predicate = '${y}' AND ${g} IN [${h}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${y}' AND ${g} = ${this.formatSurrealValue(d.not)}]) = 0`);(d.gt!==void 0||d.gte!==void 0||d.lt!==void 0||d.lte!==void 0||d.between!==void 0||d.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${y}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${y}' AND ${g} = ${this.formatSurrealValue(a)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`${o} 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(", ");r.push(`${o} NOT IN [${l}]`)}else r.push(`${o} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(c.between[0])} AND ${o} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let c=J(o.predicate),l=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(y=>this.formatSurrealValue(y)).join(", ");r.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 g=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${g}])`)}else r.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)&&r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)})`)}return r.join(" AND ")}static buildSurrealSelectFields(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=J(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}' LIMIT 1) AS ${o}`)}let s=r||Object.keys(e.relations);for(let o of s){let c=e.relations[o];if(!c)continue;let l=J(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${l}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),n.join(`,
1953
+ `)}static buildSurrealSelectFieldsWithAggregation(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let c=e.properties[o];if(!c)continue;let l=J(c.predicate);n.push(`array::first(target[WHERE predicate = '${l}']) AS ${o}`)}let s=r||Object.keys(e.relations);for(let o of s){let c=e.relations[o];if(!c)continue;let l=J(c.predicate);n.push(`target[WHERE predicate = '${l}'] AS ${o}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS createdAt"),n.push("array::last(timestamp) AS updatedAt"),n.join(`,
1954
+ `)}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,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],s=(await Promise.all(r[0].AllInstances.map(async([c,l,u,y,g])=>{try{let d=new this(e,c);n.length&&Object.keys(d).forEach(h=>{!n.includes(h)&&h!=="createdAt"&&h!=="updatedAt"&&h!=="author"&&h!=="id"&&h!=="baseExpression"&&delete d[h]});let p=[...l,...u,["createdAt",y],["author",g]];return await ut.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${c}:`,d),null}}))).filter(c=>c!==null);t.include&&s.length>0&&await this.hydrateRelations(s,e,t.include);let o=t.include;for(let c of s)c.takeSnapshot(o);return{results:s,totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=[];for(let p of r){let h;try{if(h=p.source_uri,!h)continue;let w=p.links||[],E=new this(e,h);if(await this.hydrateFromLinks(E,w,n,e,a.length>0?a:void 0),a.length>0){let I=new Set(a);for(let k of Object.keys(n.properties))I.has(k)||delete E[k];for(let k of Object.keys(n.relations))!I.has(k)&&!(t.include&&k in t.include)&&delete E[k];for(let k of["author","createdAt","updatedAt"])I.has(k)||delete E[k]}s.push(E)}catch(w){console.error(`Failed to process SurrealDB instance ${h}:`,w)}}let o=bt(this),c=Object.entries(o).filter(([p,h])=>(h.kind==="belongsToOne"||h.kind==="belongsToMany")&&(a.length===0||a.includes(p)));c.length>0&&s.length>0&&await Promise.all(s.map(async p=>{for(let[h,w]of c){let I=(await e.get(new te({predicate:w.predicate,target:p.id}))).filter(k=>k.data.target===p.id).map(k=>k.data.source);w.kind==="belongsToOne"?p[h]=I.length>0?I[I.length-1]:null:p[h]=I}}));for(let p of s)await this.evaluateCustomGettersForInstance(p,e,n);let l=s;t.where&&(l=s.filter(p=>{for(let[h,w]of Object.entries(t.where))if(h!=="base"){if(h==="author"||h==="timestamp"){if(!this.matchesCondition(p[h],w))return!1;continue}if(typeof w=="object"&&w!==null&&!Array.isArray(w)){let E=w;if((E.gt!==void 0||E.gte!==void 0||E.lt!==void 0||E.lte!==void 0||E.between!==void 0||E.contains!==void 0)&&!this.matchesCondition(p[h],w))return!1}}return!0}));let u=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(u){let p=Object.entries(u);l.sort((h,w)=>{for(let[E,I]of p){let k=h[E],S=w[E];if(k===void 0&&S===void 0)continue;if(k===void 0)return I==="ASC"?1:-1;if(S===void 0)return I==="ASC"?-1:1;let T=0;if(typeof k=="number"&&typeof S=="number"?T=k-S:typeof k=="string"&&typeof S=="string"?T=k.localeCompare(S):T=String(k).localeCompare(String(S)),T!==0)return I==="DESC"?-T:T}return 0})}let y=l.length,g=l;if(t.offset!==void 0||t.limit!==void 0){let p=t.offset||0,h=t.limit?p+t.limit:void 0;g=l.slice(p,h)}t.include&&g.length>0&&await this.hydrateRelations(g,e,t.include);let d=t.include;for(let p of g)p.takeSnapshot(d);return{results:g,totalCount:y}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let r=t;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(e):e!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return e>=r.between[0]&&e<=r.between[1];let n=!0;return r.gt!==void 0&&(n=n&&e>r.gt),r.gte!==void 0&&(n=n&&e>=r.gte),r.lt!==void 0&&(n=n&&e<r.lt),r.lte!==void 0&&(n=n&&e<=r.lte),r.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(r.contains)):Array.isArray(e)?n=n&&e.includes(r.contains):n=!1),n}return e===t}static async findAll(e,t={},r=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findOne(e,t={},r=!0){let n={...t,limit:1};return(await this.findAll(e,n,r))[0]??null}static async findAllAndCount(e,t={},r=!0){if(r){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,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),c=await e.querySurrealDB(o),{results:l,totalCount:u}=await this.instancesFromSurrealResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),c=await e.infer(o),{results:l,totalCount:u}=await this.instancesFromPrologResult(e,s,c);return{results:l,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{where:n}=t,a=r||await this.getClassName(e),s=t.parent?Mr(t.parent,this):void 0,o=[tl(),el(t.parent,s),il(n)],c=[rl(!0),nl(),al(),sl()];return`
1962
1955
  findall([Base, Properties, Collections, Timestamp, Author], (
1963
- subject_class("${s}", SubjectClass),
1956
+ subject_class("${a}", SubjectClass),
1964
1957
  instance(SubjectClass, Base),
1965
1958
  ${o.filter(u=>u).join(", ")}
1966
1959
  ), UnsortedInstances),
1967
1960
  ${c.filter(u=>u).join(", ")}
1968
- `}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;t==null||t===""||(s&&(t=await Z(this,le,"f").createExpression(t,s)),await Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:t}],r))}async setCollectionSetter(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t!=null&&(Array.isArray(t)?await Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),t.map(s=>({name:"value",value:s})),r):await Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:t}],r))}async setCollectionAdder(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:s}],r))):await Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:t}],r))}async setCollectionRemover(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:s}],r))):await Z(this,le,"f").executeAction(a,Z(this,Oe,"f"),[{name:"value",value:t}],r))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r={};for(let[a,s]of Object.entries(this))s!=null&&!(Array.isArray(s)&&s.length>0)&&!s?.action&&(r[a]=s);let n=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(n,Z(this,Oe,"f"),r,e),await Z(this,le,"f").add(new Ye({source:Z(this,ma,"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[r,n]of t)n!=null&&r!=="author"&&r!=="timestamp"&&(e[r]=n);return e}async innerUpdate(e=!0,t){Fr(this,ga,await Z(this,le,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[n,a]of r)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))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 Fr(this,ga,await Z(this,le,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await Z(this,le,"f").removeSubject(this,Z(this,Oe,"f"),e)}static query(e,t){return new no(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 r=this.determineNamespace(e,t),n=class extends Ni{};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={},s={};if(e.properties)for(let[l,u]of Object.entries(e.properties)){let m=this.determinePredicate(e,l,u,r,t),p=e.required?.includes(l)||!1,d=So(u.type);if(ol(u)){s[l]={through:m,local:this.getPropertyOption(l,u,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let y=`add${ya(l)}`,$=`remove${ya(l)}`,A=`setCollection${ya(l)}`;n.prototype[y]=function(){},n.prototype[$]=function(){},n.prototype[A]=function(){}}else{let y=this.getPropertyOption(l,u,t,"resolveLanguage");!y&&t.resolveLanguage&&(y=t.resolveLanguage);let $=this.getPropertyOption(l,u,t,"local"),A=this.getPropertyOption(l,u,t,"writable",!0),T=this.getPropertyOption(l,u,t,"initial");if(cl(u)&&!y&&(y="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),y==null&&qh(u)&&(y="literal"),p&&!T&&(cl(u)?T="literal://json:{}":T="ad4m://undefined"),a[l]={through:m,required:p,writable:A,...y&&{resolveLanguage:y},...$!==void 0&&{local:$},...T&&{initial:T}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),A){let N=ka(l);n.prototype[N]=function(){}}}}if(!Object.values(a).some(l=>l.initial)){let l="ad4m://type",u;if(r.includes("://")){let[m,p]=r.split("://"),d=(p||"").replace(/\/+$/,"");d?u=`${m}://${d}/instance`:u=`${m}://instance`}else u=`${r.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=s,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Fh({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:
1961
+ `}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;t==null||t===""||(s&&(t=await this._perspective.createExpression(t,s)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],r))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(s=>({name:"value",value:this.resolveRelationId(s)})),r):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async addRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async removeRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r=this.constructor.getModelMetadata(),n=Object.values(r.properties).some(a=>a.required||a.flag||a.initial!==void 0);if(n){let a={};for(let[o,c]of Object.entries(this))c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action&&(a[o]=c);let s=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(s,this._baseExpression,a,e)}await this.innerUpdate(!n,e),t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),r={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let s=this[a];s!=null&&a!=="author"&&a!=="timestamp"&&(r[a]=s)}return r}async innerUpdate(e=!0,t){let r=this.constructor;this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy());let n=this._snapshot?new Set(this.changedFields()):null,a=r.getModelMetadata(),s=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),o=Object.entries(this);for(let[c,l]of o)if(!!s.has(c)&&!(n&&!n.has(c))&&l!=null){if(l?.action)switch(l.action){case"setter":await this.setRelationValues(c,l.value,t);break;case"adder":await this.addRelationValue(c,l.value,t);break;case"remover":await this.removeRelationValue(c,l.value,t);break;default:await this.setRelationValues(c,l.value,t);break}else if(Array.isArray(l))await this.setRelationValues(c,l,t);else if(l!=null&&l!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,l,t)}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=await this._perspective.get(new te({source:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new te({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},r){let n=new this(e);if(Object.assign(n,t),r?.parent&&!r?.batchId){let a=await e.createBatch();await n.save(a);let s=Mr(r.parent,this),o=new Ve({source:r.parent.id,predicate:s,target:n.id});return await e.add(o,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(r?.batchId),r?.parent){let a=Mr(r.parent,this),s=new Ve({source:r.parent.id,predicate:a,target:n.id});await e.add(s,"shared",r?.batchId)}return n}static async update(e,t,r){let n=new this(e,t);return await n.get(),Object.assign(n,r),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let r=await e.createBatch(),n=await t({batchId:r});return await e.commitBatch(r),n}static query(e,t){return new no(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 r=this.determineNamespace(e,t),n=class extends ut{};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={},s={};if(e.properties)for(let[c,l]of Object.entries(e.properties)){let u=this.determinePredicate(e,c,l,r,t),y=e.required?.includes(c)||!1,g=bo(l.type);if(cl(l)){s[c]={through:u,local:this.getPropertyOption(c,l,t,"local")},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:[]});let p=`add${ga(c)}`,h=`remove${ga(c)}`,w=`set${ga(c)}`;n.prototype[p]=function(){},n.prototype[h]=function(){},n.prototype[w]=function(){}}else{let p=this.getPropertyOption(c,l,t,"resolveLanguage");!p&&t.resolveLanguage&&(p=t.resolveLanguage);let h=this.getPropertyOption(c,l,t,"local"),w=this.getPropertyOption(c,l,t,"readOnly");if(w===void 0){let k=l["x-ad4m"]?.writable;w=k!==void 0?!k:!1}let E=!w,I=this.getPropertyOption(c,l,t,"initial");if(ll(l)&&!p&&(p="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),p==null&&zh(l)&&(p="literal"),p==null&&(p="literal"),y&&!I&&(ll(l)?I="literal://json:{}":I="ad4m://undefined"),a[c]={through:u,required:y,writable:E,...p&&{resolveLanguage:p},...h!==void 0&&{local:h},...I&&{initial:I}},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(g)}),E){let k=Aa(c);n.prototype[k]=function(){}}}}for(let[c,l]of Object.entries(a))Ad(n,c,l);for(let[c,l]of Object.entries(s))kd(n,c,{predicate:l.through||"",kind:"hasMany",...l.getter!==void 0&&{getter:l.getter},...l.local!==void 0&&{local:l.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Id({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:
1969
1962
  - options.namespace
1970
1963
  - schema["x-ad4m"].namespace
1971
1964
  - schema.title
1972
- - valid schema.$id`)}static determinePredicate(e,t,r,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(a.predicateTemplate){let o=sl(n),[c,l]=o.includes("://")?o.split("://"):["",o],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 s=sl(n);return s.includes("://")?`${s}${t}`:`${s}://${t}`}static getPropertyOption(e,t,r,n,a){return r.propertyOptions?.[e]?.[n]!==void 0?r.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:r[n]!==void 0?r[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""}}};Oe=new WeakMap,ga=new WeakMap,ma=new WeakMap,le=new WeakMap;Ni.classNamesByClass=new WeakMap;var no=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}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:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:r}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return r}}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 r=async a=>{let{results:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);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 r=async a=>{let{results:s}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);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:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}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 r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);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 r=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(r),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){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 s=async l=>{let{results:u,totalCount:m}=await this.ctor.instancesFromSurrealResult(this.perspective,n,l);r({results:u,totalCount:m,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:o,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 s=async l=>{let{results:u,totalCount:m}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);r({results:u,totalCount:m,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:o,totalCount:c,pageSize:e,pageNumber:t}}}};var gt=class extends Pe{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return P`
1965
+ - valid schema.$id`)}static determinePredicate(e,t,r,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(a.predicateTemplate){let o=ol(n),[c,l]=o.includes("://")?o.split("://"):["",o],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 s=ol(n);return s.includes("://")?`${s}${t}`:`${s}://${t}`}static getPropertyOption(e,t,r,n,a){return r.propertyOptions?.[e]?.[n]!==void 0?r.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:r[n]!==void 0?r[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""}}};ut.classNamesByClass=new WeakMap;var no=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}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}parent(e,t,r){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let s=e.constructor;return this.queryParams.parent={id:n,model:s,field:t.field},this}let a=r?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let r=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async s=>{let{results:o}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let r=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async s=>{let{results:o}=await t.instancesFromPrologResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}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 r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(n),n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let s=a?.[0]?.TotalCount||0;e(s)};this.currentSubscription.onResult(r);let n=this.currentSubscription.result?.[0]?.TotalCount||0;return e(n),n}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){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 s=async u=>{let{results:y,totalCount:g}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:y,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),l={results:o,totalCount:c,pageSize:e,pageNumber:t};return r(l),l}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async u=>{let{results:y,totalCount:g}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:y,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),l={results:o,totalCount:c,pageSize:e,pageNumber:t};return r(l),l}}};function So(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function Kh(i,e){let t=e.properties,r=Object.values(t).filter(s=>s.flag&&s.predicate&&s.initial);if(r.length>0){let s=r.map(o=>`triple(X, '${o.predicate}', '${o.initial}')`).join(`,
1966
+ `);return`${i}(X) :-
1967
+ ${s}.`}let n=Object.values(t).filter(s=>s.required&&s.predicate&&!s.flag);if(n.length>0){let s=n.map(o=>`triple(X, '${o.predicate}', _)`).join(`,
1968
+ `);return`${i}(X) :-
1969
+ ${s}.`}let a=Object.values(t).filter(s=>s.predicate).map(s=>s.predicate);if(e.relations)for(let s of Object.values(e.relations))s.predicate&&a.push(s.predicate);if(a.length>0){let s=a.map(o=>`triple(X, '${o}', _)`).join(` ;
1970
+ `);return`${i}(X) :-
1971
+ (${s}).`}return null}function Wh(i,e){return e.flag||!e.predicate?null:`${`${i}_${So(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function Qh(i,e){if(!e.predicate)return null;let t=`${i}_${So(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function u0(i){let e=i.getModelMetadata(),t=So(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=Kh(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>Wh(t,o)).filter(o=>o!==null);a.length>0&&(r.push(""),r.push("% Field getters"),r.push(...a));let s=Object.values(e.relations).map(o=>Qh(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
1972
+ `)}var ft=class extends Te{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return N`
1973
1973
  <div class="container">
1974
1974
  <div class="back-button" @click=${this.back}>
1975
- ${rr()}
1975
+ ${ir()}
1976
1976
  </div>
1977
1977
 
1978
1978
  <div class="header">
@@ -1981,14 +1981,14 @@ WHERE ${m.join(" AND ")}
1981
1981
  </div>
1982
1982
 
1983
1983
  <div class="connection-icons">
1984
- ${this.appiconpath?P`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:P`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
1984
+ ${this.appiconpath?N`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:N`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
1985
1985
  <div class="arrow-icon">${Fn()}</div>
1986
- <div class="ad4m-logo">${mi()}</div>
1986
+ <div class="ad4m-logo">${gi()}</div>
1987
1987
  </div>
1988
1988
 
1989
- ${this.requestSent?P`
1989
+ ${this.requestSent?N`
1990
1990
  <div class="state success" style="margin-bottom: -12px">
1991
- ${pt()}
1991
+ ${ct()}
1992
1992
  <p>Auth request sent to local AD4M node</p>
1993
1993
  </div>
1994
1994
 
@@ -2006,17 +2006,17 @@ WHERE ${m.join(" AND ")}
2006
2006
  />
2007
2007
  </div>
2008
2008
 
2009
- ${this.verificationError?P`
2009
+ ${this.verificationError?N`
2010
2010
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2011
- ${Me()}
2011
+ ${Re()}
2012
2012
  <p>Verification failed. Please try again.</p>
2013
2013
  </div>
2014
2014
  `:""}
2015
- `:P`
2015
+ `:N`
2016
2016
  <p>This will allow ${this.appname} to</p>
2017
2017
 
2018
2018
  <ul class="box">
2019
- ${this.capabilities.map(t=>P`<li>${pt()}<p>${_l(t)}</p></li>`)}
2019
+ ${this.capabilities.map(t=>N`<li>${ct()}<p>${$l(t)}</p></li>`)}
2020
2020
  </ul>
2021
2021
 
2022
2022
  <div class="row center">
@@ -2026,7 +2026,7 @@ WHERE ${m.join(" AND ")}
2026
2026
  </div>
2027
2027
  `}
2028
2028
  </div>
2029
- `}};gt.styles=[Bt,Ze`
2029
+ `}};ft.styles=[jt,We`
2030
2030
  h1 {
2031
2031
  font-size: 34px;
2032
2032
  }
@@ -2108,17 +2108,17 @@ WHERE ${m.join(" AND ")}
2108
2108
  .state {
2109
2109
  justify-content: center;
2110
2110
  }
2111
- `],B([fe({type:Array})],gt.prototype,"capabilities",2),B([fe({type:String})],gt.prototype,"appname",2),B([fe({type:String})],gt.prototype,"appiconpath",2),B([fe({type:Boolean})],gt.prototype,"verificationError",2),B([ue()],gt.prototype,"requestSent",2),B([ue()],gt.prototype,"securityCode",2),gt=B([mt("local-authentication")],gt);var at=class extends Pe{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,r=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,s=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return P`
2111
+ `],F([de({type:Array})],ft.prototype,"capabilities",2),F([de({type:String})],ft.prototype,"appname",2),F([de({type:String})],ft.prototype,"appiconpath",2),F([de({type:Boolean})],ft.prototype,"verificationError",2),F([ce()],ft.prototype,"requestSent",2),F([ce()],ft.prototype,"securityCode",2),ft=F([ht("local-authentication")],ft);var tt=class extends Te{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,r=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,s=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return N`
2112
2112
  <div class="container">
2113
2113
  <div class="back-button" @click=${this.back}>
2114
- ${rr()}
2114
+ ${ir()}
2115
2115
  </div>
2116
2116
 
2117
2117
  <div class="header">
2118
2118
  <h1>Login</h1>
2119
2119
  </div>
2120
2120
 
2121
- ${t?P`
2121
+ ${t?N`
2122
2122
  <h3>Enter your email to login to the remote node</h3>
2123
2123
 
2124
2124
  <div class="input-row">
@@ -2138,9 +2138,9 @@ WHERE ${m.join(" AND ")}
2138
2138
  </div>
2139
2139
  `:""}
2140
2140
 
2141
- ${s?P`
2141
+ ${s?N`
2142
2142
  <div class="state danger">
2143
- ${Me()}
2143
+ ${Re()}
2144
2144
  <p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
2145
2145
  </div>
2146
2146
 
@@ -2151,9 +2151,9 @@ WHERE ${m.join(" AND ")}
2151
2151
  </div>
2152
2152
  `:""}
2153
2153
 
2154
- ${r?P`
2154
+ ${r?N`
2155
2155
  <div class="state success" style="margin-bottom: -12px">
2156
- ${pt()}
2156
+ ${ct()}
2157
2157
  <p>Email verification code sent</p>
2158
2158
  </div>
2159
2159
 
@@ -2171,17 +2171,17 @@ WHERE ${m.join(" AND ")}
2171
2171
  />
2172
2172
  </div>
2173
2173
 
2174
- ${this.emailCodeError?P`
2174
+ ${this.emailCodeError?N`
2175
2175
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2176
- ${Me()}
2176
+ ${Re()}
2177
2177
  <p>Verification failed. Please try again.</p>
2178
2178
  </div>
2179
2179
  `:""}
2180
2180
  `:""}
2181
2181
 
2182
- ${n?P`
2182
+ ${n?N`
2183
2183
  <div class="state success" style="margin-bottom: -12px">
2184
- ${pt()}
2184
+ ${ct()}
2185
2185
  <p>Account found</p>
2186
2186
  </div>
2187
2187
 
@@ -2203,17 +2203,17 @@ WHERE ${m.join(" AND ")}
2203
2203
  </button>
2204
2204
  </div>
2205
2205
 
2206
- ${this.passwordError?P`
2206
+ ${this.passwordError?N`
2207
2207
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2208
- ${Me()}
2208
+ ${Re()}
2209
2209
  <p>Incorrect password. Please try again.</p>
2210
2210
  </div>
2211
2211
  `:""}
2212
2212
  `:""}
2213
2213
 
2214
- ${a?P`
2214
+ ${a?N`
2215
2215
  <div class="state danger">
2216
- ${Me()}
2216
+ ${Re()}
2217
2217
  <p>Email not found</p>
2218
2218
  </div>
2219
2219
 
@@ -2235,16 +2235,16 @@ WHERE ${m.join(" AND ")}
2235
2235
  </button>
2236
2236
  </div>
2237
2237
 
2238
- ${this.accountCreationError?P`
2238
+ ${this.accountCreationError?N`
2239
2239
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2240
- ${Me()}
2240
+ ${Re()}
2241
2241
  <p>Failed to create account. Please try again.</p>
2242
2242
  </div>
2243
2243
  `:""}
2244
2244
  `:""}
2245
2245
 
2246
2246
  </div>
2247
- `}};at.styles=[Bt,Ze`
2247
+ `}};tt.styles=[jt,We`
2248
2248
  .header h1 {
2249
2249
  font-size: 32px;
2250
2250
  margin-bottom: 0;
@@ -2290,10 +2290,10 @@ WHERE ${m.join(" AND ")}
2290
2290
  .state {
2291
2291
  justify-content: center;
2292
2292
  }
2293
- `],B([fe({type:Object})],at.prototype,"remoteAuthState",2),B([fe({type:Boolean})],at.prototype,"remoteAuthLoading",2),B([fe({type:Boolean})],at.prototype,"emailCodeError",2),B([fe({type:Boolean})],at.prototype,"passwordError",2),B([fe({type:Boolean})],at.prototype,"accountCreationError",2),B([ue()],at.prototype,"email",2),B([ue()],at.prototype,"password",2),B([ue()],at.prototype,"emailSecurityCode",2),at=B([mt("remote-authentication")],at);var li=class extends Pe{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return P`
2293
+ `],F([de({type:Object})],tt.prototype,"remoteAuthState",2),F([de({type:Boolean})],tt.prototype,"remoteAuthLoading",2),F([de({type:Boolean})],tt.prototype,"emailCodeError",2),F([de({type:Boolean})],tt.prototype,"passwordError",2),F([de({type:Boolean})],tt.prototype,"accountCreationError",2),F([ce()],tt.prototype,"email",2),F([ce()],tt.prototype,"password",2),F([ce()],tt.prototype,"emailSecurityCode",2),tt=F([ht("remote-authentication")],tt);var ci=class extends Te{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return N`
2294
2294
  <div class="container">
2295
2295
  <div class="close-button" @click=${this.close}>
2296
- ${Me()}
2296
+ ${Re()}
2297
2297
  </div>
2298
2298
 
2299
2299
  <div class="header">
@@ -2303,11 +2303,11 @@ WHERE ${m.join(" AND ")}
2303
2303
 
2304
2304
  <div class="box">
2305
2305
  <div class="box-header">
2306
- ${t?tr():ir()}
2306
+ ${t?er():tr()}
2307
2307
  <h3>${t?"Local Node":"Remote Node"}</h3>
2308
2308
  </div>
2309
2309
 
2310
- ${t?P`
2310
+ ${t?N`
2311
2311
  <div class="row">
2312
2312
  <span>Port:</span>
2313
2313
  <span class="detail-value">${this.port}</span>
@@ -2316,7 +2316,7 @@ WHERE ${m.join(" AND ")}
2316
2316
  <span>URL:</span>
2317
2317
  <span class="detail-value">${this.url}</span>
2318
2318
  </div>
2319
- `:P`
2319
+ `:N`
2320
2320
  <div class="row">
2321
2321
  <span>URL:</span>
2322
2322
  <span class="detail-value">${this.url}</span>
@@ -2335,7 +2335,7 @@ WHERE ${m.join(" AND ")}
2335
2335
  </button>
2336
2336
  </div>
2337
2337
  </div>
2338
- `}};li.styles=[Bt,Ze`
2338
+ `}};ci.styles=[jt,We`
2339
2339
  .box {
2340
2340
  gap: 15px;
2341
2341
  }
@@ -2370,7 +2370,7 @@ WHERE ${m.join(" AND ")}
2370
2370
  background: rgba(244, 54, 127, 0.2);
2371
2371
  color: var(--ac-danger-color);
2372
2372
  }
2373
- `],B([fe({type:String})],li.prototype,"url",2),B([fe({type:Number})],li.prototype,"port",2),B([fe({type:String})],li.prototype,"authState",2),li=B([mt("current-state")],li);var Vh=Ze`
2373
+ `],F([de({type:String})],ci.prototype,"url",2),F([de({type:Number})],ci.prototype,"port",2),F([de({type:String})],ci.prototype,"authState",2),ci=F([ht("current-state")],ci);var Gh=We`
2374
2374
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
2375
2375
 
2376
2376
  :host {
@@ -2455,7 +2455,7 @@ WHERE ${m.join(" AND ")}
2455
2455
  height: 34px;
2456
2456
  z-index: 99999;
2457
2457
  }
2458
- `,De=class extends Pe{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),ps(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return Ee(this,null,function*(){this.core.port=t.detail.port,On("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return Ee(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,On("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return Ee(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return Ee(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,On("ad4m-url",this.core.url);try{if(yield Dn(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return Ee(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return Ee(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(this.modalOpen=!1)}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return Ee(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(this.modalOpen=!1)}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return Ee(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(this.modalOpen=!1)}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return Ee(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return P`
2458
+ `,Ne=class extends Te{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),ps(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return Se(this,null,function*(){this.core.port=t.detail.port,On("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return Se(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,On("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return Se(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return Se(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,On("ad4m-url",this.core.url);try{if(yield Dn(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(this.modalOpen=!1)}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(this.modalOpen=!1)}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(this.modalOpen=!1)}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return Se(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return N`
2459
2459
  <connection-options
2460
2460
  .port=${this.core.port}
2461
2461
  .remoteUrl=${this.core.options.remoteUrl}
@@ -2467,7 +2467,7 @@ WHERE ${m.join(" AND ")}
2467
2467
  @connect-remote-node=${this.connectRemoteNode}
2468
2468
  @clear-remote-node-error=${()=>{this.remoteNodeError=!1}}
2469
2469
  ></connection-options>
2470
- `;if(this.currentView==="local-authentication")return P`
2470
+ `;if(this.currentView==="local-authentication")return N`
2471
2471
  <local-authentication
2472
2472
  .capabilities=${this.core.options.capabilities}
2473
2473
  .appname=${this.core.options.appInfo.name}
@@ -2478,7 +2478,7 @@ WHERE ${m.join(" AND ")}
2478
2478
  @verify-code=${this.verifyLocalAd4mCode}
2479
2479
  @clear-verification-error=${()=>{this.verificationError=!1}}
2480
2480
  ></local-authentication>
2481
- `;if(this.currentView==="remote-authentication")return P`
2481
+ `;if(this.currentView==="remote-authentication")return N`
2482
2482
  <remote-authentication
2483
2483
  .remoteAuthLoading=${this.remoteAuthLoading}
2484
2484
  .remoteAuthState=${this.remoteAuthState}
@@ -2492,7 +2492,7 @@ WHERE ${m.join(" AND ")}
2492
2492
  @create-account=${this.createAccount}
2493
2493
  @clear-email-code-error=${()=>{this.emailCodeError=!1}}
2494
2494
  ></remote-authentication>
2495
- `;if(this.currentView==="current-state")return P`
2495
+ `;if(this.currentView==="current-state")return N`
2496
2496
  <current-state
2497
2497
  .url=${this.core.url}
2498
2498
  .port=${this.core.port}
@@ -2500,11 +2500,11 @@ WHERE ${m.join(" AND ")}
2500
2500
  @close=${()=>{this.modalOpen=!1}}
2501
2501
  @disconnect=${this.disconnect}
2502
2502
  ></current-state>
2503
- `}render(){return this.modalOpen?P`
2503
+ `}render(){return this.modalOpen?N`
2504
2504
  <div class="wrapper">
2505
2505
  <div class="modal">
2506
2506
  <header class="modal-header">
2507
- ${mi()}
2507
+ ${gi()}
2508
2508
  </header>
2509
2509
  <main class="modal-content">
2510
2510
  ${this.renderViews()}
@@ -2512,16 +2512,16 @@ WHERE ${m.join(" AND ")}
2512
2512
  </div>
2513
2513
  <div class="backdrop" />
2514
2514
  </div>
2515
- `:this.core.authState==="authenticated"?P`
2515
+ `:this.core.authState==="authenticated"?N`
2516
2516
  <button
2517
2517
  type="button"
2518
2518
  class="settings-button"
2519
2519
  aria-label="Open settings"
2520
2520
  @click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
2521
2521
  >
2522
- ${mi()}
2522
+ ${gi()}
2523
2523
  </button>
2524
- `:null}};De.styles=[Vh],B([ue()],De.prototype,"modalOpen",2),B([ue()],De.prototype,"currentView",2),B([ue()],De.prototype,"connectingToRemoteNode",2),B([ue()],De.prototype,"remoteNodeError",2),B([ue()],De.prototype,"verificationError",2),B([ue()],De.prototype,"remoteAuthLoading",2),B([ue()],De.prototype,"remoteAuthState",2),B([ue()],De.prototype,"emailCodeError",2),B([ue()],De.prototype,"passwordError",2),B([ue()],De.prototype,"accountCreationError",2),De=B([mt("ad4m-connect")],De);function zh(i){let e=new De;return e.core=i,i.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}export{De as Ad4mConnectElement,zh as default};
2524
+ `:null}};Ne.styles=[Gh],F([ce()],Ne.prototype,"modalOpen",2),F([ce()],Ne.prototype,"currentView",2),F([ce()],Ne.prototype,"connectingToRemoteNode",2),F([ce()],Ne.prototype,"remoteNodeError",2),F([ce()],Ne.prototype,"verificationError",2),F([ce()],Ne.prototype,"remoteAuthLoading",2),F([ce()],Ne.prototype,"remoteAuthState",2),F([ce()],Ne.prototype,"emailCodeError",2),F([ce()],Ne.prototype,"passwordError",2),F([ce()],Ne.prototype,"accountCreationError",2),Ne=F([ht("ad4m-connect")],Ne);function Zh(i){let e=new Ne;return e.core=i,i.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}export{Ne as Ad4mConnectElement,Zh as default};
2525
2525
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2526
2526
  /**
2527
2527
  * @license