@coasys/ad4m-connect 0.12.0 → 0.13.0-test-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1,49 +1,71 @@
1
- var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Object.getPrototypeOf;var ku=Reflect.get;var j=(i,e,t,r)=>{for(var n=r>1?void 0:r?$u(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&&xu(e,t,n),n};var ko=(i,e,t)=>ku(Au(i),t,e);var _e=(i,e,t)=>new Promise((r,n)=>{var a=l=>{try{o(t.next(l))}catch(c){n(c)}},s=l=>{try{o(t.throw(l))}catch(c){n(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((t=t.apply(i,e)).next())});var Dn=window,Mn=Dn.ShadowRoot&&(Dn.ShadyCSS===void 0||Dn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ts=Symbol(),Io=new WeakMap,Pr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==ts)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(Mn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Io.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Io.set(t,e))}return e}toString(){return this.cssText}},To=i=>new Pr(typeof i=="string"?i:i+"",void 0,ts),Je=(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 Pr(t,i,ts)},is=(i,e)=>{Mn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Dn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Un=Mn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return To(t)})(i):i;var rs,Fn=window,Co=Fn.trustedTypes,Iu=Co?Co.emptyScript:"",Lo=Fn.reactiveElementPolyfillSupport,as={toAttribute(i,e){switch(e){case Boolean:i=i?Iu: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}},No=(i,e)=>e!==i&&(e==e||i==i),ns={attribute:!0,type:String,converter:as,reflect:!1,hasChanged:No},ss="finalized",Lt=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=ns){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)||ns}static finalize(){if(this.hasOwnProperty(ss))return!1;this[ss]=!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(Un(n))}else e!==void 0&&t.push(Un(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 is(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=ns){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:as).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:as;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||No)(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){}};Lt[ss]=!0,Lt.elementProperties=new Map,Lt.elementStyles=[],Lt.shadowRootOptions={mode:"open"},Lo?.({ReactiveElement:Lt}),((rs=Fn.reactiveElementVersions)!==null&&rs!==void 0?rs:Fn.reactiveElementVersions=[]).push("1.6.3");var os,jn=window,Xi=jn.trustedTypes,Ro=Xi?Xi.createPolicy("lit-html",{createHTML:i=>i}):void 0,ls="$lit$",jt=`lit$${(Math.random()+"").slice(9)}$`,jo="?"+jt,Tu=`<${jo}>`,pi=document,Dr=()=>pi.createComment(""),Mr=i=>i===null||typeof i!="object"&&typeof i!="function",Bo=Array.isArray,Cu=i=>Bo(i)||typeof i?.[Symbol.iterator]=="function",cs=`[
2
- \f\r]`,Or=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,Oo=/>/g,ui=RegExp(`>|${cs}(?:([^\\s"'>=/]+)(${cs}*=${cs}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Do=/'/g,Mo=/"/g,qo=/^(?:script|style|textarea|title)$/i,Ho=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),N=Ho(1),xg=Ho(2),fi=Symbol.for("lit-noChange"),Ee=Symbol.for("lit-nothing"),Uo=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Vo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ro!==void 0?Ro.createHTML(e):e}var Lu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Or;for(let o=0;o<t;o++){let l=i[o],c,u,m=-1,y=0;for(;y<l.length&&(s.lastIndex=y,u=s.exec(l),u!==null);)y=s.lastIndex,s===Or?u[1]==="!--"?s=Po:u[1]!==void 0?s=Oo:u[2]!==void 0?(qo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Or,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ui:u[3]==='"'?Mo:Do):s===Mo||s===Do?s=ui:s===Po||s===Oo?s=Or:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Or?l+Tu:m>=0?(r.push(c),l.slice(0,m)+ls+l.slice(m)+jt+d):l+jt+(m===-2?(r.push(void 0),o):d)}return[Vo(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,l=this.parts,[c,u]=Lu(e,t);if(this.el=hi.createElement(c,r),di.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=di.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(ls)||y.startsWith(jt)){let d=u[s++];if(m.push(y),d!==void 0){let p=n.getAttribute(d.toLowerCase()+ls).split(jt),f=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:f[2],strings:p,ctor:f[1]==="."?ds:f[1]==="?"?ps:f[1]==="@"?fs:tr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(qo.test(n.tagName)){let m=n.textContent.split(jt),y=m.length-1;if(y>0){n.textContent=Xi?Xi.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Dr()),di.nextNode(),l.push({type:2,index:++a});n.append(m[y],Dr())}}}else if(n.nodeType===8)if(n.data===jo)l.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(jt,m+1))!==-1;)l.push({type:7,index:a}),m+=jt.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function er(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Mr(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:t._$Cl=l),l!==void 0&&(e=er(i,l._$AS(i,e.values),l,r)),e}var us=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,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new gi(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new hs(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.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=Ee,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=er(this,e,t),Mr(e)?e===Ee||e==null||e===""?(this._$AH!==Ee&&this._$AR(),this._$AH=Ee):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Cu(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!==Ee&&Mr(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(Vo(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 us(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Uo.get(e.strings);return t===void 0&&Uo.set(e.strings,t=new hi(e)),t}T(e){Bo(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(Dr()),this.k(Dr()),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))}},tr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=Ee,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=Ee}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=er(this,e,t,0),s=!Mr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=er(this,o[r+l],t,l),c===fi&&(c=this._$AH[l]),s||(s=!Mr(c)||c!==this._$AH[l]),c===Ee?e=Ee:e!==Ee&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===Ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ds=class extends tr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ee?void 0:e}},Nu=Xi?Xi.emptyScript:"",ps=class extends tr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ee?this.element.setAttribute(this.name,Nu):this.element.removeAttribute(this.name)}},fs=class extends tr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=er(this,e,t,0))!==null&&r!==void 0?r:Ee)===fi)return;let n=this._$AH,a=e===Ee&&n!==Ee||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ee&&(n===Ee||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)}},hs=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){er(this,e)}};var Fo=jn.litHtmlPolyfillSupport;Fo?.(hi,gi),((os=jn.litHtmlVersions)!==null&&os!==void 0?os:jn.litHtmlVersions=[]).push("2.8.0");var zo=(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(Dr(),o),o,void 0,t??{})}return s._$AI(i),s};var gs,ms;var Le=class extends Lt{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=zo(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}};Le.finalized=!0,Le._$litElement$=!0,(gs=globalThis.litElementHydrateSupport)===null||gs===void 0||gs.call(globalThis,{LitElement:Le});var Wo=globalThis.litElementPolyfillSupport;Wo?.({LitElement:Le});((ms=globalThis.litElementVersions)!==null&&ms!==void 0?ms:globalThis.litElementVersions=[]).push("3.3.3");var gt=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 Ru=(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)}},Pu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?Pu(i,e,t):Ru(i,e)}function ue(i){return fe({...i,state:!0})}var ys,Jg=((ys=window.HTMLSlotElement)===null||ys===void 0?void 0:ys.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Ou=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 vs(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 Ou(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 Ko="0.12.0";function Mu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Bn(i,e){Mu()&&localStorage.setItem(`${Ko}/${i}`,e)}function qn(i,e=1e4){return _e(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 N`
1
+ var Fo=Object.defineProperty,Bu=Object.defineProperties,Hu=Object.getOwnPropertyDescriptor,qu=Object.getOwnPropertyDescriptors;var Uo=Object.getOwnPropertySymbols,zu=Object.getPrototypeOf,Vu=Object.prototype.hasOwnProperty,Wu=Object.prototype.propertyIsEnumerable,Ku=Reflect.get;var Mo=(i,e,t)=>e in i?Fo(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,jo=(i,e)=>{for(var t in e||={})Vu.call(e,t)&&Mo(i,t,e[t]);if(Uo)for(var t of Uo(e))Wu.call(e,t)&&Mo(i,t,e[t]);return i},Bo=(i,e)=>Bu(i,qu(e));var C=(i,e,t,r)=>{for(var n=r>1?void 0:r?Hu(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&&Fo(e,t,n),n};var Ho=(i,e,t)=>Ku(zu(i),t,e);var pe=(i,e,t)=>new Promise((r,n)=>{var a=l=>{try{o(t.next(l))}catch(c){n(c)}},s=l=>{try{o(t.throw(l))}catch(c){n(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((t=t.apply(i,e)).next())});var qn=window,zn=qn.ShadowRoot&&(qn.ShadyCSS===void 0||qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,us=Symbol(),qo=new WeakMap,Ur=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==us)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(zn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=qo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&qo.set(t,e))}return e}toString(){return this.cssText}},zo=i=>new Ur(typeof i=="string"?i:i+"",void 0,us),$e=(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 Ur(t,i,us)},ds=(i,e)=>{zn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=qn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Vn=zn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return zo(t)})(i):i;var ps,Wn=window,Vo=Wn.trustedTypes,Qu=Vo?Vo.emptyScript:"",Wo=Wn.reactiveElementPolyfillSupport,fs={toAttribute(i,e){switch(e){case Boolean:i=i?Qu: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),hs={attribute:!0,type:String,converter:fs,reflect:!1,hasChanged:Ko},gs="finalized",Ot=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=hs){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)||hs}static finalize(){if(this.hasOwnProperty(gs))return!1;this[gs]=!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(Vn(n))}else e!==void 0&&t.push(Vn(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 ds(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=hs){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:fs).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:fs;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){}};Ot[gs]=!0,Ot.elementProperties=new Map,Ot.elementStyles=[],Ot.shadowRootOptions={mode:"open"},Wo?.({ReactiveElement:Ot}),((ps=Wn.reactiveElementVersions)!==null&&ps!==void 0?ps:Wn.reactiveElementVersions=[]).push("1.6.3");var ms,Kn=window,sr=Kn.trustedTypes,Qo=sr?sr.createPolicy("lit-html",{createHTML:i=>i}):void 0,vs="$lit$",Wt=`lit$${(Math.random()+"").slice(9)}$`,tc="?"+Wt,Gu=`<${tc}>`,wi=document,Fr=()=>wi.createComment(""),jr=i=>i===null||typeof i!="object"&&typeof i!="function",ic=Array.isArray,Zu=i=>ic(i)||typeof i?.[Symbol.iterator]=="function",ys=`[
2
+ \f\r]`,Mr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Go=/-->/g,Zo=/>/g,vi=RegExp(`>|${ys}(?:([^\\s"'>=/]+)(${ys}*=${ys}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Jo=/'/g,Yo=/"/g,rc=/^(?:script|style|textarea|title)$/i,nc=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),k=nc(1),Wg=nc(2),Si=Symbol.for("lit-noChange"),ke=Symbol.for("lit-nothing"),Xo=new WeakMap,bi=wi.createTreeWalker(wi,129,null,!1);function ac(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qo!==void 0?Qo.createHTML(e):e}var Ju=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Mr;for(let o=0;o<t;o++){let l=i[o],c,u,m=-1,y=0;for(;y<l.length&&(s.lastIndex=y,u=s.exec(l),u!==null);)y=s.lastIndex,s===Mr?u[1]==="!--"?s=Go:u[1]!==void 0?s=Zo:u[2]!==void 0?(rc.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=vi):u[3]!==void 0&&(s=vi):s===vi?u[0]===">"?(s=n??Mr,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?vi:u[3]==='"'?Yo:Jo):s===Yo||s===Jo?s=vi:s===Go||s===Zo?s=Mr:(s=vi,n=void 0);let d=s===vi&&i[o+1].startsWith("/>")?" ":"";a+=s===Mr?l+Gu:m>=0?(r.push(c),l.slice(0,m)+vs+l.slice(m)+Wt+d):l+Wt+(m===-2?(r.push(void 0),o):d)}return[ac(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},_i=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,l=this.parts,[c,u]=Ju(e,t);if(this.el=_i.createElement(c,r),bi.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=bi.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(vs)||y.startsWith(Wt)){let d=u[s++];if(m.push(y),d!==void 0){let h=n.getAttribute(d.toLowerCase()+vs).split(Wt),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:g[2],strings:h,ctor:g[1]==="."?ws:g[1]==="?"?Ss:g[1]==="@"?_s:cr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(rc.test(n.tagName)){let m=n.textContent.split(Wt),y=m.length-1;if(y>0){n.textContent=sr?sr.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Fr()),bi.nextNode(),l.push({type:2,index:++a});n.append(m[y],Fr())}}}else if(n.nodeType===8)if(n.data===tc)l.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(Wt,m+1))!==-1;)l.push({type:7,index:a}),m+=Wt.length-1}a++}}static createElement(e,t){let r=wi.createElement("template");return r.innerHTML=e,r}};function or(i,e,t=i,r){var n,a,s,o;if(e===Si)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=jr(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:t._$Cl=l),l!==void 0&&(e=or(i,l._$AS(i,e.values),l,r)),e}var bs=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:wi).importNode(r,!0);bi.currentNode=a;let s=bi.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new xi(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new xs(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=bi.nextNode(),o++)}return bi.currentNode=wi,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++}},xi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=ke,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=or(this,e,t),jr(e)?e===ke||e==null||e===""?(this._$AH!==ke&&this._$AR(),this._$AH=ke):e!==this._$AH&&e!==Si&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Zu(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!==ke&&jr(this._$AH)?this._$AA.nextSibling.data=e:this.$(wi.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=_i.createElement(ac(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 bs(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Xo.get(e.strings);return t===void 0&&Xo.set(e.strings,t=new _i(e)),t}T(e){ic(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 xi(this.k(Fr()),this.k(Fr()),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))}},cr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=ke,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=ke}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=or(this,e,t,0),s=!jr(e)||e!==this._$AH&&e!==Si,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=or(this,o[r+l],t,l),c===Si&&(c=this._$AH[l]),s||(s=!jr(c)||c!==this._$AH[l]),c===ke?e=ke:e!==ke&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===ke?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ws=class extends cr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ke?void 0:e}},Yu=sr?sr.emptyScript:"",Ss=class extends cr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==ke?this.element.setAttribute(this.name,Yu):this.element.removeAttribute(this.name)}},_s=class extends cr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=or(this,e,t,0))!==null&&r!==void 0?r:ke)===Si)return;let n=this._$AH,a=e===ke&&n!==ke||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==ke&&(n===ke||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)}},xs=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){or(this,e)}};var ec=Kn.litHtmlPolyfillSupport;ec?.(_i,xi),((ms=Kn.litHtmlVersions)!==null&&ms!==void 0?ms:Kn.litHtmlVersions=[]).push("2.8.0");var sc=(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 xi(e.insertBefore(Fr(),o),o,void 0,t??{})}return s._$AI(i),s};var Es,$s;var ge=class extends Ot{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=sc(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 Si}};ge.finalized=!0,ge._$litElement$=!0,(Es=globalThis.litElementHydrateSupport)===null||Es===void 0||Es.call(globalThis,{LitElement:ge});var oc=globalThis.litElementPolyfillSupport;oc?.({LitElement:ge});(($s=globalThis.litElementVersions)!==null&&$s!==void 0?$s:globalThis.litElementVersions=[]).push("3.3.3");var Ne=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 Xu=(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)}},ed=(i,e,t)=>{e.constructor.createProperty(t,i)};function ie(i){return(e,t)=>t!==void 0?ed(i,e,t):Xu(i,e)}function Z(i){return ie({...i,state:!0})}var As,bm=((As=window.HTMLSlotElement)===null||As===void 0?void 0:As.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var td=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 ks(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 td(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 cc="0.13.0-test-1";function rd(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Hr(i,e){rd()&&localStorage.setItem(`${cc}/${i}`,e)}function qr(i,e=1e4){return pe(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 lc(i){let e=i.trim();if(!e)return"";let t=e.split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function uc(i){let e=0;for(let t=0;t<i.length;t++)e=i.charCodeAt(t)+((e<<5)-e);return(e%360+360)%360}function Ei(){return k`
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 ir(){return N`
7
+ `}function lr(){return k`
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 rr(){return N`
12
+ `}function Qn(){return k`
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 Hn(){return N`
18
+ `}function Gn(){return k`
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 dt(){return N`
24
+ `}function Qe(){return k`
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 Oe(){return N`
29
+ `}function Ue(){return k`
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 Vn(){return N`
33
+ `}function Zn(){return k`
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 zn(){return N`
38
+ `}function Jn(){return k`
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 nr(){return N`
42
+ `}function Yn(){return k`
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=Je`
46
+ `}function Xn(){return k`
47
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
48
+ <circle cx="12" cy="12" r="10"></circle>
49
+ <path d="M2 12h20"></path>
50
+ <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>
51
+ </svg>
52
+ `}function Kt(){return k`
53
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
54
+ <circle cx="12" cy="12" r="10"></circle>
55
+ <path d="M12 6v12"></path>
56
+ <path d="M15.5 9.5a3 3 0 0 0-3-2.5H11a3 3 0 0 0 0 6h2a3 3 0 0 1 0 6h-1.5a3 3 0 0 1-3-2.5"></path>
57
+ </svg>
58
+ `}function ea(){return k`
59
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
60
+ <rect x="2" y="6" width="20" height="14" rx="2"></rect>
61
+ <path d="M2 10h20"></path>
62
+ <circle cx="16" cy="14" r="1" fill="currentColor"></circle>
63
+ </svg>
64
+ `}function Qt(){return k`
65
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
66
+ <path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/>
67
+ </svg>
68
+ `}var nd="https://hosting.ad4m.dev";function ad(i){try{return new URL(i),!0}catch(e){return!1}}function Is(i){return pe(this,null,function*(){let e=i||nd,t=yield fetch(`${e}/hosts`);if(!t.ok)throw new Error(`Failed to fetch hosts: ${t.status}`);let r=yield t.json();for(let n of r)n.profilePicUrl&&!ad(n.profilePicUrl)&&(n.profilePicUrl=new URL(n.profilePicUrl,e).toString());return r})}var Ge=$e`
47
69
  * {
48
70
  box-sizing: border-box;
49
71
  }
@@ -151,6 +173,22 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
151
173
  box-shadow: 0 0 0 4px rgba(244, 54, 127, 0.2);
152
174
  }
153
175
 
176
+ button.danger-secondary {
177
+ background: #00091e5c;
178
+ color: var(--ac-danger-color);
179
+ border: 1px solid var(--ac-danger-color);
180
+ }
181
+
182
+ button.danger-secondary:hover:not(:disabled) {
183
+ background: rgba(244, 54, 127, 0.12);
184
+ }
185
+
186
+ button.danger-secondary:focus-visible:not(:disabled) {
187
+ outline: 2px solid var(--ac-danger-color);
188
+ outline-offset: 2px;
189
+ box-shadow: 0 0 0 4px rgba(244, 54, 127, 0.2);
190
+ }
191
+
154
192
  button:disabled {
155
193
  opacity: 0.5;
156
194
  cursor: not-allowed;
@@ -160,22 +198,13 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
160
198
  width: 100%;
161
199
  }
162
200
 
163
- .back-button,
164
201
  .close-button {
165
202
  position: absolute;
166
203
  top: 20px;
167
- cursor: pointer;
168
- }
169
-
170
- .back-button {
171
- left: 20px;
172
- }
173
-
174
- .close-button {
175
204
  right: 20px;
205
+ cursor: pointer;
176
206
  }
177
207
 
178
- .back-button svg,
179
208
  .close-button svg {
180
209
  width: 28px;
181
210
  height: 28px;
@@ -183,6 +212,25 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
183
212
  opacity: 0.5;
184
213
  }
185
214
 
215
+ .back-button {
216
+ all: unset;
217
+ display: inline-flex;
218
+ align-items: center;
219
+ gap: 4px;
220
+ cursor: pointer;
221
+ font-size: 14px;
222
+ color: rgba(255, 255, 255, 0.5);
223
+ }
224
+
225
+ .back-button svg {
226
+ width: 22px;
227
+ height: 22px;
228
+ }
229
+
230
+ .back-button:hover {
231
+ color: rgba(255, 255, 255, 0.8);
232
+ }
233
+
186
234
  /* Inputs */
187
235
  input {
188
236
  width: 100%;
@@ -242,6 +290,7 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
242
290
  display: flex;
243
291
  flex-direction: column;
244
292
  gap: 30px;
293
+ padding: 2px;
245
294
  }
246
295
 
247
296
  .box {
@@ -305,7 +354,21 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
305
354
  .state.danger svg {
306
355
  color: var(--ac-danger-color);
307
356
  }
308
- `;var ke=class extends Le{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 _e(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return _e(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return _e(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 _e(this,null,function*(){try{yield qn(`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 _e(this,null,function*(){ko(ke.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`
357
+
358
+ /* Spinners */
359
+ .spinner {
360
+ width: 24px;
361
+ height: 24px;
362
+ border: 3px solid var(--ac-border-color-light);
363
+ border-top-color: var(--ac-primary-color);
364
+ border-radius: 50%;
365
+ animation: spin 0.8s linear infinite;
366
+ }
367
+
368
+ @keyframes spin {
369
+ to { transform: rotate(360deg); }
370
+ }
371
+ `;var it=class extends ge{constructor(){super(...arguments);this.showHosting=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return pe(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return pe(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}browseHosts(){this.dispatchEvent(new CustomEvent("browse-hosts",{bubbles:!0,composed:!0}))}detectLocalNode(){return pe(this,null,function*(){try{yield qr(`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 pe(this,null,function*(){Ho(it.prototype,this,"connectedCallback").call(this),this.newPort=this.port,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)}render(){return this.loading?null:k`
309
372
  <div class="container">
310
373
  <div class="header">
311
374
  <h1>Connect AD4M</h1>
@@ -313,31 +376,31 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
313
376
  </div>
314
377
 
315
378
  <div class="options">
316
- ${this.isMobile?"":N`
379
+ ${!this.isMobile||!this.showHosting?k`
317
380
  <div class="box">
318
381
  <div class="box-header">
319
- ${ir()}
382
+ ${lr()}
320
383
  <h3>Local Node</h3>
321
384
  </div>
322
385
 
323
- ${this.localNodeDetected?N`
386
+ ${this.localNodeDetected?k`
324
387
  <div class="state success">
325
- ${dt()}
388
+ ${Qe()}
326
389
  <p>Local node detected on port ${this.port}</p>
327
390
  </div>
328
391
 
329
392
  <button class="primary" @click=${this.connectLocalNode}>
330
393
  Connect to Local Node
331
394
  </button>
332
- `:N`
395
+ `:k`
333
396
  <div class="state danger">
334
- ${Oe()}
397
+ ${Ue()}
335
398
  <p>No local node detected on port ${this.port}</p>
336
399
  </div>
337
400
 
338
401
  <p style="margin-bottom: -12px">Download and install AD4M</p>
339
402
  <button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
340
- ${Hn()} Download AD4M
403
+ ${Gn()} Download AD4M
341
404
  </button>
342
405
  `}
343
406
 
@@ -351,54 +414,29 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
351
414
  @keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
352
415
  />
353
416
  <button class="primary" @click=${this.refreshPort}>
354
- ${Vn()}
417
+ ${Zn()}
355
418
  </button>
356
419
  </div>
357
420
  </div>
358
- `}
421
+ `:""}
359
422
 
360
- ${this.showMultiUserOption?N`
423
+ ${this.showHosting?k`
361
424
  <div class="box">
362
425
  <div class="box-header">
363
- ${rr()}
426
+ ${Xn()}
364
427
  <h3>Remote Node</h3>
365
428
  </div>
366
429
 
367
- ${this.remoteUrl?N`
368
- <div class="state success">
369
- ${dt()}
370
- <p>Remote configuration detected</p>
371
- </div>
372
- `:N`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
430
+ <p>Browse hosted AD4M nodes or enter a URL</p>
373
431
 
374
- <input
375
- type="text"
376
- placeholder="https://ad4m-node:12000/graphql"
377
- .value=${this.newRemoteUrl}
378
- @input=${t=>{let r=t.target;this.newRemoteUrl=r.value,this.remoteNodeError&&this.clearRemoteNodeError()}}
379
- @keydown=${t=>{t.key==="Enter"&&!this.connectingToRemoteNode&&this.newRemoteUrl.trim().length&&this.connectRemoteNode()}}
380
- style= "font-size: 16px;"
381
- />
382
-
383
- ${this.remoteNodeError?N`
384
- <div class="state danger">
385
- ${Oe()}
386
- <p>Unable to connect to remote node</p>
387
- </div>
388
- `:""}
389
-
390
- <button
391
- class="primary"
392
- ?disabled=${this.connectingToRemoteNode||this.newRemoteUrl.trim().length===0}
393
- @click=${this.connectRemoteNode}
394
- >
395
- ${this.connectingToRemoteNode?"Connecting...":"Connect to Remote Node"}
432
+ <button class="primary" @click=${this.browseHosts}>
433
+ Connect to Remote Node
396
434
  </button>
397
435
  </div>
398
436
  `:""}
399
437
  </div>
400
438
  </div>
401
- `}};ke.styles=[Bt,Je`
439
+ `}};it.styles=[Ge,$e`
402
440
  .options {
403
441
  display: flex;
404
442
  flex-direction: column;
@@ -427,38 +465,38 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
427
465
  button {
428
466
  width: 100%;
429
467
  }
430
- `],j([fe({type:Number})],ke.prototype,"port",2),j([fe({type:String})],ke.prototype,"remoteUrl",2),j([fe({type:Boolean})],ke.prototype,"connectingToRemoteNode",2),j([fe({type:Boolean})],ke.prototype,"remoteNodeError",2),j([fe({type:Boolean})],ke.prototype,"showMultiUserOption",2),j([ue()],ke.prototype,"loading",2),j([ue()],ke.prototype,"localNodeDetected",2),j([ue()],ke.prototype,"newPort",2),j([ue()],ke.prototype,"newRemoteUrl",2),j([ue()],ke.prototype,"isMobile",2),ke=j([gt("connection-options")],ke);var _a=function(){return _a=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},_a.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function sa(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?sa=function(t){return typeof t}:sa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(i)}function Uu(i){return sa(i)=="object"&&i!==null}var yl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Us(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 Fu(i){return vl(i.source,Us(i.source,i.start))}function vl(i,e){var t=i.locationOffset.column-1,r=oa(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,c="".concat(i.name,":").concat(s,":").concat(l,`
431
- `),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var y=Math.floor(l/80),d=l%80,p=[],f=0;f<m.length;f+=80)p.push(m.slice(f,f+80));return c+Qo([["".concat(s),p[0]]].concat(p.slice(1,y+1).map(function(S){return["",S]}),[[" ",oa(d-1)+"^"],["",p[y+1]]]))}return c+Qo([["".concat(s-1),u[n-1]],["".concat(s),m],["",oa(l-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 ju(t,n)+(a?" | "+a:" |")}).join(`
432
- `)}function oa(i){return Array(i+1).join(" ")}function ju(i,e){return oa(i-e.length)+e}function ca(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ca=function(t){return typeof t}:ca=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ca(i)}function Go(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 Bu(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Go(Object(t),!0).forEach(function(r){qu(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function qu(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hu(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 Vu(i,e,t){return e&&Zo(i.prototype,e),t&&Zo(i,t),i}function zu(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&&gn(i,e)}function Wu(i){var e=wl();return function(){var r=mn(i),n;if(e){var a=mn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return bl(this,n)}}function bl(i,e){return e&&(ca(e)==="object"||typeof e=="function")?e:Hr(i)}function Hr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Fs(i){var e=typeof Map=="function"?new Map:void 0;return Fs=function(r){if(r===null||!Ku(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 la(r,arguments,mn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),gn(n,r)},Fs(i)}function la(i,e,t){return wl()?la=Reflect.construct:la=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&gn(c,s.prototype),c},la.apply(null,arguments)}function wl(){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 Ku(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function gn(i,e){return gn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},gn(i,e)}function mn(i){return mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(i)}var Qu=function(i){zu(t,i);var e=Wu(t);function t(r,n,a,s,o,l,c){var u,m,y,d;Hu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=Jo(Array.isArray(n)?n:n?[n]:void 0);for(var p=[],f=0,S=(E=d.nodes)!==null&&E!==void 0?E:[];f<S.length;f++){var E,A=S[f],k=A.loc;k!=null&&p.push(k)}p=Jo(p),d.source=a??((u=p)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=p)===null||m===void 0?void 0:m.map(function(T){return T.start})),d.locations=s&&a?s.map(function(T){return Us(a,T)}):(y=p)===null||y===void 0?void 0:y.map(function(T){return Us(T.source,T.start)}),d.path=o??void 0;var b=l?.extensions;return c==null&&Uu(b)?d.extensions=Bu({},b):d.extensions=c??{},Object.defineProperties(Hr(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}}),l!=null&&l.stack?(Object.defineProperty(Hr(d),"stack",{value:l.stack,writable:!0,configurable:!0}),bl(d)):(Error.captureStackTrace?Error.captureStackTrace(Hr(d),t):Object.defineProperty(Hr(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Vu(t,[{key:"toString",value:function(){return Gu(this)}},{key:yl,get:function(){return"Object"}}]),t}(Fs(Error));function Jo(i){return i===void 0||i.length===0?void 0:i}function Gu(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+=`
468
+ `],C([ie({type:Number})],it.prototype,"port",2),C([ie({type:Boolean})],it.prototype,"showHosting",2),C([Z()],it.prototype,"loading",2),C([Z()],it.prototype,"localNodeDetected",2),C([Z()],it.prototype,"newPort",2),C([Z()],it.prototype,"isMobile",2),it=C([Ne("connection-options")],it);var Ca=function(){return Ca=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},Ca.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function fa(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fa=function(t){return typeof t}:fa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fa(i)}function sd(i){return fa(i)=="object"&&i!==null}var Nl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Qs(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 od(i){return Ol(i.source,Qs(i.source,i.start))}function Ol(i,e){var t=i.locationOffset.column-1,r=ga(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,c="".concat(i.name,":").concat(s,":").concat(l,`
469
+ `),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var y=Math.floor(l/80),d=l%80,h=[],g=0;g<m.length;g+=80)h.push(m.slice(g,g+80));return c+dc([["".concat(s),h[0]]].concat(h.slice(1,y+1).map(function(_){return["",_]}),[[" ",ga(d-1)+"^"],["",h[y+1]]]))}return c+dc([["".concat(s-1),u[n-1]],["".concat(s),m],["",ga(l-1)+"^"],["".concat(s+1),u[n+1]]])}function dc(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 cd(t,n)+(a?" | "+a:" |")}).join(`
470
+ `)}function ga(i){return Array(i+1).join(" ")}function cd(i,e){return ga(i-e.length)+e}function ma(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ma=function(t){return typeof t}:ma=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ma(i)}function pc(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 ld(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pc(Object(t),!0).forEach(function(r){ud(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):pc(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function ud(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function dd(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function hc(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 pd(i,e,t){return e&&hc(i.prototype,e),t&&hc(i,t),i}function hd(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&&_n(i,e)}function fd(i){var e=Ul();return function(){var r=xn(i),n;if(e){var a=xn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Dl(this,n)}}function Dl(i,e){return e&&(ma(e)==="object"||typeof e=="function")?e:Gr(i)}function Gr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Gs(i){var e=typeof Map=="function"?new Map:void 0;return Gs=function(r){if(r===null||!gd(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 ya(r,arguments,xn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_n(n,r)},Gs(i)}function ya(i,e,t){return Ul()?ya=Reflect.construct:ya=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&_n(c,s.prototype),c},ya.apply(null,arguments)}function Ul(){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 gd(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function _n(i,e){return _n=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},_n(i,e)}function xn(i){return xn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},xn(i)}var md=function(i){hd(t,i);var e=fd(t);function t(r,n,a,s,o,l,c){var u,m,y,d;dd(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=fc(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],g=0,_=(E=d.nodes)!==null&&E!==void 0?E:[];g<_.length;g++){var E,A=_[g],I=A.loc;I!=null&&h.push(I)}h=fc(h),d.source=a??((u=h)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=h)===null||m===void 0?void 0:m.map(function(L){return L.start})),d.locations=s&&a?s.map(function(L){return Qs(a,L)}):(y=h)===null||y===void 0?void 0:y.map(function(L){return Qs(L.source,L.start)}),d.path=o??void 0;var w=l?.extensions;return c==null&&sd(w)?d.extensions=ld({},w):d.extensions=c??{},Object.defineProperties(Gr(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}}),l!=null&&l.stack?(Object.defineProperty(Gr(d),"stack",{value:l.stack,writable:!0,configurable:!0}),Dl(d)):(Error.captureStackTrace?Error.captureStackTrace(Gr(d),t):Object.defineProperty(Gr(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return pd(t,[{key:"toString",value:function(){return yd(this)}},{key:Nl,get:function(){return"Object"}}]),t}(Gs(Error));function fc(i){return i===void 0||i.length===0?void 0:i}function yd(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
471
 
434
- `+Fu(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
472
+ `+od(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
473
 
436
- `+vl(i.source,o)}return e}function Xe(i,e,t){return new Qu("Syntax Error: ".concat(t),void 0,i,[e])}var B=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 Zu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ju=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,js=Ju;function Sl(i){var e=i.prototype.toJSON;typeof e=="function"||Zu(0),i.prototype.inspect=e,js&&(i.prototype[js]=e)}var _l=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}();Sl(_l);var me=function(){function i(t,r,n,a,s,o,l){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=l,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}();Sl(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 ua(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ua=function(t){return typeof t}:ua=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ua(i)}var Yu=10,El=2;function Xu(i){return za(i,[])}function za(i,e){switch(ua(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":ed(i,e);default:return String(i)}}function ed(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=rd(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:za(n,t)}else if(Array.isArray(i))return id(i,t);return td(i,t)}function td(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>El)return"["+nd(i)+"]";var r=t.map(function(n){var a=za(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function id(i,e){if(i.length===0)return"[]";if(e.length>El)return"[Array]";for(var t=Math.min(Yu,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(za(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function rd(i){var e=i[String(js)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function nd(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 bs(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var ad=function(e,t){return e instanceof t};function Yo(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 sd(i,e,t){return e&&Yo(i.prototype,e),t&&Yo(i,t),i}var xl=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"||bs(0,"Body must be a string. Received: ".concat(Xu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||bs(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||bs(0,"column in locationOffset is 1-indexed and must be positive.")}return sd(i,[{key:yl,get:function(){return"Source"}}]),i}();function od(i){return ad(i,xl)}var cd=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 ld(i){var e=i.split(/\r\n|[\n\r]/g),t=ud(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&&Xo(e[n]);)++n;for(var a=e.length;a>n&&Xo(e[a-1]);)--a;return e.slice(n,a).join(`
437
- `)}function Xo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function ud(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 dd=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=fd(this,r)}while(r.kind===$.COMMENT);return r},i}();function pd(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 fd(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,l=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,l,e);case 35:return gd(t,a,o,l,e);case 36:return new me($.DOLLAR,a,a+1,o,l,e);case 38:return new me($.AMP,a,a+1,o,l,e);case 40:return new me($.PAREN_L,a,a+1,o,l,e);case 41:return new me($.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new me($.SPREAD,a,a+3,o,l,e);break;case 58:return new me($.COLON,a,a+1,o,l,e);case 61:return new me($.EQUALS,a,a+1,o,l,e);case 64:return new me($.AT,a,a+1,o,l,e);case 91:return new me($.BRACKET_L,a,a+1,o,l,e);case 93:return new me($.BRACKET_R,a,a+1,o,l,e);case 123:return new me($.BRACE_L,a,a+1,o,l,e);case 124:return new me($.PIPE,a,a+1,o,l,e);case 125:return new me($.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?vd(t,a,o,l,e,i):yd(t,a,o,l,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return md(t,a,s,o,l,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 wd(t,a,o,l,e)}throw Xe(t,a,hd(s))}var c=i.line,u=1+a-i.lineStart;return new me($.EOF,n,n,c,u,e)}function hd(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 gd(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 md(i,e,t,r,n,a){var s=i.body,o=t,l=e,c=!1;if(o===45&&(o=s.charCodeAt(++l)),o===48){if(o=s.charCodeAt(++l),o>=48&&o<=57)throw Xe(i,l,"Invalid number, unexpected digit after 0: ".concat(Ni(o),"."))}else l=ws(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=ws(i,l,o),o=s.charCodeAt(l)),(o===69||o===101)&&(c=!0,o=s.charCodeAt(++l),(o===43||o===45)&&(o=s.charCodeAt(++l)),l=ws(i,l,o),o=s.charCodeAt(l)),o===46||Sd(o))throw Xe(i,l,"Invalid number, expected digit but got: ".concat(Ni(o),"."));return new me(c?$.FLOAT:$.INT,e,l,r,n,a,s.slice(e,l))}function ws(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(Ni(a),"."))}function yd(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,l=0,c="";s<a.length&&!isNaN(l=a.charCodeAt(s))&&l!==10&&l!==13;){if(l===34)return c+=a.slice(o,s),new me($.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw Xe(i,s,"Invalid character within String: ".concat(Ni(l),"."));if(++s,l===92){switch(c+=a.slice(o,s-1),l=a.charCodeAt(s),l){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
438
- `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=bd(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,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw Xe(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw Xe(i,s,"Unterminated string.")}function vd(i,e,t,r,n,a){for(var s=i.body,o=e+3,l=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o));){if(c===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(l,o),new me($.BLOCK_STRING,e,o+3,t,r,n,ld(u));if(c<32&&c!==9&&c!==10&&c!==13)throw Xe(i,o,"Invalid character within String: ".concat(Ni(c),"."));c===10?(++o,++a.line,a.lineStart=o):c===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):c===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(l,o)+'"""',o+=4,l=o):++o}throw Xe(i,o,"Unterminated string.")}function bd(i,e,t,r){return Wn(i)<<12|Wn(e)<<8|Wn(t)<<4|Wn(r)}function Wn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function wd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,l=0;o!==s&&!isNaN(l=a.charCodeAt(o))&&(l===95||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++o;return new me($.NAME,e,o,t,r,n,a.slice(e,o))}function Sd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function _d(i,e){var t=new Ed(i,e);return t.parseDocument()}var Ed=function(){function i(t,r){var n=od(t)?t:new xl(t);this._lexer=new dd(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:B.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:B.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:B.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:B.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:B.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:B.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:B.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:B.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:B.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:B.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:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:B.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:B.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:B.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:B.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:B.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:B.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:B.NULL,loc:this.loc(n)};default:return{kind:B.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:B.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:B.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:B.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:B.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:B.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:B.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:B.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:B.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:B.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:B.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:B.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),l=this.parseFieldsDefinition();return{kind:B.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,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(),l=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,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 l=this.parseDirectives(!0);return{kind:B.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:l,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),l=this.parseFieldsDefinition();return{kind:B.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,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:B.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:B.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:B.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:B.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:B.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:B.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:B.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:B.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:B.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:B.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:B.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 l=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,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(cd[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 _l(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($l(r),", found ").concat(Ss(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(Ss(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(Ss(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 Ss(i){var e=i.value;return $l(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function $l(i){return pd(i)?'"'.concat(i,'"'):i}var da=new Map,Bs=new Map,Al=!0,Ea=!1;function kl(i){return i.replace(/[\s,]+/g," ").trim()}function xd(i){return kl(i.source.body.substring(i.start,i.end))}function $d(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=xd(r.loc),s=Bs.get(n);s&&!s.has(a)?Al&&console.warn("Warning: fragment with name "+n+` already exists.
474
+ `+Ol(i.source,o)}return e}function nt(i,e,t){return new md("Syntax Error: ".concat(t),void 0,i,[e])}var z=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 vd(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var bd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Zs=bd;function Ml(i){var e=i.prototype.toJSON;typeof e=="function"||vd(0),i.prototype.inspect=e,Zs&&(i.prototype[Zs]=e)}var Fl=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}();Ml(Fl);var ve=function(){function i(t,r,n,a,s,o,l){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=l,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}();Ml(ve);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 va(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?va=function(t){return typeof t}:va=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},va(i)}var wd=10,jl=2;function Sd(i){return Xa(i,[])}function Xa(i,e){switch(va(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":_d(i,e);default:return String(i)}}function _d(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=$d(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:Xa(n,t)}else if(Array.isArray(i))return Ed(i,t);return xd(i,t)}function xd(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>jl)return"["+Ad(i)+"]";var r=t.map(function(n){var a=Xa(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function Ed(i,e){if(i.length===0)return"[]";if(e.length>jl)return"[Array]";for(var t=Math.min(wd,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(Xa(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function $d(i){var e=i[String(Zs)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function Ad(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 Ts(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var kd=function(e,t){return e instanceof t};function gc(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 Id(i,e,t){return e&&gc(i.prototype,e),t&&gc(i,t),i}var Bl=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"||Ts(0,"Body must be a string. Received: ".concat(Sd(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||Ts(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ts(0,"column in locationOffset is 1-indexed and must be positive.")}return Id(i,[{key:Nl,get:function(){return"Source"}}]),i}();function Td(i){return kd(i,Bl)}var Cd=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 Ld(i){var e=i.split(/\r\n|[\n\r]/g),t=Pd(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&&mc(e[n]);)++n;for(var a=e.length;a>n&&mc(e[a-1]);)--a;return e.slice(n,a).join(`
475
+ `)}function mc(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Pd(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 Rd=function(){function i(t){var r=new ve($.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=Od(this,r)}while(r.kind===$.COMMENT);return r},i}();function Nd(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 ji(i){return isNaN(i)?$.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function Od(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,l=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 ve($.BANG,a,a+1,o,l,e);case 35:return Ud(t,a,o,l,e);case 36:return new ve($.DOLLAR,a,a+1,o,l,e);case 38:return new ve($.AMP,a,a+1,o,l,e);case 40:return new ve($.PAREN_L,a,a+1,o,l,e);case 41:return new ve($.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new ve($.SPREAD,a,a+3,o,l,e);break;case 58:return new ve($.COLON,a,a+1,o,l,e);case 61:return new ve($.EQUALS,a,a+1,o,l,e);case 64:return new ve($.AT,a,a+1,o,l,e);case 91:return new ve($.BRACKET_L,a,a+1,o,l,e);case 93:return new ve($.BRACKET_R,a,a+1,o,l,e);case 123:return new ve($.BRACE_L,a,a+1,o,l,e);case 124:return new ve($.PIPE,a,a+1,o,l,e);case 125:return new ve($.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?jd(t,a,o,l,e,i):Fd(t,a,o,l,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Md(t,a,s,o,l,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 Hd(t,a,o,l,e)}throw nt(t,a,Dd(s))}var c=i.line,u=1+a-i.lineStart;return new ve($.EOF,n,n,c,u,e)}function Dd(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(ji(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(ji(i),".")}function Ud(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 ve($.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function Md(i,e,t,r,n,a){var s=i.body,o=t,l=e,c=!1;if(o===45&&(o=s.charCodeAt(++l)),o===48){if(o=s.charCodeAt(++l),o>=48&&o<=57)throw nt(i,l,"Invalid number, unexpected digit after 0: ".concat(ji(o),"."))}else l=Cs(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=Cs(i,l,o),o=s.charCodeAt(l)),(o===69||o===101)&&(c=!0,o=s.charCodeAt(++l),(o===43||o===45)&&(o=s.charCodeAt(++l)),l=Cs(i,l,o),o=s.charCodeAt(l)),o===46||qd(o))throw nt(i,l,"Invalid number, expected digit but got: ".concat(ji(o),"."));return new ve(c?$.FLOAT:$.INT,e,l,r,n,a,s.slice(e,l))}function Cs(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 nt(i,n,"Invalid number, expected digit but got: ".concat(ji(a),"."))}function Fd(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,l=0,c="";s<a.length&&!isNaN(l=a.charCodeAt(s))&&l!==10&&l!==13;){if(l===34)return c+=a.slice(o,s),new ve($.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw nt(i,s,"Invalid character within String: ".concat(ji(l),"."));if(++s,l===92){switch(c+=a.slice(o,s-1),l=a.charCodeAt(s),l){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
476
+ `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=Bd(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 nt(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw nt(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw nt(i,s,"Unterminated string.")}function jd(i,e,t,r,n,a){for(var s=i.body,o=e+3,l=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o));){if(c===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(l,o),new ve($.BLOCK_STRING,e,o+3,t,r,n,Ld(u));if(c<32&&c!==9&&c!==10&&c!==13)throw nt(i,o,"Invalid character within String: ".concat(ji(c),"."));c===10?(++o,++a.line,a.lineStart=o):c===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):c===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(l,o)+'"""',o+=4,l=o):++o}throw nt(i,o,"Unterminated string.")}function Bd(i,e,t,r){return ta(i)<<12|ta(e)<<8|ta(t)<<4|ta(r)}function ta(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function Hd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,l=0;o!==s&&!isNaN(l=a.charCodeAt(o))&&(l===95||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++o;return new ve($.NAME,e,o,t,r,n,a.slice(e,o))}function qd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function zd(i,e){var t=new Vd(i,e);return t.parseDocument()}var Vd=function(){function i(t,r){var n=Td(t)?t:new Bl(t);this._lexer=new Rd(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:z.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:z.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:z.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:z.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:z.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:z.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:z.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:z.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:z.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:z.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:z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:z.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:z.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:z.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:z.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:z.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:z.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:z.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:z.NULL,loc:this.loc(n)};default:return{kind:z.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:z.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:z.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:z.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:z.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:z.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:z.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:z.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:z.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:z.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:z.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:z.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),l=this.parseFieldsDefinition();return{kind:z.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,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(),l=this.parseDirectives(!0);return{kind:z.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,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 l=this.parseDirectives(!0);return{kind:z.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:l,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),l=this.parseFieldsDefinition();return{kind:z.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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 l=this.parseDirectiveLocations();return{kind:z.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,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(Cd[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 Fl(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 nt(this._lexer.source,n.start,"Expected ".concat(Hl(r),", found ").concat(Ls(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 nt(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(Ls(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 nt(this._lexer.source,n.start,"Unexpected ".concat(Ls(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 Ls(i){var e=i.value;return Hl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function Hl(i){return Nd(i)?'"'.concat(i,'"'):i}var ba=new Map,Js=new Map,ql=!0,La=!1;function zl(i){return i.replace(/[\s,]+/g," ").trim()}function Wd(i){return zl(i.source.body.substring(i.start,i.end))}function Kd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=Wd(r.loc),s=Js.get(n);s&&!s.has(a)?ql&&console.warn("Warning: fragment with name "+n+` already exists.
439
477
  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||Bs.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),_a(_a({},i),{definitions:t})}function Ad(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 kd(i){var e=kl(i);if(!da.has(e)){var t=_d(i,{experimentalFragmentVariables:Ea,allowLegacyFragmentVariables:Ea});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");da.set(e,Ad($d(t)))}return da.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]}),kd(r)}function Id(){da.clear(),Bs.clear()}function Td(){Al=!1}function Cd(){Ea=!0}function Ld(){Ea=!1}var Fr={gql:v,resetCaches:Id,disableFragmentWarnings:Td,enableExperimentalFragmentVariables:Cd,disableExperimentalFragmentVariables:Ld};(function(i){i.gql=Fr.gql,i.resetCaches=Fr.resetCaches,i.disableFragmentWarnings=Fr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Fr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Fr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function w(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 Nd(){}function oi(){return Nd}var q=oi,h=oi,Ae=oi,te=oi,F=oi,Ge=oi,Rd=oi,po=oi,Il=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},Tl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ri=class{constructor(e){this.code=e}};Il([h(),Tl("design:type",String)],Ri.prototype,"code",void 0);Ri=Il([F(),Tl("design:paramtypes",[String])],Ri);var fo=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},ho=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}};fo([h(),ho("design:type",String)],Et.prototype,"address",void 0);fo([h(),ho("design:type",String)],Et.prototype,"name",void 0);Et=fo([F(),ho("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},we=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(),we("design:type",String)],Ut.prototype,"signature",void 0);pe([h(),we("design:type",String)],Ut.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"invalid",void 0);Ut=pe([F(),Ae(),we("design:paramtypes",[String,String])],Ut);var Pi=class{};pe([h(),we("design:type",String)],Pi.prototype,"signature",void 0);pe([h(),we("design:type",String)],Pi.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"invalid",void 0);Pi=pe([Ae()],Pi);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(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Ut)],e.prototype,"proof",void 0),e=pe([F(),we("design:paramtypes",[String,String,Object,Ut])],e),e}function Pd(i){let e=class{};return pe([h(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Pi)],e.prototype,"proof",void 0),e=pe([Ae()],e),e}var ec=class extends ci(){};ec=pe([F()],ec);var xa=class extends ci(){};pe([h(),we("design:type",Et)],xa.prototype,"language",void 0);pe([h(),we("design:type",Ri)],xa.prototype,"icon",void 0);xa=pe([F()],xa);function gy(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},Ce=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ke=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ye([h(),Ce("design:type",String)],Ke.prototype,"source",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"target",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"predicate",void 0);Ke=ye([F(),Ce("design:paramtypes",[Object])],Ke);var $a=class{};ye([h(),Ce("design:type",Array)],$a.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],$a.prototype,"removals",void 0);$a=ye([Ae()],$a);var Aa=class{constructor(e,t){this.additions=e,this.removals=t}};ye([h(),Ce("design:type",Array)],Aa.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],Aa.prototype,"removals",void 0);Aa=ye([F(),Ce("design:paramtypes",[Array,Array])],Aa);var yn=class{};ye([h(),Ce("design:type",String)],yn.prototype,"source",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"target",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"predicate",void 0);yn=ye([Ae()],yn);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(),Ce("design:type",String)],ti.prototype,"status",void 0);ti=ye([F()],ti);var qs=class extends Pd(){};ye([h(),Ce("design:type",String)],qs.prototype,"status",void 0);qs=ye([Ae()],qs);function _y(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 Ey(i){return i&&i.source&&i.target}var ka=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ye([h(),Ce("design:type",ti)],ka.prototype,"oldLink",void 0);ye([h(),Ce("design:type",ti)],ka.prototype,"newLink",void 0);ka=ye([F(),Ce("design:paramtypes",[ti,ti])],ka);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},Tn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Hs,kt=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(),Tn("design:type",Array)],kt.prototype,"links",void 0);kt=zi([F(),Tn("design:paramtypes",[Array])],kt);var Ia=class{};zi([h(),Tn("design:type",Array)],Ia.prototype,"links",void 0);Ia=zi([Ae()],Ia);var Vs=Hs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Hs;return t.links.push(e),t}};zi([h(),Tn("design:type",Array)],Vs.prototype,"links",void 0);Vs=Hs=zi([Ae(),Tn("design:paramtypes",[Array])],Vs);var Oi=class extends ci(){};Oi=zi([F()],Oi);var P=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)},Zt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new kt}};P([h(),O("design:type",String)],Zt.prototype,"did",void 0);P([h(),O("design:type",kt)],Zt.prototype,"perspective",void 0);P([h(),O("design:type",String)],Zt.prototype,"directMessageLanguage",void 0);Zt=P([F(),O("design:paramtypes",[String,kt])],Zt);var tc=class extends ci(){};tc=P([F()],tc);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}};P([h(),O("design:type",String)],ii.prototype,"did",void 0);P([h(),O("design:type",String)],ii.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ii.prototype,"didSignedByDeviceKey",void 0);ii=P([F(),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}};P([h(),O("design:type",String)],ri.prototype,"did",void 0);P([h(),O("design:type",String)],ri.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ri.prototype,"didSignedByDeviceKey",void 0);ri=P([Ae(),O("design:paramtypes",[String,String,String,String,String,String])],ri);var Ta=class{constructor(e,t){this.signature=e,this.publicKey=t}};P([h(),O("design:type",String)],Ta.prototype,"signature",void 0);P([h(),O("design:type",String)],Ta.prototype,"publicKey",void 0);Ta=P([F(),O("design:paramtypes",[String,String])],Ta);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],gr.prototype,"domain",void 0);P([h(),O("design:type",Array)],gr.prototype,"pointers",void 0);gr=P([F(),O("design:paramtypes",[String,Array])],gr);var Ca=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",gr)],Ca.prototype,"with",void 0);P([h(),O("design:type",Array)],Ca.prototype,"can",void 0);Ca=P([F(),O("design:paramtypes",[gr,Array])],Ca);var Ft=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};P([h(),O("design:type",String)],Ft.prototype,"appName",void 0);P([h(),O("design:type",String)],Ft.prototype,"appDesc",void 0);P([h(),O("design:type",String)],Ft.prototype,"appUrl",void 0);P([h(),O("design:type",String)],Ft.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],Ft.prototype,"capabilities",void 0);Ft=P([F(),O("design:paramtypes",[String,String,String,Array,String])],Ft);var mr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};P([h(),O("design:type",String)],mr.prototype,"requestId",void 0);P([h(),O("design:type",String)],mr.prototype,"token",void 0);P([h(),O("design:type",Boolean)],mr.prototype,"revoked",void 0);P([h(),O("design:type",Ft)],mr.prototype,"auth",void 0);mr=P([F(),O("design:paramtypes",[String,Ft,String,Boolean])],mr);var yr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],yr.prototype,"domain",void 0);P([h(),O("design:type",Array)],yr.prototype,"pointers",void 0);yr=P([Ae(),O("design:paramtypes",[String,Array])],yr);var La=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",yr)],La.prototype,"with",void 0);P([h(),O("design:type",Array)],La.prototype,"can",void 0);La=P([Ae(),O("design:paramtypes",[yr,Array])],La);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}};P([h(),O("design:type",String)],It.prototype,"appName",void 0);P([h(),O("design:type",String)],It.prototype,"appDesc",void 0);P([h(),O("design:type",String)],It.prototype,"appDomain",void 0);P([h(),O("design:type",String)],It.prototype,"appUrl",void 0);P([h(),O("design:type",String)],It.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],It.prototype,"capabilities",void 0);It=P([Ae(),O("design:paramtypes",[String,String,String,String,String,Array])],It);var Di=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};P([h(),O("design:type",String)],Di.prototype,"did",void 0);P([h(),O("design:type",Boolean)],Di.prototype,"success",void 0);P([h(),O("design:type",String)],Di.prototype,"error",void 0);Di=P([F(),O("design:paramtypes",[String,Boolean,String])],Di);var kr=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)},ot=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)}};kr([h(),Ir("design:type",Boolean)],ot.prototype,"isInitialized",void 0);kr([h(),Ir("design:type",Boolean)],ot.prototype,"isUnlocked",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"did",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"didDocument",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"error",void 0);ot=kr([F(),Ir("design:paramtypes",[Object])],ot);var ic=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)},Ve,ze,zs=class{constructor(e,t){Ve.set(this,void 0),ze.set(this,void 0),ic(this,Ve,e,"f"),ic(this,ze,t,"f")}async otherAgents(){return await he(this,Ve,"f").otherAgents(he(this,ze,"f"))}async hasTelepresenceAdapter(){return await he(this,Ve,"f").hasTelepresenceAdapter(he(this,ze,"f"))}async onlineAgents(){return await he(this,Ve,"f").onlineAgents(he(this,ze,"f"))}async setOnlineStatus(e){return await he(this,Ve,"f").setOnlineStatus(he(this,ze,"f"),e)}async setOnlineStatusU(e){return await he(this,Ve,"f").setOnlineStatusU(he(this,ze,"f"),e)}async sendSignal(e,t){return await he(this,Ve,"f").sendSignal(he(this,ze,"f"),e,t)}async sendSignalU(e,t){return await he(this,Ve,"f").sendSignalU(he(this,ze,"f"),e,t)}async sendBroadcast(e,t=!1){return await he(this,Ve,"f").sendBroadcast(he(this,ze,"f"),e,t)}async sendBroadcastU(e,t=!1){return await he(this,Ve,"f").sendBroadcastU(he(this,ze,"f"),e,t)}async addSignalHandler(e){await he(this,Ve,"f").addSignalHandler(he(this,ze,"f"),e)}removeSignalHandler(e){he(this,Ve,"f").removeSignalHandler(he(this,ze,"f"),e)}};Ve=new WeakMap,ze=new WeakMap;var Wi=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)},re=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)}};Wi([h(),Ki("design:type",String)],re.prototype,"source",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"target",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"predicate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"fromDate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"untilDate",void 0);Wi([h(),Ki("design:type",Number)],re.prototype,"limit",void 0);re=Wi([F(),Ae(),Ki("design:paramtypes",[Object])],re);var rc=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},Ie=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,Rt;function Kn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var oe=class{constructor(){We.set(this,void 0),Rt.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 oe;return rc(t,Rt,e,"f"),t}static from(e){let t=new oe;return rc(t,We,e,"f"),t}toUrl(){if(Ie(this,Rt,"f")&&!Ie(this,We,"f"))return Ie(this,Rt,"f");if(!Ie(this,Rt,"f")&&(Ie(this,We,"f")===void 0||Ie(this,We,"f")===""||Ie(this,We,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,We,"f")){case"string":e=`string:${Kn(Ie(this,We,"f"))}`;break;case"number":e=`number:${Kn(Ie(this,We,"f"))}`;break;case"boolean":e=`boolean:${Kn(Ie(this,We,"f"))}`;break;case"object":e=`json:${Kn(JSON.stringify(Ie(this,We,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,We,"f"))return Ie(this,We,"f");if(!Ie(this,Rt,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,Rt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,Rt,"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,Rt=new WeakMap;function Be(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Wa(i){return`set${Be(i)}`}function Cl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function Od(i){return`add${Be(Cl(i))}`}function Dd(i){return`remove${Be(Cl(i))}`}function Md(i){return`set${Be(i)}`}function Ll(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 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 _s=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)},Me,Ue,ge,un=class{constructor(i,e,t){Me.set(this,void 0),Ue.set(this,void 0),ge.set(this,void 0),_s(this,Me,e,"f"),_s(this,Ue,t,"f"),_s(this,ge,i,"f")}get baseExpression(){return K(this,Me,"f")}async init(){let isInstance=await K(this,ge,"f").isSubjectInstance(K(this,Me,"f"),K(this,Ue,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,Ue,"f")} for ${K(this,Me,"f")}`;let results=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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,Ue,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getPropertyValueViaSurreal(K(this,Me,"f"),K(this,Ue,"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,Ue,"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,Ue,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wa(property)]=async i=>{resolveLanguage&&(i=await K(this,ge,"f").createExpression(i,resolveLanguage)),await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let results2=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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,ge,"f").getRelationValuesViaSurreal(K(this,Me,"f"),K(this,Ue,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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[Od(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let removers=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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[Dd(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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[Md(relation)]=async i=>{Array.isArray(i)?await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}}};Me=new WeakMap,Ue=new WeakMap,ge=new WeakMap;function Ud(i,e,t,r){let n="",a=Ll(8);n+=`subject_class("${i}", ${a}).
441
- `;let s=[],o=[];e.subjectConstructor&&e.subjectConstructor.length&&(o=o.concat(e.subjectConstructor));let l=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(l=l.concat(e.isSubjectInstance));let c=[];for(let d in t){let p=`property(${a}, "${d}").
442
- `,{through:f,initial:S,required:E,resolveLanguage:A,writable:k,flag:b,prologGetter:T,prologSetter:R,local:C}=t[d];if(A&&(p+=`property_resolve(${a}, "${d}").
443
- `,p+=`property_resolve_language(${a}, "${d}", "${A}").
444
- `),T?p+=`property_getter(${a}, Base, "${d}", Value) :- ${T}.
445
- `:f&&(p+=`property_getter(${a}, Base, "${d}", Value) :- triple(Base, "${f}", Value).
446
- `,E&&(b?l.push(`triple(Base, "${f}", "${S}")`):l.push(`triple(Base, "${f}", _)`))),R)p+=`property_setter(${a}, "${d}", Actions) :- ${R}.
447
- `;else if(k&&f&&typeof e[Wa(d)]=="function"){let L=[{action:"setSingleTarget",source:"this",predicate:f,target:"value",...C&&{local:!0}}];p+=`property_setter(${a}, "${d}", '${vi(L)}').
448
- `}c.push(p);let Q=S??(E&&k&&!b&&f?"literal://string:":void 0);Q&&(o.push({action:"addLink",source:"this",predicate:f,target:Q}),s.push({action:"removeLink",source:"this",predicate:f,target:"*"}))}let u=[],m=Object.fromEntries(Object.entries(r).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let d in m){let p=`collection(${a}, "${d}").
449
- `,{predicate:f,local:S}=m[d];if(f){p+=`collection_getter(${a}, Base, "${d}", List) :- findall(C, triple(Base, "${f}", C), List).
450
- `;let E=[{action:"addLink",source:"this",predicate:f,target:"value",...S&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:f,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:f,target:"value",...S&&{local:!0}}];p+=`collection_adder(${a}, "${d}", '${vi(E)}').
451
- `,p+=`collection_remover(${a}, "${d}", '${vi(A)}').
452
- `,p+=`collection_setter(${a}, "${d}", '${vi(k)}').
453
- `}u.push(p)}let y=vi(o);if(n+=`constructor(${a}, '${y}').
478
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Js.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),Ca(Ca({},i),{definitions:t})}function Qd(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=zl(i);if(!ba.has(e)){var t=zd(i,{experimentalFragmentVariables:La,allowLegacyFragmentVariables:La});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ba.set(e,Qd(Kd(t)))}return ba.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 Zd(){ba.clear(),Js.clear()}function Jd(){ql=!1}function Yd(){La=!0}function Xd(){La=!1}var zr={gql:v,resetCaches:Zd,disableFragmentWarnings:Jd,enableExperimentalFragmentVariables:Yd,disableExperimentalFragmentVariables:Xd};(function(i){i.gql=zr.gql,i.resetCaches=zr.resetCaches,i.disableFragmentWarnings=zr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=zr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=zr.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 ep(){}function gi(){return ep}var M=gi,f=gi,Ce=gi,Y=gi,q=gi,Ee=gi,tp=gi,_o=gi,Vl=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)},Bi=class{constructor(e){this.code=e}};Vl([f(),Wl("design:type",String)],Bi.prototype,"code",void 0);Bi=Vl([q(),Wl("design:paramtypes",[String])],Bi);var xo=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},Eo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},kt=class{constructor(e,t){this.address=e,this.name=t}};xo([f(),Eo("design:type",String)],kt.prototype,"address",void 0);xo([f(),Eo("design:type",String)],kt.prototype,"name",void 0);kt=xo([q(),Eo("design:paramtypes",[String,String])],kt);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},xe=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ht=class{constructor(e,t){this.key=t,this.signature=e}};fe([f(),xe("design:type",String)],Ht.prototype,"signature",void 0);fe([f(),xe("design:type",String)],Ht.prototype,"key",void 0);fe([f(),xe("design:type",Boolean)],Ht.prototype,"valid",void 0);fe([f(),xe("design:type",Boolean)],Ht.prototype,"invalid",void 0);Ht=fe([q(),Ce(),xe("design:paramtypes",[String,String])],Ht);var Hi=class{};fe([f(),xe("design:type",String)],Hi.prototype,"signature",void 0);fe([f(),xe("design:type",String)],Hi.prototype,"key",void 0);fe([f(),xe("design:type",Boolean)],Hi.prototype,"valid",void 0);fe([f(),xe("design:type",Boolean)],Hi.prototype,"invalid",void 0);Hi=fe([Ce()],Hi);function mi(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return fe([f(),xe("design:type",String)],e.prototype,"author",void 0),fe([f(),xe("design:type",String)],e.prototype,"timestamp",void 0),fe([f(),xe("design:type",Object)],e.prototype,"data",void 0),fe([f(),xe("design:type",Ht)],e.prototype,"proof",void 0),e=fe([q(),xe("design:paramtypes",[String,String,Object,Ht])],e),e}function ip(i){let e=class{};return fe([f(),xe("design:type",String)],e.prototype,"author",void 0),fe([f(),xe("design:type",String)],e.prototype,"timestamp",void 0),fe([f(),xe("design:type",Object)],e.prototype,"data",void 0),fe([f(),xe("design:type",Hi)],e.prototype,"proof",void 0),e=fe([Ce()],e),e}var yc=class extends mi(){};yc=fe([q()],yc);var Pa=class extends mi(){};fe([f(),xe("design:type",kt)],Pa.prototype,"language",void 0);fe([f(),xe("design:type",Bi)],Pa.prototype,"icon",void 0);Pa=fe([q()],Pa);function Jy(i){return i&&i.author&&i.timestamp&&i.data}var we=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},Re=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Xe=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};we([f(),Re("design:type",String)],Xe.prototype,"source",void 0);we([f(),Re("design:type",String)],Xe.prototype,"target",void 0);we([f(),Re("design:type",String)],Xe.prototype,"predicate",void 0);Xe=we([q(),Re("design:paramtypes",[Object])],Xe);var Ra=class{};we([f(),Re("design:type",Array)],Ra.prototype,"additions",void 0);we([f(),Re("design:type",Array)],Ra.prototype,"removals",void 0);Ra=we([Ce()],Ra);var Na=class{constructor(e,t){this.additions=e,this.removals=t}};we([f(),Re("design:type",Array)],Na.prototype,"additions",void 0);we([f(),Re("design:type",Array)],Na.prototype,"removals",void 0);Na=we([q(),Re("design:paramtypes",[Array,Array])],Na);var En=class{};we([f(),Re("design:type",String)],En.prototype,"source",void 0);we([f(),Re("design:type",String)],En.prototype,"target",void 0);we([f(),Re("design:type",String)],En.prototype,"predicate",void 0);En=we([Ce()],En);var ci=class extends mi(){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}};we([f(),Re("design:type",String)],ci.prototype,"status",void 0);ci=we([q()],ci);var Ys=class extends ip(){};we([f(),Re("design:type",String)],Ys.prototype,"status",void 0);Ys=we([Ce()],Ys);function n0(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 a0(i){return i&&i.source&&i.target}var Oa=class{constructor(e,t){this.oldLink=e,this.newLink=t}};we([f(),Re("design:type",ci)],Oa.prototype,"oldLink",void 0);we([f(),Re("design:type",ci)],Oa.prototype,"newLink",void 0);Oa=we([q(),Re("design:paramtypes",[ci,ci])],Oa);var Yi=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},Dn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Xs,Lt=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}};Yi([f(),Dn("design:type",Array)],Lt.prototype,"links",void 0);Lt=Yi([q(),Dn("design:paramtypes",[Array])],Lt);var Da=class{};Yi([f(),Dn("design:type",Array)],Da.prototype,"links",void 0);Da=Yi([Ce()],Da);var eo=Xs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Xs;return t.links.push(e),t}};Yi([f(),Dn("design:type",Array)],eo.prototype,"links",void 0);eo=Xs=Yi([Ce(),Dn("design:paramtypes",[Array])],eo);var qi=class extends mi(){};qi=Yi([q()],qi);var j=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},B=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ri=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Lt}};j([f(),B("design:type",String)],ri.prototype,"did",void 0);j([f(),B("design:type",Lt)],ri.prototype,"perspective",void 0);j([f(),B("design:type",String)],ri.prototype,"directMessageLanguage",void 0);ri=j([q(),B("design:paramtypes",[String,Lt])],ri);var vc=class extends mi(){};vc=j([q()],vc);var li=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}};j([f(),B("design:type",String)],li.prototype,"did",void 0);j([f(),B("design:type",String)],li.prototype,"didSigningKeyId",void 0);j([f(),B("design:type",String)],li.prototype,"deviceKeyType",void 0);j([f(),B("design:type",String)],li.prototype,"deviceKey",void 0);j([f(),B("design:type",String)],li.prototype,"deviceKeySignedByDid",void 0);j([f(),B("design:type",String)],li.prototype,"didSignedByDeviceKey",void 0);li=j([q(),B("design:paramtypes",[String,String,String,String,String,String])],li);var ui=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}};j([f(),B("design:type",String)],ui.prototype,"did",void 0);j([f(),B("design:type",String)],ui.prototype,"didSigningKeyId",void 0);j([f(),B("design:type",String)],ui.prototype,"deviceKeyType",void 0);j([f(),B("design:type",String)],ui.prototype,"deviceKey",void 0);j([f(),B("design:type",String)],ui.prototype,"deviceKeySignedByDid",void 0);j([f(),B("design:type",String)],ui.prototype,"didSignedByDeviceKey",void 0);ui=j([Ce(),B("design:paramtypes",[String,String,String,String,String,String])],ui);var Ua=class{constructor(e,t){this.signature=e,this.publicKey=t}};j([f(),B("design:type",String)],Ua.prototype,"signature",void 0);j([f(),B("design:type",String)],Ua.prototype,"publicKey",void 0);Ua=j([q(),B("design:paramtypes",[String,String])],Ua);var wr=class{constructor(e,t){this.domain=e,this.pointers=t}};j([f(),B("design:type",String)],wr.prototype,"domain",void 0);j([f(),B("design:type",Array)],wr.prototype,"pointers",void 0);wr=j([q(),B("design:paramtypes",[String,Array])],wr);var Ma=class{constructor(e,t){this.with=e,this.can=t}};j([f(),B("design:type",wr)],Ma.prototype,"with",void 0);j([f(),B("design:type",Array)],Ma.prototype,"can",void 0);Ma=j([q(),B("design:paramtypes",[wr,Array])],Ma);var qt=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};j([f(),B("design:type",String)],qt.prototype,"appName",void 0);j([f(),B("design:type",String)],qt.prototype,"appDesc",void 0);j([f(),B("design:type",String)],qt.prototype,"appUrl",void 0);j([f(),B("design:type",String)],qt.prototype,"appIconPath",void 0);j([f(),B("design:type",Array)],qt.prototype,"capabilities",void 0);qt=j([q(),B("design:paramtypes",[String,String,String,Array,String])],qt);var Sr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};j([f(),B("design:type",String)],Sr.prototype,"requestId",void 0);j([f(),B("design:type",String)],Sr.prototype,"token",void 0);j([f(),B("design:type",Boolean)],Sr.prototype,"revoked",void 0);j([f(),B("design:type",qt)],Sr.prototype,"auth",void 0);Sr=j([q(),B("design:paramtypes",[String,qt,String,Boolean])],Sr);var _r=class{constructor(e,t){this.domain=e,this.pointers=t}};j([f(),B("design:type",String)],_r.prototype,"domain",void 0);j([f(),B("design:type",Array)],_r.prototype,"pointers",void 0);_r=j([Ce(),B("design:paramtypes",[String,Array])],_r);var Fa=class{constructor(e,t){this.with=e,this.can=t}};j([f(),B("design:type",_r)],Fa.prototype,"with",void 0);j([f(),B("design:type",Array)],Fa.prototype,"can",void 0);Fa=j([Ce(),B("design:paramtypes",[_r,Array])],Fa);var Pt=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}};j([f(),B("design:type",String)],Pt.prototype,"appName",void 0);j([f(),B("design:type",String)],Pt.prototype,"appDesc",void 0);j([f(),B("design:type",String)],Pt.prototype,"appDomain",void 0);j([f(),B("design:type",String)],Pt.prototype,"appUrl",void 0);j([f(),B("design:type",String)],Pt.prototype,"appIconPath",void 0);j([f(),B("design:type",Array)],Pt.prototype,"capabilities",void 0);Pt=j([Ce(),B("design:paramtypes",[String,String,String,String,String,Array])],Pt);var zi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};j([f(),B("design:type",String)],zi.prototype,"did",void 0);j([f(),B("design:type",Boolean)],zi.prototype,"success",void 0);j([f(),B("design:type",String)],zi.prototype,"error",void 0);zi=j([q(),B("design:paramtypes",[String,Boolean,String])],zi);var Cr=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},Lr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},dt=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)}};Cr([f(),Lr("design:type",Boolean)],dt.prototype,"isInitialized",void 0);Cr([f(),Lr("design:type",Boolean)],dt.prototype,"isUnlocked",void 0);Cr([f(),Lr("design:type",String)],dt.prototype,"did",void 0);Cr([f(),Lr("design:type",String)],dt.prototype,"didDocument",void 0);Cr([f(),Lr("design:type",String)],dt.prototype,"error",void 0);dt=Cr([q(),Lr("design:paramtypes",[Object])],dt);var bc=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)},Ze,Je,to=class{constructor(e,t){Ze.set(this,void 0),Je.set(this,void 0),bc(this,Ze,e,"f"),bc(this,Je,t,"f")}async otherAgents(){return await me(this,Ze,"f").otherAgents(me(this,Je,"f"))}async hasTelepresenceAdapter(){return await me(this,Ze,"f").hasTelepresenceAdapter(me(this,Je,"f"))}async onlineAgents(){return await me(this,Ze,"f").onlineAgents(me(this,Je,"f"))}async setOnlineStatus(e){return await me(this,Ze,"f").setOnlineStatus(me(this,Je,"f"),e)}async setOnlineStatusU(e){return await me(this,Ze,"f").setOnlineStatusU(me(this,Je,"f"),e)}async sendSignal(e,t){return await me(this,Ze,"f").sendSignal(me(this,Je,"f"),e,t)}async sendSignalU(e,t){return await me(this,Ze,"f").sendSignalU(me(this,Je,"f"),e,t)}async sendBroadcast(e,t=!1){return await me(this,Ze,"f").sendBroadcast(me(this,Je,"f"),e,t)}async sendBroadcastU(e,t=!1){return await me(this,Ze,"f").sendBroadcastU(me(this,Je,"f"),e,t)}async addSignalHandler(e){await me(this,Ze,"f").addSignalHandler(me(this,Je,"f"),e)}removeSignalHandler(e){me(this,Ze,"f").removeSignalHandler(me(this,Je,"f"),e)}};Ze=new WeakMap,Je=new WeakMap;var Xi=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},er=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ae=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)}};Xi([f(),er("design:type",String)],ae.prototype,"source",void 0);Xi([f(),er("design:type",String)],ae.prototype,"target",void 0);Xi([f(),er("design:type",String)],ae.prototype,"predicate",void 0);Xi([f(),er("design:type",Date)],ae.prototype,"fromDate",void 0);Xi([f(),er("design:type",Date)],ae.prototype,"untilDate",void 0);Xi([f(),er("design:type",Number)],ae.prototype,"limit",void 0);ae=Xi([q(),Ce(),er("design:paramtypes",[Object])],ae);var wc=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},Le=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,Ut;function ia(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var le=class{constructor(){Ye.set(this,void 0),Ut.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 le;return wc(t,Ut,e,"f"),t}static from(e){let t=new le;return wc(t,Ye,e,"f"),t}toUrl(){if(Le(this,Ut,"f")&&!Le(this,Ye,"f"))return Le(this,Ut,"f");if(!Le(this,Ut,"f")&&(Le(this,Ye,"f")===void 0||Le(this,Ye,"f")===""||Le(this,Ye,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Le(this,Ye,"f")){case"string":e=`string:${ia(Le(this,Ye,"f"))}`;break;case"number":e=`number:${ia(Le(this,Ye,"f"))}`;break;case"boolean":e=`boolean:${ia(Le(this,Ye,"f"))}`;break;case"object":e=`json:${ia(JSON.stringify(Le(this,Ye,"f")))}`;break}return`literal://${e}`}get(){if(Le(this,Ye,"f"))return Le(this,Ye,"f");if(!Le(this,Ut,"f"))throw new Error("Can't render empty Literal");if(!Le(this,Ut,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Le(this,Ut,"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}`)}};Ye=new WeakMap,Ut=new WeakMap;function qe(i){return i.charAt(0).toUpperCase()+i.slice(1)}function es(i){return`set${qe(i)}`}function Kl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function rp(i){return`add${qe(Kl(i))}`}function np(i){return`remove${qe(Kl(i))}`}function ap(i){return`set${qe(i)}`}function Ql(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 Ai(i){if(Array.isArray(i))return`[${i.map(Ai).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 Ps=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)},Fe,je,ye,yn=class{constructor(i,e,t){Fe.set(this,void 0),je.set(this,void 0),ye.set(this,void 0),Ps(this,Fe,e,"f"),Ps(this,je,t,"f"),Ps(this,ye,i,"f")}get baseExpression(){return K(this,Fe,"f")}async init(){let isInstance=await K(this,ye,"f").isSubjectInstance(K(this,Fe,"f"),K(this,je,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,je,"f")} for ${K(this,Fe,"f")}`;let results=await K(this,ye,"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,ye,"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,ye,"f").getPropertyValueViaSurreal(K(this,Fe,"f"),K(this,je,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,ye,"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,ye,"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[es(property)]=async i=>{resolveLanguage&&(i=await K(this,ye,"f").createExpression(i,resolveLanguage)),await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let results2=await K(this,ye,"f").infer(`subject_class("${K(this,je,"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,ye,"f").getRelationValuesViaSurreal(K(this,Fe,"f"),K(this,je,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ye,"f").infer(`subject_class("${K(this,je,"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[rp(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:e}]))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let removers=await K(this,ye,"f").infer(`subject_class("${K(this,je,"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[np(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:e}]))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,ye,"f").infer(`subject_class("${K(this,je,"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[ap(relation)]=async i=>{Array.isArray(i)?await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}}};Fe=new WeakMap,je=new WeakMap,ye=new WeakMap;function sp(i,e,t,r){let n="",a=Ql(8);n+=`subject_class("${i}", ${a}).
479
+ `;let s=[],o=[];e.subjectConstructor&&e.subjectConstructor.length&&(o=o.concat(e.subjectConstructor));let l=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(l=l.concat(e.isSubjectInstance));let c=[];for(let d in t){let h=`property(${a}, "${d}").
480
+ `,{through:g,initial:_,required:E,resolveLanguage:A,writable:I,flag:w,prologGetter:L,prologSetter:U,local:P}=t[d];if(A&&(h+=`property_resolve(${a}, "${d}").
481
+ `,h+=`property_resolve_language(${a}, "${d}", "${A}").
482
+ `),L?h+=`property_getter(${a}, Base, "${d}", Value) :- ${L}.
483
+ `:g&&(h+=`property_getter(${a}, Base, "${d}", Value) :- triple(Base, "${g}", Value).
484
+ `,E&&(w?l.push(`triple(Base, "${g}", "${_}")`):l.push(`triple(Base, "${g}", _)`))),U)h+=`property_setter(${a}, "${d}", Actions) :- ${U}.
485
+ `;else if(I&&g&&typeof e[es(d)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...P&&{local:!0}}];h+=`property_setter(${a}, "${d}", '${Ai(R)}').
486
+ `}c.push(h);let G=_??(E&&I&&!w&&g?"literal://string:":void 0);G&&(o.push({action:"addLink",source:"this",predicate:g,target:G}),s.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let u=[],m=Object.fromEntries(Object.entries(r).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let d in m){let h=`collection(${a}, "${d}").
487
+ `,{predicate:g,local:_}=m[d];if(g){h+=`collection_getter(${a}, Base, "${d}", List) :- findall(C, triple(Base, "${g}", C), List).
488
+ `;let E=[{action:"addLink",source:"this",predicate:g,target:"value",..._&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:g,target:"value"}],I=[{action:"collectionSetter",source:"this",predicate:g,target:"value",..._&&{local:!0}}];h+=`collection_adder(${a}, "${d}", '${Ai(E)}').
489
+ `,h+=`collection_remover(${a}, "${d}", '${Ai(A)}').
490
+ `,h+=`collection_setter(${a}, "${d}", '${Ai(I)}').
491
+ `}u.push(h)}let y=Ai(o);if(n+=`constructor(${a}, '${y}').
454
492
  `,l.length>0){let d=l.join(", ");n+=`instance(${a}, Base) :- ${d}.
455
493
  `,n+=`
456
- `}return n+=`destructor(${a}, '${vi(s)}').
494
+ `}return n+=`destructor(${a}, '${Ai(s)}').
457
495
  `,n+=`
458
496
  `,n+=c.join(`
459
497
  `),n+=`
460
498
  `,n+=u.join(`
461
- `),{sdna:n,name:i}}function nc(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 ac(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 sc(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=nc(e),n=sc(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#> .
499
+ `),{sdna:n,name:i}}function Sc(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 _c(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 xc(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 ni=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=Sc(e),n=xc(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#> .
462
500
  `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
463
501
  `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
464
502
  `,e+=`@prefix ad4m: <ad4m://> .
@@ -473,27 +511,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
473
511
  `),r.nodeKind&&(e+=` sh:nodeKind sh:${r.nodeKind} ;
474
512
  `),r.minCount!==void 0&&(e+=` sh:minCount ${r.minCount} ;
475
513
  `),r.maxCount!==void 0&&(e+=` sh:maxCount ${r.maxCount} ;
476
- `),r.pattern&&(e+=` sh:pattern "${ac(r.pattern)}" ;
514
+ `),r.pattern&&(e+=` sh:pattern "${_c(r.pattern)}" ;
477
515
  `),r.minInclusive!==void 0&&(e+=` sh:minInclusive ${r.minInclusive} ;
478
516
  `),r.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${r.maxInclusive} ;
479
- `),r.hasValue&&(e+=` sh:hasValue "${ac(r.hasValue)}" ;
517
+ `),r.hasValue&&(e+=` sh:hasValue "${_c(r.hasValue)}" ;
480
518
  `),r.local!==void 0&&(e+=` ad4m:local ${r.local} ;
481
519
  `),r.writable!==void 0&&(e+=` ad4m:writable ${r.writable} ;
482
520
  `),e=e.slice(0,-2)+`
483
521
  `,e+=n?` ] .
484
522
  `:` ] ;
485
- `}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=nc(this.targetClass),s=sc(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)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(l=>l.source===t&&l.predicate==="sh://targetClass"),n=new Jt(t,r?.target),a=e.find(l=>l.source===t&&l.predicate==="ad4m://constructor");if(a)try{let l=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(l)}catch{}let s=e.find(l=>l.source===t&&l.predicate==="ad4m://destructor");if(s)try{let l=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(l)}catch{}let o=e.filter(l=>l.source===t&&l.predicate==="sh://property");for(let l of o){let c=l.target,u=e.find(I=>I.source===c&&I.predicate==="sh://path");if(!u)continue;let m;if(!c.startsWith("_:")){let I=c.lastIndexOf(".");I!==-1&&(m=c.substring(I+1))}let y={name:m,path:u.target},d=e.find(I=>I.source===c&&I.predicate==="sh://datatype");d&&(y.datatype=d.target);let p=e.find(I=>I.source===c&&I.predicate==="sh://nodeKind");p&&(y.nodeKind=p.target.replace("sh://",""));let f=e.find(I=>I.source===c&&I.predicate==="sh://minCount");if(f){let I=f.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.minCount=parseInt(I)}let S=e.find(I=>I.source===c&&I.predicate==="sh://maxCount");if(S){let I=S.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.maxCount=parseInt(I)}let E=e.find(I=>I.source===c&&I.predicate==="sh://pattern");E&&(y.pattern=E.target.replace("literal://",""));let A=e.find(I=>I.source===c&&I.predicate==="sh://minInclusive");if(A){let I=A.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.minInclusive=parseFloat(I)}let k=e.find(I=>I.source===c&&I.predicate==="sh://maxInclusive");if(k){let I=k.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.maxInclusive=parseFloat(I)}let b=e.find(I=>I.source===c&&I.predicate==="sh://hasValue");b&&(y.hasValue=b.target.replace("literal://",""));let T=e.find(I=>I.source===c&&I.predicate==="ad4m://local");if(T){let I=T.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.local=I==="true"}let R=e.find(I=>I.source===c&&I.predicate==="ad4m://writable");if(R){let I=R.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.writable=I==="true"}let C=e.find(I=>I.source===c&&I.predicate==="ad4m://resolveLanguage");C&&(y.resolveLanguage=C.target.replace("literal://string:",""));let Q=e.find(I=>I.source===c&&I.predicate==="ad4m://setter");if(Q)try{let I=Q.target.replace("literal://string:","");y.setter=JSON.parse(I)}catch{}let V=e.find(I=>I.source===c&&I.predicate==="ad4m://adder");if(V)try{let I=V.target.replace("literal://string:","");y.adder=JSON.parse(I)}catch{}let L=e.find(I=>I.source===c&&I.predicate==="ad4m://remover");if(L)try{let I=L.target.replace("literal://string:","");y.remover=JSON.parse(I)}catch{}let W=e.find(I=>I.source===c&&I.predicate==="ad4m://getter");W&&(y.getter=W.target.replace("literal://string:",""));let He=e.find(I=>I.source===c&&I.predicate==="ad4m://conformanceConditions");if(He)try{let I=He.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(I)}catch{}let Rr=e.find(I=>I.source===c&&I.predicate==="sh://class");Rr&&(y.class=Rr.target),n.addProperty(y)}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,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),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,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});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}};function oc(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 Nl(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`${oc(e)} your ${t} actions, with access to ${oc(r)}`}function Y(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function se(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>se(e)).join(", ")}]`:String(i)}function Fd(i,e,t){let r=Y(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>se(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let l=a.not.map(c=>se(c)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${l}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(e)}]) > 0`}function Rl(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let l=e.properties[r];l?(a=l.predicate,s=l.resolveLanguage):a=r}else a=r;let o=Fd(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function jd(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));if(Object.keys(t).length>0){let p=t[Object.keys(t)[0]];if(p.through){let f=p.through.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}else if(Object.keys(o).length>0){let p=o[Object.keys(o)[0]];if(p.predicate){let f=p.predicate.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new Jt(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let p=m.generateSHACL();p?.shape?.nodeShapeUri&&u.addParentShape(p.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let p in t){let f=t[p];if(!f.through)continue;let S={name:p,path:f.through};if(f.resolveLanguage==="literal")S.datatype="xsd://string";else if(f.initial){let A=typeof a[p];A==="number"?S.datatype="xsd://integer":A==="boolean"?S.datatype="xsd://boolean":A==="string"&&(S.datatype="xsd://string")}f.required&&(S.minCount=1),S.maxCount=1,f.flag&&f.initial&&(S.hasValue=f.initial),f.local!==void 0&&(S.local=f.local),f.writable!==void 0&&(S.writable=f.writable),f.resolveLanguage&&(S.resolveLanguage=f.resolveLanguage),f.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${p}' in class '${i}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):f.writable&&f.through&&typeof a[Wa(p)]=="function"&&(S.setter=[{action:"setSingleTarget",source:"this",predicate:f.through,target:"value",...f.local&&{local:!0}}]);let E=f.initial??(f.required&&f.writable&&!f.flag&&f.through?"literal://string:":void 0);E&&(y.push({action:"addLink",source:"this",predicate:f.through,target:E}),d.push({action:"removeLink",source:"this",predicate:f.through,target:"*"})),u.addProperty(S)}for(let p in o){let f=o[p];if(!f.predicate)continue;let S={name:p,path:f.predicate};if(S.nodeKind="IRI",f.local!==void 0&&(S.local=f.local),S.adder=[{action:"addLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],S.remover=[{action:"removeLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],f.getter)S.getter=f.getter;else if(f.where)try{let E=f.target?.(),A=E?E.getModelMetadata?.()??null:null,k=Rl(f.where,A);if(k.length>0){let b=Y(f.predicate);S.getter=`(->link[WHERE predicate = '${b}'].out[WHERE ${k.join(" AND ")}].uri)`}}catch{}else if(f.target&&f.filter!==!1)try{let E=f.target(),A=n(f.predicate,E);A&&(S.getter=A.getter,S.conformanceConditions=A.conformanceConditions)}catch{}if(f.target)try{let A=f.target().generateSHACL?.();A?.shape?.nodeShapeUri&&(S.class=A.shape.nodeShapeUri)}catch{}u.addProperty(S)}return u.setConstructorActions(y),u.setDestructorActions(d),{shape:u,name:i}}var xt=new WeakMap,Re=new WeakMap;function Mi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=xt.get(n);a&&Object.assign(e,a)}return e}function wt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Re.get(n);a&&Object.assign(e,a)}return e}function Bd(i,e,t){xt.has(i)||xt.set(i,{}),xt.get(i)[e]=t}function qd(i,e,t){Re.has(i)||Re.set(i,{}),Re.get(i)[e]=t}function Pl(i,e){try{let t=Mi(e),r=[],n=[];for(let[o,l]of Object.entries(t))l.flag&&l.initial&&l.through&&(r.push({type:"flag",predicate:l.through,value:l.initial}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}' AND out.uri = '${Y(l.initial)}']) > 0`));for(let[o,l]of Object.entries(t))l.required&&!l.flag&&!l.getter&&l.through&&(r.push({type:"required",predicate:l.through}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${Y(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function Ka(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(xt.has(n)||xt.set(n,{}),xt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${Be(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Vy(i){return Ka({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function zy(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;xt.has(n)||xt.set(n,{}),xt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Hd(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return Ud(i.name,e.prototype,Mi(e),wt(e))},e.generateSHACL=function(){return jd(i.name,e,Mi(e),wt(e),Pl)},Object.defineProperty(e,"type",{configurable:!0})}}function Vd(i){let e=i.required??!1;return Ka({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function Wy(i){return Vd({...i,readOnly:!0})}function Qa(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function Ky(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${Be(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${Be(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${Be(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Qy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(Ka({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${Be(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${Be(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${Be(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Gy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Ka({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function Zy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var 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:oe.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:oe.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:oe.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:oe.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),l=new vr(o,s),c=e.find(p=>p.source===t&&p.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let p=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(p))}catch{l.flowable="any"}let u=e.find(p=>p.source===t&&p.predicate==="ad4m://startAction");if(u)try{let p=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(p))}catch{}let m=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasState"),y=new Map;for(let p of m){let f=p.target,S=e.find(R=>R.source===f&&R.predicate==="ad4m://stateName"),E=S?oe.fromUrl(S.target).get():"";y.set(f,E);let A=e.find(R=>R.source===f&&R.predicate==="ad4m://stateValue"),k=A?oe.fromUrl(A.target).get():0,b=e.find(R=>R.source===f&&R.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(b)try{let R=b.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(R))}catch{}l.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 f=p.target,S=e.find(L=>L.source===f&&L.predicate==="ad4m://actionName"),E=S?oe.fromUrl(S.target).get():"",k=e.find(L=>L.source===f&&L.predicate==="ad4m://fromState")?.target||"",b=y.get(k)||"",R=e.find(L=>L.source===f&&L.predicate==="ad4m://toState")?.target||"",C=y.get(R)||"",Q=e.find(L=>L.source===f&&L.predicate==="ad4m://transitionActions"),V=[];if(Q)try{let L=Q.target.replace("literal://string:","");V=JSON.parse(decodeURIComponent(L))}catch{}l.addTransition({actionName:E,fromState:b,toState:C,actions:V})}return l}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}},ae=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},_=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)},pa,Pt,yt,vt,ki,zt,Wt,bi,Vr,fa,wi,Si,at,dr,Ws,ee,ie,_i,Ei,xi,zr,Na=class{constructor(e,t,r){pa.add(this),Pt.set(this,void 0),yt.set(this,void 0),vt.set(this,void 0),ki.set(this,void 0),zt.set(this,void 0),Wt.set(this,void 0),bi.set(this,void 0),Vr.set(this,!1),fa.set(this,void 0),wi.set(this,void 0),Si.set(this,void 0),at.set(this,void 0),dr.set(this,void 0),this.isSurrealDB=!1,ae(this,Pt,e,"f"),ae(this,dr,t,"f"),ae(this,vt,r,"f"),ae(this,ki,new Set,"f"),ae(this,bi,null,"f"),ae(this,fa,new Promise((n,a)=>{ae(this,wi,n,"f"),ae(this,Si,a,"f")}),"f")}async subscribe(){_(this,Wt,"f")&&(_(this,Wt,"f").call(this),ae(this,Wt,void 0,"f")),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,zt,"f")&&(clearTimeout(_(this,zt,"f")),ae(this,zt,void 0,"f"));try{let t;this.isSurrealDB?t=await _(this,vt,"f").perspectiveSubscribeSurrealQuery(_(this,Pt,"f"),_(this,dr,"f")):t=await _(this,vt,"f").subscribeQuery(_(this,Pt,"f"),_(this,dr,"f")),ae(this,yt,t.subscriptionId,"f"),t.result?(ae(this,bi,t.result,"f"),_(this,pa,"m",Ws).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ae(this,at,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"),ae(this,Wt,_(this,vt,"f").subscribeToQueryUpdates(_(this,yt,"f"),r=>{_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,wi,"f")&&(_(this,wi,"f").call(this,!0),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),!(r.isInit&&_(this,bi,"f"))&&(ae(this,bi,r,"f"),_(this,pa,"m",Ws).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),_(this,Si,"f")&&(_(this,Si,"f").call(this,t),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),t}let e=async()=>{if(!_(this,Vr,"f")){try{this.isSurrealDB?await _(this,vt,"f").perspectiveKeepAliveSurrealQuery(_(this,Pt,"f"),_(this,yt,"f")):await _(this,vt,"f").keepAliveQuery(_(this,Pt,"f"),_(this,yt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",_(this,dr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}_(this,Vr,"f")||ae(this,zt,setTimeout(e,3e4),"f")}};ae(this,zt,setTimeout(e,3e4),"f")}get id(){return _(this,yt,"f")}get initialized(){return _(this,fa,"f")}get result(){return _(this,bi,"f")}onResult(e){return _(this,ki,"f").add(e),()=>_(this,ki,"f").delete(e)}dispose(){ae(this,Vr,!0,"f"),clearTimeout(_(this,zt,"f")),_(this,Wt,"f")&&_(this,Wt,"f").call(this),_(this,ki,"f").clear(),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,yt,"f")&&(this.isSurrealDB?_(this,vt,"f").perspectiveDisposeSurrealQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):_(this,vt,"f").disposeQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Pt=new WeakMap,yt=new WeakMap,vt=new WeakMap,ki=new WeakMap,zt=new WeakMap,Wt=new WeakMap,bi=new WeakMap,Vr=new WeakMap,fa=new WeakMap,wi=new WeakMap,Si=new WeakMap,at=new WeakMap,dr=new WeakMap,pa=new WeakSet,Ws=function i(e){for(let t of _(this,ki,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var fr=class{constructor(e,t){ee.set(this,void 0),ie.set(this,void 0),_i.set(this,void 0),Ei.set(this,void 0),xi.set(this,void 0),zr.set(this,void 0),ae(this,_i,[],"f"),ae(this,Ei,[],"f"),ae(this,xi,[],"f"),ae(this,zr,[],"f"),ae(this,ee,e,"f"),ae(this,ie,t,"f"),this.uuid=_(this,ee,"f").uuid,this.name=_(this,ee,"f").name,this.owners=_(this,ee,"f").owners,this.sharedUrl=_(this,ee,"f").sharedUrl,this.neighbourhood=_(this,ee,"f").neighbourhood,this.state=_(this,ee,"f").state,_(this,ie,"f").addPerspectiveLinkAddedListener(_(this,ee,"f").uuid,_(this,_i,"f")),_(this,ie,"f").addPerspectiveLinkRemovedListener(_(this,ee,"f").uuid,_(this,Ei,"f")),_(this,ie,"f").addPerspectiveLinkUpdatedListener(_(this,ee,"f").uuid,_(this,xi,"f")),_(this,ie,"f").addPerspectiveSyncStateChangeListener(_(this,ee,"f").uuid,_(this,zr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await _(this,ie,"f").executeCommands(_(this,ee,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await _(this,ie,"f").queryLinks(_(this,ee,"f").uuid,e)}async infer(e){return await _(this,ie,"f").queryProlog(_(this,ee,"f").uuid,e)}async querySurrealDB(e){return await _(this,ie,"f").querySurrealDB(_(this,ee,"f").uuid,e)}async add(e,t="shared",r){return await _(this,ie,"f").addLink(_(this,ee,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await _(this,ie,"f").addLinks(_(this,ee,"f").uuid,e,t,r)}async removeLinks(e,t){return await _(this,ie,"f").removeLinks(_(this,ee,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await _(this,ie,"f").linkMutations(_(this,ee,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await _(this,ie,"f").addLinkExpression(_(this,ee,"f").uuid,e,t,r)}async update(e,t,r){return await _(this,ie,"f").updateLink(_(this,ee,"f").uuid,e,t,r)}async remove(e,t){return await _(this,ie,"f").removeLink(_(this,ee,"f").uuid,e,t)}async createBatch(){return await _(this,ie,"f").createBatch(_(this,ee,"f").uuid)}async commitBatch(e){return await _(this,ie,"f").commitBatch(_(this,ee,"f").uuid,e)}async getExpression(e){return await _(this,ie,"f").getExpression(e)}async createExpression(e,t){return await _(this,ie,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?_(this,_i,"f").push(t):e==="link-removed"?_(this,Ei,"f").push(t):e==="link-updated"&&_(this,xi,"f").push(t)}async addSyncStateChangeListener(e){_(this,zr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=_(this,_i,"f").indexOf(t);_(this,_i,"f").splice(r,1)}else if(e==="link-removed"){let r=_(this,Ei,"f").indexOf(t);_(this,Ei,"f").splice(r,1)}else if(e==="link-updated"){let r=_(this,xi,"f").indexOf(t);_(this,xi,"f").splice(r,1)}}async snapshot(){return _(this,ie,"f").snapshotByUUID(_(this,ee,"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 re({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 re({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return oe.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 re({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 re({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 re({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 re({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 re({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new re({source:s,predicate:"ad4m://sdna"}));for(let l of o){let c=oe.fromUrl(l.data.target).get();typeof c=="string"&&t.push(c)}}}return t}async getSdnaForClass(e){let t=oe.from(e);if((await this.get(new re({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new re({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=oe.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return _(this,ie,"f").addSdna(_(this,ee,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=oe.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ke({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=oe.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new re({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;Y(n);let a=await this.get(new re({source:n,predicate:"sh://property"})),l=`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=>`'${Y(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return Jt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new re({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=oe.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=oe.from(e).toUrl(),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ke({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=oe.from(e).toUrl(),r=await this.get(new re({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=Y(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=Y(s),l=`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(l)||[]).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 re({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 _(this,ie,"f").createSubject(_(this,ee,"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 _(this,ie,"f").createSubject(_(this,ee,"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 _(this,ie,"f").getSubjectData(_(this,ee,"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 _(this,ie,"f").getSubjectData(_(this,ee,"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 re({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let l=s.data.target.slice(o.length),c=l;try{c=decodeURIComponent(l)}catch{}try{return JSON.parse(c)}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 = '${Y(e)}'`,l=(await this.querySurrealDB(s))[0]?.count??0;return(typeof l=="object"&&l?.Int!==void 0?l.Int:l)>0}for(let a of n.requiredTriples){let s=Y(e),o=Y(a.predicate),l;if(a.target){let y=Y(a.target);l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${y}'`}else l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let c=await this.querySurrealDB(l);if(!c||c.length===0)return!1;let u=c[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 un(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 l of t.properties){if(!l.path||!l.name)continue;l.writable&&o.add(l.path),l.adder&&l.adder.length>0?s.set(l.name,{predicate:l.path}):a.set(l.name,{predicate:l.path,resolveLanguage:l.resolveLanguage})}if(t.constructor_actions){for(let l of t.constructor_actions)if(l.predicate){r.push(l.predicate);let c=o.has(l.predicate);l.target&&l.target!=="value"&&!c?n.push({predicate:l.predicate,target:l.target}):n.push({predicate:l.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=Y(r.predicate);if(r.target){let a=Y(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=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(l);if(!c||c.length===0)return;let u=c[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 getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(l);if(!c||c.length===0)return[];let u=c.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let y of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${y.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)&&m.push(y)}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(l=>`'${Y(l)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(l=>l.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${Y(u)}'`).join(", "),o=Y(a.predicate),l;if(a.target){let u=Y(a.target);l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let c=await this.querySurrealDB(l);r.push(new Set(c.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),l=await this.querySurrealDB(o);for(let c of l||[])try{let u;r?(u=new e(this,c.base),await u.get()):(u=new un(this,c.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 l of o||[])try{let c=new un(this,l.base,n);await c.init(),r.push(c)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Mi(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(m=>!Array.isArray(e[m]));let o=a?Object.fromEntries(Object.entries(wt(a)).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(m=>m!=="isSubjectInstance"):r=Object.keys(e).filter(m=>Array.isArray(e[m])&&m!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let l=`SELECT
523
+ `}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=Sc(this.targetClass),s=xc(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)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(l=>l.source===t&&l.predicate==="sh://targetClass"),n=new ni(t,r?.target),a=e.find(l=>l.source===t&&l.predicate==="ad4m://constructor");if(a)try{let l=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(l)}catch{}let s=e.find(l=>l.source===t&&l.predicate==="ad4m://destructor");if(s)try{let l=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(l)}catch{}let o=e.filter(l=>l.source===t&&l.predicate==="sh://property");for(let l of o){let c=l.target,u=e.find(T=>T.source===c&&T.predicate==="sh://path");if(!u)continue;let m;if(!c.startsWith("_:")){let T=c.lastIndexOf(".");T!==-1&&(m=c.substring(T+1))}let y={name:m,path:u.target},d=e.find(T=>T.source===c&&T.predicate==="sh://datatype");d&&(y.datatype=d.target);let h=e.find(T=>T.source===c&&T.predicate==="sh://nodeKind");h&&(y.nodeKind=h.target.replace("sh://",""));let g=e.find(T=>T.source===c&&T.predicate==="sh://minCount");if(g){let T=g.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),y.minCount=parseInt(T)}let _=e.find(T=>T.source===c&&T.predicate==="sh://maxCount");if(_){let T=_.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),y.maxCount=parseInt(T)}let E=e.find(T=>T.source===c&&T.predicate==="sh://pattern");E&&(y.pattern=E.target.replace("literal://",""));let A=e.find(T=>T.source===c&&T.predicate==="sh://minInclusive");if(A){let T=A.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),y.minInclusive=parseFloat(T)}let I=e.find(T=>T.source===c&&T.predicate==="sh://maxInclusive");if(I){let T=I.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),y.maxInclusive=parseFloat(T)}let w=e.find(T=>T.source===c&&T.predicate==="sh://hasValue");w&&(y.hasValue=w.target.replace("literal://",""));let L=e.find(T=>T.source===c&&T.predicate==="ad4m://local");if(L){let T=L.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),y.local=T==="true"}let U=e.find(T=>T.source===c&&T.predicate==="ad4m://writable");if(U){let T=U.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),y.writable=T==="true"}let P=e.find(T=>T.source===c&&T.predicate==="ad4m://resolveLanguage");P&&(y.resolveLanguage=P.target.replace("literal://string:",""));let G=e.find(T=>T.source===c&&T.predicate==="ad4m://setter");if(G)try{let T=G.target.replace("literal://string:","");y.setter=JSON.parse(T)}catch{}let V=e.find(T=>T.source===c&&T.predicate==="ad4m://adder");if(V)try{let T=V.target.replace("literal://string:","");y.adder=JSON.parse(T)}catch{}let R=e.find(T=>T.source===c&&T.predicate==="ad4m://remover");if(R)try{let T=R.target.replace("literal://string:","");y.remover=JSON.parse(T)}catch{}let W=e.find(T=>T.source===c&&T.predicate==="ad4m://getter");W&&(y.getter=W.target.replace("literal://string:",""));let Ke=e.find(T=>T.source===c&&T.predicate==="ad4m://conformanceConditions");if(Ke)try{let T=Ke.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(T)}catch{}let Dr=e.find(T=>T.source===c&&T.predicate==="sh://class");Dr&&(y.class=Dr.target),n.addProperty(y)}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,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new ni(e.node_shape_uri,e.target_class):new ni(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,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});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}};function Ec(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 Gl(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`${Ec(e)} your ${t} actions, with access to ${Ec(r)}`}function ee(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function ce(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>ce(e)).join(", ")}]`:String(i)}function op(i,e,t){let r=ee(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>ce(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let l=a.not.map(c=>ce(c)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${l}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${ce(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${ce(e)}]) > 0`}function Zl(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let l=e.properties[r];l?(a=l.predicate,s=l.resolveLanguage):a=r}else a=r;let o=op(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function cp(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(t).length>0){let h=t[Object.keys(t)[0]];if(h.through){let g=h.through.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}else if(Object.keys(o).length>0){let h=o[Object.keys(o)[0]];if(h.predicate){let g=h.predicate.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new ni(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let h=m.generateSHACL();h?.shape?.nodeShapeUri&&u.addParentShape(h.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let h in t){let g=t[h];if(!g.through)continue;let _={name:h,path:g.through};if(g.resolveLanguage==="literal")_.datatype="xsd://string";else if(g.initial){let A=typeof a[h];A==="number"?_.datatype="xsd://integer":A==="boolean"?_.datatype="xsd://boolean":A==="string"&&(_.datatype="xsd://string")}g.required&&(_.minCount=1),_.maxCount=1,g.flag&&g.initial&&(_.hasValue=g.initial),g.local!==void 0&&(_.local=g.local),g.writable!==void 0&&(_.writable=g.writable),g.resolveLanguage&&(_.resolveLanguage=g.resolveLanguage),g.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${i}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):g.writable&&g.through&&typeof a[es(h)]=="function"&&(_.setter=[{action:"setSingleTarget",source:"this",predicate:g.through,target:"value",...g.local&&{local:!0}}]);let E=g.initial??(g.required&&g.writable&&!g.flag&&g.through?"literal://string:":void 0);E&&(y.push({action:"addLink",source:"this",predicate:g.through,target:E}),d.push({action:"removeLink",source:"this",predicate:g.through,target:"*"})),u.addProperty(_)}for(let h in o){let g=o[h];if(!g.predicate)continue;let _={name:h,path:g.predicate};if(_.nodeKind="IRI",g.local!==void 0&&(_.local=g.local),_.adder=[{action:"addLink",source:"this",predicate:g.predicate,target:"value",...g.local&&{local:!0}}],_.remover=[{action:"removeLink",source:"this",predicate:g.predicate,target:"value",...g.local&&{local:!0}}],g.getter)_.getter=g.getter;else if(g.where)try{let E=g.target?.(),A=E?E.getModelMetadata?.()??null:null,I=Zl(g.where,A);if(I.length>0){let w=ee(g.predicate);_.getter=`(->link[WHERE predicate = '${w}'].out[WHERE ${I.join(" AND ")}].uri)`}}catch{}else if(g.target&&g.filter!==!1)try{let E=g.target(),A=n(g.predicate,E);A&&(_.getter=A.getter,_.conformanceConditions=A.conformanceConditions)}catch{}if(g.target)try{let A=g.target().generateSHACL?.();A?.shape?.nodeShapeUri&&(_.class=A.shape.nodeShapeUri)}catch{}u.addProperty(_)}return u.setConstructorActions(y),u.setDestructorActions(d),{shape:u,name:i}}var It=new WeakMap,De=new WeakMap;function Vi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=It.get(n);a&&Object.assign(e,a)}return e}function Et(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=De.get(n);a&&Object.assign(e,a)}return e}function lp(i,e,t){It.has(i)||It.set(i,{}),It.get(i)[e]=t}function up(i,e,t){De.has(i)||De.set(i,{}),De.get(i)[e]=t}function Jl(i,e){try{let t=Vi(e),r=[],n=[];for(let[o,l]of Object.entries(t))l.flag&&l.initial&&l.through&&(r.push({type:"flag",predicate:l.through,value:l.initial}),n.push(`count(->link[WHERE predicate = '${ee(l.through)}' AND out.uri = '${ee(l.initial)}']) > 0`));for(let[o,l]of Object.entries(t))l.required&&!l.flag&&!l.getter&&l.through&&(r.push({type:"required",predicate:l.through}),n.push(`count(->link[WHERE predicate = '${ee(l.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${ee(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function ts(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(It.has(n)||It.set(n,{}),It.get(n)[t]={...i,writable:r},r){let a=t;e[`set${qe(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function A0(i){return ts({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function k0(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;It.has(n)||It.set(n,{}),It.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function dp(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return sp(i.name,e.prototype,Vi(e),Et(e))},e.generateSHACL=function(){return cp(i.name,e,Vi(e),Et(e),Jl)},Object.defineProperty(e,"type",{configurable:!0})}}function pp(i){let e=i.required??!1;return ts({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function I0(i){return pp({...i,readOnly:!0})}function is(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function T0(i,e){let t=is(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${qe(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${qe(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${qe(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function C0(i,e){let t=is(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(ts({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${qe(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${qe(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${qe(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function L0(i,e){let t=is(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?ts({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function P0(i,e){let t=is(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var xr=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:le.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:le.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:le.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:le.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),l=new xr(o,s),c=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let h=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(h))}catch{l.flowable="any"}let u=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(u)try{let h=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(h))}catch{}let m=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),y=new Map;for(let h of m){let g=h.target,_=e.find(U=>U.source===g&&U.predicate==="ad4m://stateName"),E=_?le.fromUrl(_.target).get():"";y.set(g,E);let A=e.find(U=>U.source===g&&U.predicate==="ad4m://stateValue"),I=A?le.fromUrl(A.target).get():0,w=e.find(U=>U.source===g&&U.predicate==="ad4m://stateCheck"),L={predicate:"",target:""};if(w)try{let U=w.target.replace("literal://string:","");L=JSON.parse(decodeURIComponent(U))}catch{}l.addState({name:E,value:I,stateCheck:L})}let d=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of d){let g=h.target,_=e.find(R=>R.source===g&&R.predicate==="ad4m://actionName"),E=_?le.fromUrl(_.target).get():"",I=e.find(R=>R.source===g&&R.predicate==="ad4m://fromState")?.target||"",w=y.get(I)||"",U=e.find(R=>R.source===g&&R.predicate==="ad4m://toState")?.target||"",P=y.get(U)||"",G=e.find(R=>R.source===g&&R.predicate==="ad4m://transitionActions"),V=[];if(G)try{let R=G.target.replace("literal://string:","");V=JSON.parse(decodeURIComponent(R))}catch{}l.addTransition({actionName:E,fromState:w,toState:P,actions:V})}return l}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 xr(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}},oe=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)},wa,Mt,St,_t,Oi,Yt,Xt,ki,Zr,Sa,Ii,Ti,lt,mr,io,re,ne,Ci,Li,Pi,Jr,ja=class{constructor(e,t,r){wa.add(this),Mt.set(this,void 0),St.set(this,void 0),_t.set(this,void 0),Oi.set(this,void 0),Yt.set(this,void 0),Xt.set(this,void 0),ki.set(this,void 0),Zr.set(this,!1),Sa.set(this,void 0),Ii.set(this,void 0),Ti.set(this,void 0),lt.set(this,void 0),mr.set(this,void 0),this.isSurrealDB=!1,oe(this,Mt,e,"f"),oe(this,mr,t,"f"),oe(this,_t,r,"f"),oe(this,Oi,new Set,"f"),oe(this,ki,null,"f"),oe(this,Sa,new Promise((n,a)=>{oe(this,Ii,n,"f"),oe(this,Ti,a,"f")}),"f")}async subscribe(){x(this,Xt,"f")&&(x(this,Xt,"f").call(this),oe(this,Xt,void 0,"f")),x(this,lt,"f")&&(clearTimeout(x(this,lt,"f")),oe(this,lt,void 0,"f")),x(this,Yt,"f")&&(clearTimeout(x(this,Yt,"f")),oe(this,Yt,void 0,"f"));try{let t;this.isSurrealDB?t=await x(this,_t,"f").perspectiveSubscribeSurrealQuery(x(this,Mt,"f"),x(this,mr,"f")):t=await x(this,_t,"f").subscribeQuery(x(this,Mt,"f"),x(this,mr,"f")),oe(this,St,t.subscriptionId,"f"),t.result?(oe(this,ki,t.result,"f"),x(this,wa,"m",io).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),oe(this,lt,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"),oe(this,Xt,x(this,_t,"f").subscribeToQueryUpdates(x(this,St,"f"),r=>{x(this,lt,"f")&&(clearTimeout(x(this,lt,"f")),oe(this,lt,void 0,"f")),x(this,Ii,"f")&&(x(this,Ii,"f").call(this,!0),oe(this,Ii,void 0,"f"),oe(this,Ti,void 0,"f")),!(r.isInit&&x(this,ki,"f"))&&(oe(this,ki,r,"f"),x(this,wa,"m",io).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),x(this,Ti,"f")&&(x(this,Ti,"f").call(this,t),oe(this,Ii,void 0,"f"),oe(this,Ti,void 0,"f")),t}let e=async()=>{if(!x(this,Zr,"f")){try{this.isSurrealDB?await x(this,_t,"f").perspectiveKeepAliveSurrealQuery(x(this,Mt,"f"),x(this,St,"f")):await x(this,_t,"f").keepAliveQuery(x(this,Mt,"f"),x(this,St,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",x(this,mr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}x(this,Zr,"f")||oe(this,Yt,setTimeout(e,3e4),"f")}};oe(this,Yt,setTimeout(e,3e4),"f")}get id(){return x(this,St,"f")}get initialized(){return x(this,Sa,"f")}get result(){return x(this,ki,"f")}onResult(e){return x(this,Oi,"f").add(e),()=>x(this,Oi,"f").delete(e)}dispose(){oe(this,Zr,!0,"f"),clearTimeout(x(this,Yt,"f")),x(this,Xt,"f")&&x(this,Xt,"f").call(this),x(this,Oi,"f").clear(),x(this,lt,"f")&&(clearTimeout(x(this,lt,"f")),oe(this,lt,void 0,"f")),x(this,St,"f")&&(this.isSurrealDB?x(this,_t,"f").perspectiveDisposeSurrealQuerySubscription(x(this,Mt,"f"),x(this,St,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):x(this,_t,"f").disposeQuerySubscription(x(this,Mt,"f"),x(this,St,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Mt=new WeakMap,St=new WeakMap,_t=new WeakMap,Oi=new WeakMap,Yt=new WeakMap,Xt=new WeakMap,ki=new WeakMap,Zr=new WeakMap,Sa=new WeakMap,Ii=new WeakMap,Ti=new WeakMap,lt=new WeakMap,mr=new WeakMap,wa=new WeakSet,io=function i(e){for(let t of x(this,Oi,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var vr=class{constructor(e,t){re.set(this,void 0),ne.set(this,void 0),Ci.set(this,void 0),Li.set(this,void 0),Pi.set(this,void 0),Jr.set(this,void 0),oe(this,Ci,[],"f"),oe(this,Li,[],"f"),oe(this,Pi,[],"f"),oe(this,Jr,[],"f"),oe(this,re,e,"f"),oe(this,ne,t,"f"),this.uuid=x(this,re,"f").uuid,this.name=x(this,re,"f").name,this.owners=x(this,re,"f").owners,this.sharedUrl=x(this,re,"f").sharedUrl,this.neighbourhood=x(this,re,"f").neighbourhood,this.state=x(this,re,"f").state,x(this,ne,"f").addPerspectiveLinkAddedListener(x(this,re,"f").uuid,x(this,Ci,"f")),x(this,ne,"f").addPerspectiveLinkRemovedListener(x(this,re,"f").uuid,x(this,Li,"f")),x(this,ne,"f").addPerspectiveLinkUpdatedListener(x(this,re,"f").uuid,x(this,Pi,"f")),x(this,ne,"f").addPerspectiveSyncStateChangeListener(x(this,re,"f").uuid,x(this,Jr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await x(this,ne,"f").executeCommands(x(this,re,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await x(this,ne,"f").queryLinks(x(this,re,"f").uuid,e)}async infer(e){return await x(this,ne,"f").queryProlog(x(this,re,"f").uuid,e)}async querySurrealDB(e){return await x(this,ne,"f").querySurrealDB(x(this,re,"f").uuid,e)}async add(e,t="shared",r){return await x(this,ne,"f").addLink(x(this,re,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await x(this,ne,"f").addLinks(x(this,re,"f").uuid,e,t,r)}async removeLinks(e,t){return await x(this,ne,"f").removeLinks(x(this,re,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await x(this,ne,"f").linkMutations(x(this,re,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await x(this,ne,"f").addLinkExpression(x(this,re,"f").uuid,e,t,r)}async update(e,t,r){return await x(this,ne,"f").updateLink(x(this,re,"f").uuid,e,t,r)}async remove(e,t){return await x(this,ne,"f").removeLink(x(this,re,"f").uuid,e,t)}async createBatch(){return await x(this,ne,"f").createBatch(x(this,re,"f").uuid)}async commitBatch(e){return await x(this,ne,"f").commitBatch(x(this,re,"f").uuid,e)}async getExpression(e){return await x(this,ne,"f").getExpression(e)}async createExpression(e,t){return await x(this,ne,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?x(this,Ci,"f").push(t):e==="link-removed"?x(this,Li,"f").push(t):e==="link-updated"&&x(this,Pi,"f").push(t)}async addSyncStateChangeListener(e){x(this,Jr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=x(this,Ci,"f").indexOf(t);x(this,Ci,"f").splice(r,1)}else if(e==="link-removed"){let r=x(this,Li,"f").indexOf(t);x(this,Li,"f").splice(r,1)}else if(e==="link-updated"){let r=x(this,Pi,"f").indexOf(t);x(this,Pi,"f").splice(r,1)}}async snapshot(){return x(this,ne,"f").snapshotByUUID(x(this,re,"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 ae({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 ae({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return le.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 ae({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 ae({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 ae({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 ae({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 ae({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new ae({source:s,predicate:"ad4m://sdna"}));for(let l of o){let c=le.fromUrl(l.data.target).get();typeof c=="string"&&t.push(c)}}}return t}async getSdnaForClass(e){let t=le.from(e);if((await this.get(new ae({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new ae({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=le.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return x(this,ne,"f").addSdna(x(this,re,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=le.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Xe({source:s.source,predicate:s.predicate,target:s.target})),new Xe({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Xe({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=le.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new ae({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;ee(n);let a=await this.get(new ae({source:n,predicate:"sh://property"})),l=`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=>`'${ee(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return ni.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new ae({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=le.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=le.from(e).toUrl(),a=[...r.map(s=>new Xe({source:s.source,predicate:s.predicate,target:s.target})),new Xe({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Xe({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=le.from(e).toUrl(),r=await this.get(new ae({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=ee(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=ee(s),l=`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(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return xr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new ae({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,ne,"f").createSubject(x(this,re,"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,ne,"f").createSubject(x(this,re,"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,ne,"f").getSubjectData(x(this,re,"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,ne,"f").getSubjectData(x(this,re,"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 ae({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let l=s.data.target.slice(o.length),c=l;try{c=decodeURIComponent(l)}catch{}try{return JSON.parse(c)}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 = '${ee(e)}'`,l=(await this.querySurrealDB(s))[0]?.count??0;return(typeof l=="object"&&l?.Int!==void 0?l.Int:l)>0}for(let a of n.requiredTriples){let s=ee(e),o=ee(a.predicate),l;if(a.target){let y=ee(a.target);l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${y}'`}else l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let c=await this.querySurrealDB(l);if(!c||c.length===0)return!1;let u=c[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 yn(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 l of t.properties){if(!l.path||!l.name)continue;l.writable&&o.add(l.path),l.adder&&l.adder.length>0?s.set(l.name,{predicate:l.path}):a.set(l.name,{predicate:l.path,resolveLanguage:l.resolveLanguage})}if(t.constructor_actions){for(let l of t.constructor_actions)if(l.predicate){r.push(l.predicate);let c=o.has(l.predicate);l.target&&l.target!=="value"&&!c?n.push({predicate:l.predicate,target:l.target}):n.push({predicate:l.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=ee(r.predicate);if(r.target){let a=ee(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=ee(e),o=ee(a.predicate),l=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(l);if(!c||c.length===0)return;let u=c[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 getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=ee(e),o=ee(a.predicate),l=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(l);if(!c||c.length===0)return[];let u=c.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let y of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let h=await this.querySurrealDB(`RETURN ${d}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&m.push(y)}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(l=>`'${ee(l)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(l=>l.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${ee(u)}'`).join(", "),o=ee(a.predicate),l;if(a.target){let u=ee(a.target);l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let c=await this.querySurrealDB(l);r.push(new Set(c.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),l=await this.querySurrealDB(o);for(let c of l||[])try{let u;r?(u=new e(this,c.base),await u.get()):(u=new yn(this,c.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 l of o||[])try{let c=new yn(this,l.base,n);await c.init(),r.push(c)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Vi(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(m=>!Array.isArray(e[m]));let o=a?Object.fromEntries(Object.entries(Et(a)).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(m=>m!=="isSubjectInstance"):r=Object.keys(e).filter(m=>Array.isArray(e[m])&&m!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let l=`SELECT
486
524
  in.uri AS shape_source,
487
525
  predicate,
488
526
  out.uri AS target
489
527
  FROM link
490
- WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,c=await this.querySurrealDB(l);if(!c||c.length===0)return null;let u=new Map;for(let m of c)if(m.predicate==="rdf://type"&&m.target==="ad4m://SubjectClass"){let y=m.shape_source,d=y.indexOf("://");if(d<0)continue;let p=y.substring(d+3).split("/").pop();if(!p)continue;u.set(p,{shapeUri:y,properties:[],relations:[]})}for(let m of c)if(m.predicate==="sh://property"||m.predicate==="sh://collection"){for(let[y,d]of u)if(m.shape_source.endsWith(`${y}Shape`)){let p=m.target.lastIndexOf(".");if(p<0)continue;let f=m.target.substring(p+1);m.predicate==="sh://property"?d.properties.push(f):d.relations.push(f)}}for(let[m,y]of u){let d=t.every(f=>y.properties.includes(f)),p=r.every(f=>y.relations.includes(f));if(d&&p)return m}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 _(this,ie,"f").getNeighbourhoodProxy(_(this,ee,"f").uuid)}get ai(){return _(this,ie,"f").aiClient}async subscribeInfer(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ee=new WeakMap,ie=new WeakMap,_i=new WeakMap,Ei=new WeakMap,xi=new WeakMap,zr=new WeakMap;var qt=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)},G,Wr,Kr,Qr,ha,Gr,ga,ma,De=`
528
+ WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,c=await this.querySurrealDB(l);if(!c||c.length===0)return null;let u=new Map;for(let m of c)if(m.predicate==="rdf://type"&&m.target==="ad4m://SubjectClass"){let y=m.shape_source,d=y.indexOf("://");if(d<0)continue;let h=y.substring(d+3).split("/").pop();if(!h)continue;u.set(h,{shapeUri:y,properties:[],relations:[]})}for(let m of c)if(m.predicate==="sh://property"||m.predicate==="sh://collection"){for(let[y,d]of u)if(m.shape_source.endsWith(`${y}Shape`)){let h=m.target.lastIndexOf(".");if(h<0)continue;let g=m.target.substring(h+1);m.predicate==="sh://property"?d.properties.push(g):d.relations.push(g)}}for(let[m,y]of u){let d=t.every(g=>y.properties.includes(g)),h=r.every(g=>y.relations.includes(g));if(d&&h)return m}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,ne,"f").getNeighbourhoodProxy(x(this,re,"f").uuid)}get ai(){return x(this,ne,"f").aiClient}async subscribeInfer(e){let t=new ja(this.uuid,e,x(this,ne,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new ja(this.uuid,e,x(this,ne,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};re=new WeakMap,ne=new WeakMap,Ci=new WeakMap,Li=new WeakMap,Pi=new WeakMap,Jr=new WeakMap;var Gt=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},H=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)},J,Yr,Xr,en,_a,tn,xa,Ea,Me=`
491
529
  author
492
530
  timestamp
493
531
  status
494
532
  data { source, predicate, target }
495
533
  proof { valid, invalid, signature, key }
496
- `,ar=`
534
+ `,ur=`
497
535
  uuid
498
536
  name
499
537
  sharedUrl
@@ -514,139 +552,139 @@ neighbourhood {
514
552
  }
515
553
  author
516
554
  }
517
- `,Ra=class{constructor(e,t=!0){G.set(this,void 0),Wr.set(this,void 0),Kr.set(this,void 0),Qr.set(this,void 0),ha.set(this,void 0),Gr.set(this,void 0),ga.set(this,void 0),ma.set(this,void 0),qt(this,G,e,"f"),qt(this,Wr,[],"f"),qt(this,Kr,[],"f"),qt(this,Qr,[],"f"),qt(this,ha,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){qt(this,Gr,e,"f")}setNeighbourhoodClient(e){qt(this,ga,e,"f")}setAIClient(e){qt(this,ma,e,"f")}get aiClient(){return M(this,ma,"f")}async all(){let{perspectives:e}=w(await M(this,G,"f").query({query:v`query perspectives {
555
+ `,Ba=class{constructor(e,t=!0){J.set(this,void 0),Yr.set(this,void 0),Xr.set(this,void 0),en.set(this,void 0),_a.set(this,void 0),tn.set(this,void 0),xa.set(this,void 0),Ea.set(this,void 0),Gt(this,J,e,"f"),Gt(this,Yr,[],"f"),Gt(this,Xr,[],"f"),Gt(this,en,[],"f"),Gt(this,_a,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Gt(this,tn,e,"f")}setNeighbourhoodClient(e){Gt(this,xa,e,"f")}setAIClient(e){Gt(this,Ea,e,"f")}get aiClient(){return H(this,Ea,"f")}async all(){let{perspectives:e}=b(await H(this,J,"f").query({query:v`query perspectives {
518
556
  perspectives {
519
- ${ar}
557
+ ${ur}
520
558
  }
521
- }`}));return e.map(t=>new fr(t,this))}async byUUID(e){let{perspective:t}=w(await M(this,G,"f").query({query:v`query perspective($uuid: String!) {
559
+ }`}));return e.map(t=>new vr(t,this))}async byUUID(e){let{perspective:t}=b(await H(this,J,"f").query({query:v`query perspective($uuid: String!) {
522
560
  perspective(uuid: $uuid) {
523
- ${ar}
561
+ ${ur}
524
562
  }
525
- }`,variables:{uuid:e}}));return t?new fr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=w(await M(this,G,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
563
+ }`,variables:{uuid:e}}));return t?new vr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=b(await H(this,J,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
526
564
  perspectiveSnapshot(uuid: $uuid) {
527
- links { ${De} }
565
+ links { ${Me} }
528
566
  }
529
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
567
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
530
568
  perspectivePublishSnapshot(uuid: $uuid)
531
- }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
569
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=b(await H(this,J,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
532
570
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
533
- ${De}
571
+ ${Me}
534
572
  }
535
- }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
573
+ }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=b(await H(this,J,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
536
574
  perspectiveQueryProlog(uuid: $uuid, query: $query)
537
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=w(await M(this,G,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
575
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=b(await H(this,J,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
538
576
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
539
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
577
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
540
578
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
541
579
  subscriptionId
542
580
  result
543
581
  }
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(l){console.error("Error parsing perspectiveSubscribeQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
582
+ }`,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(l){console.error("Error parsing perspectiveSubscribeQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
545
583
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
546
584
  subscriptionId
547
585
  result
548
586
  }
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(l){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
587
+ }`,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(l){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
550
588
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
551
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
589
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
552
590
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
553
- }`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=M(this,G,"f").subscribe({query:v`
591
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=H(this,J,"f").subscribe({query:v`
554
592
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
555
593
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
556
594
  }
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}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
595
+ `,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 H(this,J,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
558
596
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
559
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
597
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
560
598
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
561
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
599
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
562
600
  perspectiveAdd(name: $name) {
563
- ${ar}
601
+ ${ur}
564
602
  }
565
- }`,variables:{name:e}}));return new fr(t,this)}async update(e,t){let{perspectiveUpdate:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
603
+ }`,variables:{name:e}}));return new vr(t,this)}async update(e,t){let{perspectiveUpdate:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
566
604
  perspectiveUpdate(uuid: $uuid, name: $name) {
567
- ${ar}
605
+ ${ur}
568
606
  }
569
- }`,variables:{uuid:e,name:t}}));return new fr(r,this)}async remove(e){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
607
+ }`,variables:{uuid:e,name:t}}));return new vr(r,this)}async remove(e){return b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
570
608
  perspectiveRemove(uuid: $uuid)
571
- }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
609
+ }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
572
610
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
573
- ${De}
611
+ ${Me}
574
612
  }
575
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
613
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
576
614
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
577
- ${De}
615
+ ${Me}
578
616
  }
579
- }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
617
+ }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
580
618
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
581
- ${De}
619
+ ${Me}
582
620
  }
583
- }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
621
+ }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
584
622
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
585
623
  additions {
586
- ${De}
624
+ ${Me}
587
625
  }
588
626
  removals {
589
- ${De}
627
+ ${Me}
590
628
  }
591
629
  }
592
- }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
630
+ }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
593
631
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
594
- ${De}
632
+ ${Me}
595
633
  }
596
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
634
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
597
635
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
598
- ${De}
636
+ ${Me}
599
637
  }
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}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
638
+ }`,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 H(this,J,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
601
639
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
602
- }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
640
+ }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
603
641
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
604
- }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
642
+ }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
605
643
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
606
- }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
644
+ }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
607
645
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
608
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
646
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
609
647
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
610
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,Gr,"f").get(e)}async createExpression(e,t){return await M(this,Gr,"f").create(e,t)}addPerspectiveAddedListener(e){M(this,Wr,"f").push(e)}subscribePerspectiveAdded(){M(this,G,"f").subscribe({query:v` subscription {
611
- perspectiveAdded { ${ar} }
648
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await H(this,tn,"f").get(e)}async createExpression(e,t){return await H(this,tn,"f").create(e,t)}addPerspectiveAddedListener(e){H(this,Yr,"f").push(e)}subscribePerspectiveAdded(){H(this,J,"f").subscribe({query:v` subscription {
649
+ perspectiveAdded { ${ur} }
612
650
  }
613
- `}).subscribe({next:e=>{M(this,Wr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){M(this,Kr,"f").push(e)}subscribePerspectiveUpdated(){M(this,G,"f").subscribe({query:v` subscription {
614
- perspectiveUpdated { ${ar} }
651
+ `}).subscribe({next:e=>{H(this,Yr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){H(this,Xr,"f").push(e)}subscribePerspectiveUpdated(){H(this,J,"f").subscribe({query:v` subscription {
652
+ perspectiveUpdated { ${ur} }
615
653
  }
616
- `}).subscribe({next:e=>{M(this,Kr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){M(this,ha,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
654
+ `}).subscribe({next:e=>{H(this,Xr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){H(this,_a,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){H(this,J,"f").subscribe({query:v` subscription {
617
655
  perspectiveSyncStateChange(uuid: "${e}")
618
656
  }
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,Qr,"f").push(e)}subscribePerspectiveRemoved(){M(this,G,"f").subscribe({query:v` subscription {
657
+ `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){H(this,en,"f").push(e)}subscribePerspectiveRemoved(){H(this,J,"f").subscribe({query:v` subscription {
620
658
  perspectiveRemoved
621
659
  }
622
- `}).subscribe({next:e=>{M(this,Qr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
623
- perspectiveLinkAdded(uuid: "${e}") { ${De} }
660
+ `}).subscribe({next:e=>{H(this,en,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){H(this,J,"f").subscribe({query:v` subscription {
661
+ perspectiveLinkAdded(uuid: "${e}") { ${Me} }
624
662
  }
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,G,"f").subscribe({query:v` subscription {
626
- perspectiveLinkRemoved(uuid: "${e}") { ${De} }
663
+ `}).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){H(this,J,"f").subscribe({query:v` subscription {
664
+ perspectiveLinkRemoved(uuid: "${e}") { ${Me} }
627
665
  }
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,G,"f").subscribe({query:v` subscription {
666
+ `}).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){H(this,J,"f").subscribe({query:v` subscription {
629
667
  perspectiveLinkUpdated(uuid: "${e}") {
630
668
  oldLink {
631
- ${De}
669
+ ${Me}
632
670
  }
633
671
  newLink {
634
- ${De}
672
+ ${Me}
635
673
  }
636
674
  }
637
675
  }
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 zs(M(this,ga,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
676
+ `}).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 to(H(this,xa,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
639
677
  perspectiveCreateBatch(uuid: $uuid)
640
- }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
678
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=b(await H(this,J,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
641
679
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
642
680
  additions {
643
- ${De}
681
+ ${Me}
644
682
  }
645
683
  removals {
646
- ${De}
684
+ ${Me}
647
685
  }
648
686
  }
649
- }`,variables:{uuid:e,batchId:t}}));return r}};G=new WeakMap,Wr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,ha=new WeakMap,Gr=new WeakMap,ga=new WeakMap,ma=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},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)},J,Zr,Jr,Yr,jr=`
687
+ }`,variables:{uuid:e,batchId:t}}));return r}};J=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,en=new WeakMap,_a=new WeakMap,tn=new WeakMap,xa=new WeakMap,Ea=new WeakMap;var Vr=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},Q=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,rn,nn,an,sn,Wr=`
650
688
  did
651
689
  directMessageLanguage
652
690
  perspective {
@@ -660,7 +698,7 @@ neighbourhood {
660
698
  }
661
699
  }
662
700
  }
663
- `,Gn=`
701
+ `,ra=`
664
702
  requestId
665
703
  revoked
666
704
  auth {
@@ -676,158 +714,166 @@ neighbourhood {
676
714
  can
677
715
  }
678
716
  }
679
- `,sr=`
717
+ `,dr=`
680
718
  isInitialized
681
719
  isUnlocked
682
720
  did
683
721
  didDocument
684
722
  error
685
- `,Zn=`
723
+ `,na=`
686
724
  did
687
725
  didSigningKeyId
688
726
  deviceKeyType
689
727
  deviceKey
690
728
  deviceKeySignedByDid
691
729
  didSignedByDeviceKey
692
- `,zd=`
730
+ `,hp=`
693
731
  signature
694
732
  publicKey
695
- `,vn=class{constructor(e,t=!0){J.set(this,void 0),Zr.set(this,void 0),Jr.set(this,void 0),Yr.set(this,void 0),Qn(this,J,e,"f"),Qn(this,Jr,[],"f"),Qn(this,Yr,[],"f"),Qn(this,Zr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=w(await Z(this,J,"f").query({query:v`query agent { agent { ${jr} } }`})),t=new Zt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=w(await Z(this,J,"f").query({query:v`query agentStatus {
733
+ `,$n=class{constructor(e,t=!0){X.set(this,void 0),rn.set(this,void 0),nn.set(this,void 0),an.set(this,void 0),sn.set(this,void 0),Vr(this,X,e,"f"),Vr(this,nn,[],"f"),Vr(this,an,[],"f"),Vr(this,rn,[],"f"),Vr(this,sn,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=b(await Q(this,X,"f").query({query:v`query agent { agent { ${Wr} } }`})),t=new ri(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=b(await Q(this,X,"f").query({query:v`query agentStatus {
696
734
  agentStatus {
697
- ${sr}
735
+ ${dr}
698
736
  }
699
- }`}));return new ot(e)}async generate(e){let{agentGenerate:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentGenerate(
737
+ }`}));return new dt(e)}async generate(e){let{agentGenerate:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentGenerate(
700
738
  $passphrase: String!
701
739
  ) {
702
740
  agentGenerate(passphrase: $passphrase) {
703
- ${sr}
741
+ ${dr}
704
742
  }
705
- }`,variables:{passphrase:e}}));return new ot(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentImport(
743
+ }`,variables:{passphrase:e}}));return new dt(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentImport(
706
744
  $did: String!,
707
745
  $didDocument: String!,
708
746
  $keystore: String!,
709
747
  $passphrase: String!
710
748
  ) {
711
749
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
712
- ${sr}
750
+ ${dr}
713
751
  }
714
- }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new ot(s)}async lock(e){let{agentLock:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
752
+ }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new dt(s)}async lock(e){let{agentLock:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
715
753
  agentLock(passphrase: $passphrase) {
716
- ${sr}
754
+ ${dr}
717
755
  }
718
- }`,variables:{passphrase:e}}));return new ot(t)}async unlock(e,t=!0){let{agentUnlock:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
756
+ }`,variables:{passphrase:e}}));return new dt(t)}async unlock(e,t=!0){let{agentUnlock:r}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
719
757
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
720
- ${sr}
758
+ ${dr}
721
759
  }
722
- }`,variables:{passphrase:e,holochain:t}}));return new ot(r)}async byDID(e){let{agentByDID:t}=w(await Z(this,J,"f").query({query:v`query agentByDID($did: String!) {
760
+ }`,variables:{passphrase:e,holochain:t}}));return new dt(r)}async byDID(e){let{agentByDID:t}=b(await Q(this,X,"f").query({query:v`query agentByDID($did: String!) {
723
761
  agentByDID(did: $did) {
724
- ${jr}
762
+ ${Wr}
725
763
  }
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}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
764
+ }`,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 Q(this,X,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
727
765
  agentUpdatePublicPerspective(perspective: $perspective) {
728
- ${jr}
766
+ ${Wr}
729
767
  }
730
- }`,variables:{perspective:t}})),n=r,a=new Zt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ra(Z(this,J,"f")),r=new vn(Z(this,J,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let l of e.additions)await n.add(l);for(let l of e.removals)await n.remove(l);let s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
768
+ }`,variables:{perspective:t}})),n=r,a=new ri(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ba(Q(this,X,"f")),r=new $n(Q(this,X,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let l of e.additions)await n.add(l);for(let l of e.removals)await n.remove(l);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 Q(this,X,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
731
769
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
732
- ${jr}
770
+ ${Wr}
733
771
  }
734
- }`,variables:{directMessageLanguage:e}})),r=t,n=new Zt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
772
+ }`,variables:{directMessageLanguage:e}})),r=t,n=new ri(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
735
773
  agentAddEntanglementProofs(proofs: $proofs) {
736
- ${Zn}
774
+ ${na}
737
775
  }
738
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
776
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
739
777
  agentDeleteEntanglementProofs(proofs: $proofs) {
740
- ${Zn}
778
+ ${na}
741
779
  }
742
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=w(await Z(this,J,"f").query({query:v`query agentGetEntanglementProofs {
780
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=b(await Q(this,X,"f").query({query:v`query agentGetEntanglementProofs {
743
781
  agentGetEntanglementProofs {
744
- ${Zn}
782
+ ${na}
745
783
  }
746
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
784
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
747
785
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
748
- ${Zn}
786
+ ${na}
749
787
  }
750
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){Z(this,Jr,"f").push(e)}addAppChangedListener(e){Z(this,Zr,"f").push(e)}subscribeAgentUpdated(){Z(this,J,"f").subscribe({query:v` subscription {
751
- agentUpdated { ${jr} }
788
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){Q(this,nn,"f").push(e)}addAppChangedListener(e){Q(this,rn,"f").push(e)}subscribeAgentUpdated(){Q(this,X,"f").subscribe({query:v` subscription {
789
+ agentUpdated { ${Wr} }
752
790
  }
753
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;Z(this,Jr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Z(this,J,"f").subscribe({query:v` subscription {
791
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;Q(this,nn,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Q(this,X,"f").subscribe({query:v` subscription {
754
792
  agentAppsChanged {
755
- ${Gn}
793
+ ${ra}
756
794
  }
757
795
  }
758
- `}).subscribe({next:e=>{Z(this,Zr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Z(this,Yr,"f").push(e)}subscribeAgentStatusChanged(){Z(this,J,"f").subscribe({query:v` subscription {
759
- agentStatusChanged { ${sr} }
796
+ `}).subscribe({next:e=>{Q(this,rn,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Q(this,an,"f").push(e)}subscribeAgentStatusChanged(){Q(this,X,"f").subscribe({query:v` subscription {
797
+ agentStatusChanged { ${dr} }
760
798
  }
761
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Z(this,Yr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
799
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Q(this,an,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}addHostingUserInfoChangedListener(e){Q(this,sn,"f").push(e)}subscribeHostingUserInfoChanged(){Q(this,X,"f").subscribe({query:v`subscription {
800
+ runtimeHostingUserInfoChanged {
801
+ email
802
+ remainingCredits
803
+ hotWalletAddress
804
+ freeAccess
805
+ }
806
+ }`}).subscribe({next:e=>{let t=e.data.runtimeHostingUserInfoChanged;Q(this,sn,"f").forEach(r=>r(t))},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=b(await Q(this,X,"f").mutate({mutation:v`
762
807
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
763
808
  agentRequestCapability(authInfo: $authInfo)
764
809
  }
765
- `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
810
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=b(await Q(this,X,"f").mutate({mutation:v`
766
811
  mutation agentPermitCapability($auth: String!) {
767
812
  agentPermitCapability(auth: $auth)
768
813
  }
769
- `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=w(await Z(this,J,"f").mutate({mutation:v`
814
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=b(await Q(this,X,"f").mutate({mutation:v`
770
815
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
771
816
  agentGenerateJwt(requestId: $requestId, rand: $rand)
772
817
  }
773
- `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=w(await Z(this,J,"f").mutate({mutation:v`query agentGetApps {
818
+ `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=b(await Q(this,X,"f").mutate({mutation:v`query agentGetApps {
774
819
  agentGetApps {
775
- ${Gn}
820
+ ${ra}
776
821
  }
777
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
822
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
778
823
  agentRemoveApp(requestId: $requestId) {
779
- ${Gn}
824
+ ${ra}
780
825
  }
781
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
826
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
782
827
  agentRevokeToken(requestId: $requestId) {
783
- ${Gn}
828
+ ${ra}
784
829
  }
785
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=w(await Z(this,J,"f").mutate({mutation:v`
830
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=b(await Q(this,X,"f").mutate({mutation:v`
786
831
  query agentIsLocked {
787
832
  agentIsLocked
788
833
  }
789
- `}));return e}async signMessage(e){let{agentSignMessage:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
834
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
790
835
  agentSignMessage(message: $message) {
791
- ${zd}
836
+ ${hp}
792
837
  }
793
- }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
838
+ }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
794
839
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
795
840
  did
796
841
  success
797
842
  error
798
843
  }
799
- }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
844
+ }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
800
845
  runtimeLoginUser(email: $email, password: $password)
801
- }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
846
+ }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
802
847
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
803
848
  success
804
849
  message
805
850
  requiresPassword
806
851
  isExistingUser
807
852
  }
808
- }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
853
+ }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
809
854
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
810
- }`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=w(await Z(this,J,"f").query({query:v`query runtimeHostingUserInfo {
855
+ }`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=b(await Q(this,X,"f").query({query:v`query runtimeHostingUserInfo {
811
856
  runtimeHostingUserInfo {
812
857
  email
813
858
  remainingCredits
814
859
  hotWalletAddress
860
+ freeAccess
815
861
  }
816
- }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
862
+ }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
817
863
  runtimeSetHotWalletAddress(address: $address)
818
- }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestPayment($amountHOT: String!) {
864
+ }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeRequestPayment($amountHOT: String!) {
819
865
  runtimeRequestPayment(amountHOT: $amountHOT) {
820
866
  success
821
867
  message
822
868
  }
823
- }`,variables:{amountHOT:e}}));return t}};J=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap;var Wd=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},Ht=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,cc=`
869
+ }`,variables:{amountHOT:e}}));return t}};X=new WeakMap,rn=new WeakMap,nn=new WeakMap,an=new WeakMap,sn=new WeakMap;var fp=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},Zt=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,$c=`
824
870
  name
825
871
  address
826
872
  settings
827
873
  icon { code }
828
874
  constructorIcon { code }
829
875
  settingsIcon { code }
830
- `,lc=`
876
+ `,Ac=`
831
877
  name
832
878
  address
833
879
  description
@@ -837,45 +883,45 @@ neighbourhood {
837
883
  templateAppliedParams
838
884
  possibleTemplateParams
839
885
  sourceCodeLink
840
- `,Ks=class{constructor(e){pt.set(this,void 0),Wd(this,pt,e,"f")}async byAddress(e){let{language:t}=w(await Ht(this,pt,"f").query({query:v`query byAddress($address: String!) {
886
+ `,ro=class{constructor(e){vt.set(this,void 0),fp(this,vt,e,"f")}async byAddress(e){let{language:t}=b(await Zt(this,vt,"f").query({query:v`query byAddress($address: String!) {
841
887
  language(address: $address) {
842
- ${cc}
888
+ ${$c}
843
889
  }
844
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=w(await Ht(this,pt,"f").query({query:v`query byFilter($filter: String!) {
890
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=b(await Zt(this,vt,"f").query({query:v`query byFilter($filter: String!) {
845
891
  languages(filter: $filter) {
846
- ${cc}
892
+ ${$c}
847
893
  }
848
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
894
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=b(await Zt(this,vt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
849
895
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
850
- }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
896
+ }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=b(await Zt(this,vt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
851
897
  $sourceLanguageHash: String!,
852
898
  $templateData: String!,
853
899
  ) {
854
900
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
855
901
  name, address
856
902
  }
857
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languagePublish(
903
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=b(await Zt(this,vt,"f").mutate({mutation:v`mutation languagePublish(
858
904
  $languagePath: String!,
859
905
  $languageMeta: LanguageMetaInput!,
860
906
  ) {
861
907
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
862
- ${lc}
908
+ ${Ac}
863
909
  }
864
- }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=w(await Ht(this,pt,"f").query({query:v`query languageMeta(
910
+ }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=b(await Zt(this,vt,"f").query({query:v`query languageMeta(
865
911
  $address: String!,
866
912
  ) {
867
913
  languageMeta(address: $address) {
868
- ${lc}
914
+ ${Ac}
869
915
  }
870
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=w(await Ht(this,pt,"f").query({query:v`query languageSource(
916
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=b(await Zt(this,vt,"f").query({query:v`query languageSource(
871
917
  $address: String!,
872
918
  ) {
873
919
  languageSource(address: $address)
874
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageRemove(
920
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=b(await Zt(this,vt,"f").mutate({mutation:v`mutation languageRemove(
875
921
  $address: String!,
876
922
  ) {
877
923
  languageRemove(address: $address)
878
- }`,variables:{address:e}}));return t}};pt=new WeakMap;var Kd=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},Ne=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)},Fe,pr,Qs=class{constructor(e){Fe.set(this,void 0),pr.set(this,new Map),Kd(this,Fe,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
924
+ }`,variables:{address:e}}));return t}};vt=new WeakMap;var gp=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},Oe=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,yr,no=class{constructor(e){Be.set(this,void 0),yr.set(this,new Map),gp(this,Be,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
879
925
  $linkLanguage: String!,
880
926
  $meta: PerspectiveInput!,
881
927
  $perspectiveUUID: String!
@@ -885,7 +931,7 @@ neighbourhood {
885
931
  meta: $meta,
886
932
  perspectiveUUID: $perspectiveUUID
887
933
  )
888
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
934
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
889
935
  neighbourhoodJoinFromUrl(url: $url) {
890
936
  uuid
891
937
  name
@@ -907,11 +953,11 @@ neighbourhood {
907
953
  author
908
954
  }
909
955
  }
910
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
956
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
911
957
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
912
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
958
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
913
959
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
914
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
960
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
915
961
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
916
962
  did
917
963
  status {
@@ -928,7 +974,7 @@ neighbourhood {
928
974
  proof { valid, invalid, signature, key }
929
975
  }
930
976
  }
931
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
977
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
932
978
  $perspectiveUUID: String!,
933
979
  $status: PerspectiveInput!
934
980
  ) {
@@ -936,7 +982,7 @@ neighbourhood {
936
982
  perspectiveUUID: $perspectiveUUID,
937
983
  status: $status
938
984
  )
939
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
985
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
940
986
  $perspectiveUUID: String!,
941
987
  $status: PerspectiveUnsignedInput!
942
988
  ) {
@@ -944,7 +990,7 @@ neighbourhood {
944
990
  perspectiveUUID: $perspectiveUUID,
945
991
  status: $status
946
992
  )
947
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
993
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
948
994
  $perspectiveUUID: String!,
949
995
  $remoteAgentDid: String!,
950
996
  $payload: PerspectiveInput!
@@ -954,7 +1000,7 @@ neighbourhood {
954
1000
  remoteAgentDid: $remoteAgentDid,
955
1001
  payload: $payload
956
1002
  )
957
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
1003
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
958
1004
  $perspectiveUUID: String!,
959
1005
  $remoteAgentDid: String!,
960
1006
  $payload: PerspectiveUnsignedInput!
@@ -964,7 +1010,7 @@ neighbourhood {
964
1010
  remoteAgentDid: $remoteAgentDid,
965
1011
  payload: $payload
966
1012
  )
967
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
1013
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
968
1014
  $perspectiveUUID: String!,
969
1015
  $payload: PerspectiveInput!,
970
1016
  $loopback: Boolean
@@ -974,7 +1020,7 @@ neighbourhood {
974
1020
  payload: $payload,
975
1021
  loopback: $loopback
976
1022
  )
977
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
1023
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
978
1024
  $perspectiveUUID: String!,
979
1025
  $payload: PerspectiveUnsignedInput!,
980
1026
  $loopback: Boolean
@@ -984,7 +1030,7 @@ neighbourhood {
984
1030
  payload: $payload,
985
1031
  loopback: $loopback
986
1032
  )
987
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Ne(this,pr,"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;Ne(this,Fe,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
1033
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Oe(this,yr,"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;Oe(this,Be,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
988
1034
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
989
1035
  author
990
1036
  timestamp
@@ -999,7 +1045,7 @@ neighbourhood {
999
1045
  }
1000
1046
  proof { valid, invalid, signature, key }
1001
1047
  }
1002
- }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=w(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=Ne(this,pr,"f").get(e);r?r.push(t):(r=[],Ne(this,pr,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Ne(this,pr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Fe=new WeakMap,pr=new WeakMap;var Jn=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)},z,Xr,en,tn,Ol,Yn=`
1048
+ }`,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=Oe(this,yr,"f").get(e);r?r.push(t):(r=[],Oe(this,yr,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Oe(this,yr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Be=new WeakMap,yr=new WeakMap;var aa=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},N=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)},D,on,cn,ln,Yl,sa=`
1003
1049
  author
1004
1050
  timestamp
1005
1051
  data {
@@ -1011,7 +1057,7 @@ data {
1011
1057
  }
1012
1058
  }
1013
1059
  proof { valid, invalid, signature, key }
1014
- `,Qd=`
1060
+ `,mp=`
1015
1061
  description
1016
1062
  appName
1017
1063
  appUrl
@@ -1020,72 +1066,74 @@ trigger
1020
1066
  perspectiveIds
1021
1067
  webhookUrl
1022
1068
  webhookAuth
1023
- `,Dl=`
1069
+ `,Xl=`
1024
1070
  id
1025
1071
  granted
1026
- ${Qd}
1027
- `,Gd=`
1028
- notification { ${Dl} }
1072
+ ${mp}
1073
+ `,yp=`
1074
+ notification { ${Xl} }
1029
1075
  perspectiveId
1030
1076
  triggerMatch
1031
- `,Gs=class{constructor(e,t=!0){z.set(this,void 0),Xr.set(this,void 0),en.set(this,void 0),tn.set(this,void 0),Ol.set(this,void 0),Jn(this,z,e,"f"),Jn(this,Xr,[],"f"),Jn(this,en,[],"f"),Jn(this,tn,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=w(await U(this,z,"f").query({query:v`query runtimeInfo {
1077
+ `,ao=class{constructor(e,t=!0){D.set(this,void 0),on.set(this,void 0),cn.set(this,void 0),ln.set(this,void 0),Yl.set(this,void 0),aa(this,D,e,"f"),aa(this,on,[],"f"),aa(this,cn,[],"f"),aa(this,ln,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=b(await N(this,D,"f").query({query:v`query runtimeInfo {
1032
1078
  runtimeInfo {
1033
1079
  ad4mExecutorVersion,
1034
1080
  isInitialized,
1035
1081
  isUnlocked
1036
1082
  }
1037
- }`}));return e}async quit(){return w(await U(this,z,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1083
+ }`}));return e}async tlsDomain(){let{runtimeTlsDomain:e}=b(await N(this,D,"f").query({query:v`query runtimeTlsDomain {
1084
+ runtimeTlsDomain
1085
+ }`}));return e}async quit(){return b(await N(this,D,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1038
1086
  runtimeOpenLink(url: $url)
1039
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1087
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=b(await N(this,D,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1040
1088
  addTrustedAgents(agents: $agents)
1041
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1089
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=b(await N(this,D,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1042
1090
  deleteTrustedAgents(agents: $agents)
1043
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=w(await U(this,z,"f").query({query:v`query getTrustedAgents {
1091
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=b(await N(this,D,"f").query({query:v`query getTrustedAgents {
1044
1092
  getTrustedAgents
1045
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1093
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1046
1094
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
1047
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1095
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1048
1096
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
1049
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=w(await U(this,z,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1097
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=b(await N(this,D,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1050
1098
  runtimeKnownLinkLanguageTemplates
1051
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1099
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1052
1100
  runtimeAddFriends(dids: $dids)
1053
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1101
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1054
1102
  runtimeRemoveFriends(dids: $dids)
1055
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=w(await U(this,z,"f").query({query:v`query runtimeFriends {
1103
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=b(await N(this,D,"f").query({query:v`query runtimeFriends {
1056
1104
  runtimeFriends
1057
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=w(await U(this,z,"f").query({query:v`query runtimeHcAgentInfos {
1105
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=b(await N(this,D,"f").query({query:v`query runtimeHcAgentInfos {
1058
1106
  runtimeHcAgentInfos
1059
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=w(await U(this,z,"f").query({query:v`query runtimeGetNetworkMetrics {
1107
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=b(await N(this,D,"f").query({query:v`query runtimeGetNetworkMetrics {
1060
1108
  runtimeGetNetworkMetrics
1061
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1109
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1062
1110
  runtimeRestartHolochain
1063
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1111
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1064
1112
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
1065
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=w(await U(this,z,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1113
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=b(await N(this,D,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1066
1114
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
1067
- }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1115
+ }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1068
1116
  runtimeSetStatus(status: $status)
1069
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=w(await U(this,z,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1070
- runtimeFriendStatus(did: $did) { ${Yn} }
1071
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1117
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=b(await N(this,D,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1118
+ runtimeFriendStatus(did: $did) { ${sa} }
1119
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1072
1120
  runtimeFriendSendMessage(did: $did, message: $message)
1073
- }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1074
- runtimeMessageInbox(filter: $filter) { ${Yn} }
1075
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1121
+ }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=b(await N(this,D,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1122
+ runtimeMessageInbox(filter: $filter) { ${sa} }
1123
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=b(await N(this,D,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1076
1124
  runtimeMessageOutbox(filter: $filter) {
1077
1125
  recipient,
1078
1126
  message {
1079
- ${Yn}
1127
+ ${sa}
1080
1128
  }
1081
1129
  }
1082
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1130
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1083
1131
  runtimeRequestInstallNotification(notification: $notification)
1084
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1132
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1085
1133
  runtimeGrantNotification(id: $id)
1086
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1134
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1087
1135
  runtimeExportDb(filePath: $filePath)
1088
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1136
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1089
1137
  runtimeImportDb(filePath: $filePath) {
1090
1138
  perspectives { total imported failed omitted errors }
1091
1139
  links { total imported failed omitted errors }
@@ -1099,51 +1147,76 @@ triggerMatch
1099
1147
  trustedAgents { total imported failed omitted errors }
1100
1148
  knownLinkLanguages { total imported failed omitted errors }
1101
1149
  }
1102
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=w(await U(this,z,"f").query({query:v`query runtimeNotifications {
1103
- runtimeNotifications { ${Dl} }
1104
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1150
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=b(await N(this,D,"f").query({query:v`query runtimeNotifications {
1151
+ runtimeNotifications { ${Xl} }
1152
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1105
1153
  runtimeUpdateNotification(id: $id, notification: $notification)
1106
- }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1154
+ }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1107
1155
  runtimeRemoveNotification(id: $id)
1108
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1156
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1109
1157
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
1110
- }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1158
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1111
1159
  runtimeImportPerspective(filePath: $filePath)
1112
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=w(await U(this,z,"f").query({query:v`query runtimeMultiUserEnabled {
1160
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=b(await N(this,D,"f").query({query:v`query runtimeMultiUserEnabled {
1113
1161
  runtimeMultiUserEnabled
1114
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1162
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1115
1163
  runtimeSetMultiUserEnabled(enabled: $enabled)
1116
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=w(await U(this,z,"f").query({query:v`query runtimeListUsers {
1164
+ }`,variables:{enabled:e}}));return t}async freeHostingEnabled(){let{runtimeFreeHostingEnabled:e}=b(await N(this,D,"f").query({query:v`query runtimeFreeHostingEnabled {
1165
+ runtimeFreeHostingEnabled
1166
+ }`}));return e}async setFreeHostingEnabled(e){let{runtimeSetFreeHostingEnabled:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
1167
+ runtimeSetFreeHostingEnabled(enabled: $enabled)
1168
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=b(await N(this,D,"f").query({query:v`query runtimeListUsers {
1117
1169
  runtimeListUsers {
1118
1170
  email
1119
1171
  did
1120
1172
  lastSeen
1121
1173
  perspectiveCount
1174
+ remainingCredits
1175
+ freeAccess
1176
+ hotWalletAddress
1122
1177
  }
1123
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1178
+ }`}));return e}async userWalletAddress(e){let{runtimeUserWalletAddress:t}=b(await N(this,D,"f").query({query:v`query runtimeUserWalletAddress($email: String!) {
1179
+ runtimeUserWalletAddress(email: $email)
1180
+ }`,variables:{email:e}}));return t}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1124
1181
  runtimeEmailTestModeEnable
1125
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1182
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1126
1183
  runtimeEmailTestModeDisable
1127
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1184
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1128
1185
  runtimeEmailTestGetCode(email: $email)
1129
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1186
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1130
1187
  runtimeEmailTestClearCodes
1131
- }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1188
+ }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1132
1189
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
1133
- }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){U(this,tn,"f").push(e)}subscribeNotificationTriggered(){U(this,z,"f").subscribe({query:v` subscription {
1134
- runtimeNotificationTriggered { ${Gd} }
1190
+ }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}async unytAgentKey(){let{runtimeUnytAgentKey:e}=b(await N(this,D,"f").query({query:v`query runtimeUnytAgentKey { runtimeUnytAgentKey }`,fetchPolicy:"network-only"}));return e}async unytHotAgentPubkey(){let{runtimeHotAgentPubkey:e}=b(await N(this,D,"f").query({query:v`query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,fetchPolicy:"network-only"}));return e}async unytWalletBalance(){let{runtimeHotWalletBalance:e}=b(await N(this,D,"f").query({query:v`query runtimeHotWalletBalance { runtimeHotWalletBalance }`,fetchPolicy:"network-only"}));return e}async unytWalletHistory(e,t){let{runtimeHotWalletHistory:r}=b(await N(this,D,"f").query({query:v`query runtimeHotWalletHistory($page: Int, $perPage: Int) {
1191
+ runtimeHotWalletHistory(page: $page, perPage: $perPage)
1192
+ }`,variables:{page:e,perPage:t},fetchPolicy:"network-only"}));return r}async unytVersionInfo(){let{runtimeUnytVersionInfo:e}=b(await N(this,D,"f").query({query:v`query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,fetchPolicy:"network-only"}));return e}async unytSetMembraneProof(e){let{runtimeSetUnytMembraneProof:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUnytMembraneProof($proof: String!) {
1193
+ runtimeSetUnytMembraneProof(proof: $proof) { success message }
1194
+ }`,variables:{proof:e}}));return t}async unytReinstallDna(){let{runtimeReinstallUnytDna:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeReinstallUnytDna {
1195
+ runtimeReinstallUnytDna { success message }
1196
+ }`}));return e}async unytSendHot(e,t){let{runtimeSendHot:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSendHot($recipient: String!, $amount: String!) {
1197
+ runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
1198
+ }`,variables:{recipient:e,amount:t}}));return r}async setUserCredits(e,t){let{runtimeSetUserCredits:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
1199
+ runtimeSetUserCredits(email: $email, amount: $amount)
1200
+ }`,variables:{email:e,amount:t}}));return r}async setUserFreeAccess(e,t){let{runtimeSetUserFreeAccess:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
1201
+ runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
1202
+ }`,variables:{email:e,enabled:t}}));return r}async setHostRates(e){let{runtimeSetHostRates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetHostRates($ratesJson: String!) {
1203
+ runtimeSetHostRates(ratesJson: $ratesJson)
1204
+ }`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=b(await N(this,D,"f").query({query:v`query runtimeHostRates {
1205
+ runtimeHostRates
1206
+ }`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){N(this,ln,"f").push(e)}subscribeNotificationTriggered(){N(this,D,"f").subscribe({query:v` subscription {
1207
+ runtimeNotificationTriggered { ${yp} }
1135
1208
  }
1136
- `}).subscribe({next:e=>{U(this,tn,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){U(this,Xr,"f").push(e)}subscribeMessageReceived(){U(this,z,"f").subscribe({query:v` subscription {
1137
- runtimeMessageReceived { ${Yn} }
1209
+ `}).subscribe({next:e=>{N(this,ln,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){N(this,on,"f").push(e)}subscribeMessageReceived(){N(this,D,"f").subscribe({query:v` subscription {
1210
+ runtimeMessageReceived { ${sa} }
1138
1211
  }
1139
- `}).subscribe({next:e=>{U(this,Xr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){U(this,en,"f").push(e)}subscribeExceptionOccurred(){U(this,z,"f").subscribe({query:v` subscription {
1212
+ `}).subscribe({next:e=>{N(this,on,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){N(this,cn,"f").push(e)}subscribeExceptionOccurred(){N(this,D,"f").subscribe({query:v` subscription {
1140
1213
  exceptionOccurred {
1141
1214
  title
1142
1215
  message
1143
1216
  type
1144
1217
  addon
1145
1218
  }
1146
- }`}).subscribe({next:e=>{U(this,en,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};z=new WeakMap,Xr=new WeakMap,en=new WeakMap,tn=new WeakMap,Ol=new WeakMap;var Zd=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},or=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)},Ot,Zs=class{constructor(e){Ot.set(this,void 0),Zd(this,Ot,e,"f")}async get(e,t=!1){if(!t)try{let n=oe.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}=w(await or(this,Ot,"f").query({query:v`query expression($url: String!) {
1219
+ }`}).subscribe({next:e=>{N(this,cn,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};D=new WeakMap,on=new WeakMap,cn=new WeakMap,ln=new WeakMap,Yl=new WeakMap;var vp=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},pr=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,so=class{constructor(e){Ft.set(this,void 0),vp(this,Ft,e,"f")}async get(e,t=!1){if(!t)try{let n=le.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 pr(this,Ft,"f").query({query:v`query expression($url: String!) {
1147
1220
  expression(url: $url) {
1148
1221
  author
1149
1222
  timestamp
@@ -1156,7 +1229,7 @@ triggerMatch
1156
1229
  invalid
1157
1230
  }
1158
1231
  }
1159
- }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=w(await or(this,Ot,"f").query({query:v`query expressionMany($urls: [String!]!) {
1232
+ }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=b(await pr(this,Ft,"f").query({query:v`query expressionMany($urls: [String!]!) {
1160
1233
  expressionMany(urls: $urls) {
1161
1234
  author
1162
1235
  timestamp
@@ -1169,19 +1242,19 @@ triggerMatch
1169
1242
  invalid
1170
1243
  }
1171
1244
  }
1172
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=w(await or(this,Ot,"f").query({query:v`query expressionRaw($url: String!) {
1245
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=b(await pr(this,Ft,"f").query({query:v`query expressionRaw($url: String!) {
1173
1246
  expressionRaw(url: $url)
1174
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1247
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=b(await pr(this,Ft,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1175
1248
  expressionCreate(content: $content, languageAddress: $languageAddress)
1176
- }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=w(await or(this,Ot,"f").query({query:v`query expressionInteractions($url: String!) {
1249
+ }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=b(await pr(this,Ft,"f").query({query:v`query expressionInteractions($url: String!) {
1177
1250
  expressionInteractions(url: $url) {
1178
1251
  label
1179
1252
  name
1180
1253
  parameters { name, type }
1181
1254
  }
1182
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1255
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=b(await pr(this,Ft,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1183
1256
  expressionInteract(url: $url, interactionCall: $interactionCall)
1184
- }`,variables:{url:e,interactionCall:t}}));return r}};Ot=new WeakMap;var Ga={};Ga.byteLength=Yd;Ga.toByteArray=ep;Ga.fromByteArray=rp;var St=[],st=[],Jd=typeof Uint8Array<"u"?Uint8Array:Array,Es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(yi=0,uc=Es.length;yi<uc;++yi)St[yi]=Es[yi],st[Es.charCodeAt(yi)]=yi;var yi,uc;st["-".charCodeAt(0)]=62;st["_".charCodeAt(0)]=63;function Ml(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 Yd(i){var e=Ml(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Xd(i,e,t){return(e+t)*3/4-t}function ep(i){var e,t=Ml(i),r=t[0],n=t[1],a=new Jd(Xd(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=st[i.charCodeAt(l)]<<18|st[i.charCodeAt(l+1)]<<12|st[i.charCodeAt(l+2)]<<6|st[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=st[i.charCodeAt(l)]<<2|st[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=st[i.charCodeAt(l)]<<10|st[i.charCodeAt(l+1)]<<4|st[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function tp(i){return St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}function ip(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(tp(r));return n.join("")}function rp(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(ip(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 np=4,dc=0,pc=1,ap=2;function Tr(i){let e=i.length;for(;--e>=0;)i[e]=0}var sp=0,Ul=1,op=2,cp=3,lp=258,go=29,Cn=256,bn=Cn+1+go,hr=30,mo=19,Fl=2*bn+1,Ii=15,xs=16,up=7,yo=256,jl=16,Bl=17,ql=18,Js=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]),ya=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]),dp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pp=512,Dt=new Array((bn+2)*2);Tr(Dt);var dn=new Array(hr*2);Tr(dn);var wn=new Array(pp);Tr(wn);var Sn=new Array(lp-cp+1);Tr(Sn);var vo=new Array(go);Tr(vo);var Pa=new Array(hr);Tr(Pa);function $s(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 Vl,zl,Wl;function As(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Kl=i=>i<256?wn[i]:wn[256+(i>>>7)],_n=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Qe=(i,e,t)=>{i.bi_valid>xs-t?(i.bi_buf|=e<<i.bi_valid&65535,_n(i,i.bi_buf),i.bi_buf=e>>xs-i.bi_valid,i.bi_valid+=t-xs):(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])},Ql=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},fp=i=>{i.bi_valid===16?(_n(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)},hp=(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,l=e.stat_desc.max_length,c,u,m,y,d,p,f=0;for(y=0;y<=Ii;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<Fl;c++)u=i.heap[c],y=t[t[u*2+1]*2+1]+1,y>l&&(y=l,f++),t[u*2+1]=y,!(u>r)&&(i.bl_count[y]++,d=0,u>=o&&(d=s[u-o]),p=t[u*2],i.opt_len+=p*(y+d),a&&(i.static_len+=p*(n[u*2+1]+d)));if(f!==0){do{for(y=l-1;i.bl_count[y]===0;)y--;i.bl_count[y]--,i.bl_count[y+1]+=2,i.bl_count[l]--,f-=2}while(f>0);for(y=l;y!==0;y--)for(u=i.bl_count[y];u!==0;)m=i.heap[--c],!(m>r)&&(t[m*2+1]!==y&&(i.opt_len+=(y-t[m*2+1])*t[m*2],t[m*2+1]=y),u--)}},Gl=(i,e,t)=>{let r=new Array(Ii+1),n=0,a,s;for(a=1;a<=Ii;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]=Ql(r[o]++,o))}},gp=()=>{let i,e,t,r,n,a=new Array(Ii+1);for(t=0,r=0;r<go-1;r++)for(vo[r]=t,i=0;i<1<<Js[r];i++)Sn[t++]=r;for(Sn[t-1]=r,n=0,r=0;r<16;r++)for(Pa[r]=n,i=0;i<1<<ya[r];i++)wn[n++]=r;for(n>>=7;r<hr;r++)for(Pa[r]=n<<7,i=0;i<1<<ya[r]-7;i++)wn[256+n++]=r;for(e=0;e<=Ii;e++)a[e]=0;for(i=0;i<=143;)Dt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Dt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Dt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Dt[i*2+1]=8,i++,a[8]++;for(Gl(Dt,bn+1,a),i=0;i<hr;i++)dn[i*2+1]=5,dn[i*2]=Ql(i,5);Vl=new $s(Dt,Js,Cn+1,bn,Ii),zl=new $s(dn,ya,0,hr,Ii),Wl=new $s(new Array(0),dp,0,mo,up)},Zl=i=>{let e;for(e=0;e<bn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<hr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<mo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[yo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Jl=i=>{i.bi_valid>8?_n(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},fc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},ks=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&fc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!fc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},hc=(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=Sn[n],_t(i,s+Cn+1,e),o=Js[s],o!==0&&(n-=vo[s],Qe(i,n,o)),r--,s=Kl(r),_t(i,s,t),o=ya[s],o!==0&&(r-=Pa[s],Qe(i,r,o)));while(a<i.sym_next);_t(i,yo,e)},Ys=(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,l=-1,c;for(i.heap_len=0,i.heap_max=Fl,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=l=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,t[c*2]=1,i.depth[c]=0,i.opt_len--,n&&(i.static_len-=r[c*2+1]);for(e.max_code=l,s=i.heap_len>>1;s>=1;s--)ks(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],ks(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[c*2]=t[s*2]+t[o*2],i.depth[c]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=c,i.heap[1]=c++,ks(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],hp(i,e),Gl(t,l,i.bl_count)},gc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)&&(o<c?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[jl*2]++):o<=10?i.bl_tree[Bl*2]++:i.bl_tree[ql*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},mc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)){if(o<c)do _t(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(_t(i,a,i.bl_tree),o--),_t(i,jl,i.bl_tree),Qe(i,o-3,2)):o<=10?(_t(i,Bl,i.bl_tree),Qe(i,o-3,3)):(_t(i,ql,i.bl_tree),Qe(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},mp=i=>{let e;for(gc(i,i.dyn_ltree,i.l_desc.max_code),gc(i,i.dyn_dtree,i.d_desc.max_code),Ys(i,i.bl_desc),e=mo-1;e>=3&&i.bl_tree[Hl[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},yp=(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[Hl[n]*2+1],3);mc(i,i.dyn_ltree,e-1),mc(i,i.dyn_dtree,t-1)},vp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return dc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return pc;for(t=32;t<Cn;t++)if(i.dyn_ltree[t*2]!==0)return pc;return dc},yc=!1,bp=i=>{yc||(gp(),yc=!0),i.l_desc=new As(i.dyn_ltree,Vl),i.d_desc=new As(i.dyn_dtree,zl),i.bl_desc=new As(i.bl_tree,Wl),i.bi_buf=0,i.bi_valid=0,Zl(i)},Yl=(i,e,t,r)=>{Qe(i,(sp<<1)+(r?1:0),3),Jl(i),_n(i,t),_n(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},wp=i=>{Qe(i,Ul<<1,3),_t(i,yo,Dt),fp(i)},Sp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===ap&&(i.strm.data_type=vp(i)),Ys(i,i.l_desc),Ys(i,i.d_desc),s=mp(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?Yl(i,e,t,r):i.strategy===np||a===n?(Qe(i,(Ul<<1)+(r?1:0),3),hc(i,Dt,dn)):(Qe(i,(op<<1)+(r?1:0),3),yp(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),hc(i,i.dyn_ltree,i.dyn_dtree)),Zl(i),r&&Jl(i)},_p=(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[(Sn[t]+Cn+1)*2]++,i.dyn_dtree[Kl(e)*2]++),i.sym_next===i.sym_end),Ep=bp,xp=Yl,$p=Sp,Ap=_p,kp=wp,Ip={_tr_init:Ep,_tr_stored_block:xp,_tr_flush_block:$p,_tr_tally:Ap,_tr_align:kp},Tp=(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},En=Tp,Cp=()=>{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},Lp=new Uint32Array(Cp()),Np=(i,e,t,r)=>{let n=Lp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},xe=Np,Ui={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"},Qi={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:Rp,_tr_stored_block:Xs,_tr_flush_block:Pp,_tr_tally:Yt,_tr_align:Op}=Ip,{Z_NO_FLUSH:Xt,Z_PARTIAL_FLUSH:Dp,Z_FULL_FLUSH:Mp,Z_FINISH:ct,Z_BLOCK:vc,Z_OK:Te,Z_STREAM_END:bc,Z_STREAM_ERROR:$t,Z_DATA_ERROR:Up,Z_BUF_ERROR:Is,Z_DEFAULT_COMPRESSION:Fp,Z_FILTERED:jp,Z_HUFFMAN_ONLY:Xn,Z_RLE:Bp,Z_FIXED:qp,Z_DEFAULT_STRATEGY:Hp,Z_UNKNOWN:Vp,Z_DEFLATED:Za}=Qi,zp=9,Wp=15,Kp=8,Qp=29,Gp=256,eo=Gp+1+Qp,Zp=30,Jp=19,Yp=2*eo+1,Xp=15,X=3,Qt=258,At=Qt+X+1,ef=32,br=42,bo=57,to=69,io=73,ro=91,no=103,Ti=113,rn=666,je=1,Cr=2,Fi=3,Lr=4,tf=3,Ci=(i,e)=>(i.msg=Ui[e],e),wc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},rf=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)},nf=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ei=nf,Ye=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)=>{Pp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ye(i.strm)},ne=(i,e)=>{i.pending_buf[i.pending++]=e},Br=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},ao=(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=En(i.adler,e,n,t):i.state.wrap===2&&(i.adler=xe(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Xl=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,l=i.strstart>i.w_size-At?i.strstart-(i.w_size-At):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+Qt,d=c[r+s-1],p=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==p||c[n+s-1]!==d||c[n]!==c[r]||c[++n]!==c[r+1])){r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&r<y);if(a=Qt-(y-r),r=y-Qt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],p=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},wr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-At)&&(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),rf(i),r+=e),i.strm.avail_in===0)break;if(t=ao(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=X)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+X-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<X)););}while(i.lookahead<At&&i.strm.avail_in!==0)},eu=(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!==ct||e===Xt||r!==n+i.strm.avail_in)))break;s=e===ct&&r===n+i.strm.avail_in?1:0,Xs(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,Ye(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&&(ao(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?Lr:e!==Xt&&e!==ct&&i.strm.avail_in===0&&i.strstart===i.block_start?Cr:(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&&(ao(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===ct)&&e!==Xt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ct&&i.strm.avail_in===0&&r===n?1:0,Xs(i,i.block_start,r,s),i.block_start+=r,Ye(i.strm)),s?Fi:je)},Ts=(i,e)=>{let t,r;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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-At&&(i.match_length=Xl(i,t)),i.match_length>=X)if(r=Yt(i,i.strstart-i.match_start,i.match_length-X),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=X){i.match_length--;do i.strstart++,i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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 je}return i.insert=i.strstart<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},cr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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=X-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-At&&(i.match_length=Xl(i,t),i.match_length<=5&&(i.strategy===jp||i.match_length===X&&i.strstart-i.match_start>4096)&&(i.match_length=X-1)),i.prev_length>=X&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-X,r=Yt(i,i.strstart-1-i.prev_match,i.prev_length-X),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+X-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=X-1,i.strstart++,r&&(et(i,!1),i.strm.avail_out===0))return je}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 je}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<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},af=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Qt){if(wr(i),i.lookahead<=Qt&&e===Xt)return je;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=X&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Qt;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=Qt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=X?(t=Yt(i,1,i.match_length-X),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 je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},sf=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(wr(i),i.lookahead===0)){if(e===Xt)return je;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 je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr};function mt(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 nn=[new mt(0,0,0,0,eu),new mt(4,4,8,4,Ts),new mt(4,5,16,8,Ts),new mt(4,6,32,32,Ts),new mt(4,4,16,16,cr),new mt(8,16,32,32,cr),new mt(8,16,128,128,cr),new mt(8,32,128,256,cr),new mt(32,128,258,1024,cr),new mt(32,258,258,4096,cr)],of=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=nn[i.level].max_lazy,i.good_match=nn[i.level].good_length,i.nice_match=nn[i.level].nice_length,i.max_chain_length=nn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=X-1,i.match_available=0,i.ins_h=0};function cf(){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(Yp*2),this.dyn_dtree=new Uint16Array((2*Zp+1)*2),this.bl_tree=new Uint16Array((2*Jp+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(Xp+1),this.heap=new Uint16Array(2*eo+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*eo+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 Ln=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==br&&e.status!==bo&&e.status!==to&&e.status!==io&&e.status!==ro&&e.status!==no&&e.status!==Ti&&e.status!==rn?1:0},tu=i=>{if(Ln(i))return Ci(i,$t);i.total_in=i.total_out=0,i.data_type=Vp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?bo:e.wrap?br:Ti,i.adler=e.wrap===2?0:1,e.last_flush=-2,Rp(e),Te},iu=i=>{let e=tu(i);return e===Te&&of(i.state),e},lf=(i,e)=>Ln(i)||i.state.wrap!==2?$t:(i.state.gzhead=e,Te),ru=(i,e,t,r,n,a)=>{if(!i)return $t;let s=1;if(e===Fp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>zp||t!==Za||r<8||r>15||e<0||e>9||a<0||a>qp||r===8&&s!==1)return Ci(i,$t);r===8&&(r=9);let o=new cf;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+X-1)/X),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,iu(i)},uf=(i,e)=>ru(i,e,Za,Wp,Kp,Hp),df=(i,e)=>{if(Ln(i)||e>vc||e<0)return i?Ci(i,$t):$t;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===rn&&e!==ct)return Ci(i,i.avail_out===0?Is:$t);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ye(i),i.avail_out===0)return t.last_flush=-1,Te}else if(i.avail_in===0&&wc(e)<=wc(r)&&e!==ct)return Ci(i,Is);if(t.status===rn&&i.avail_in!==0)return Ci(i,Is);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>=Xn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=ef),n+=31-n%31,Br(t,n),t.strstart!==0&&(Br(t,i.adler>>>16),Br(t,i.adler&65535)),i.adler=1,t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===bo){if(i.adler=0,ne(t,31),ne(t,139),ne(t,8),t.gzhead)ne(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)),ne(t,t.gzhead.time&255),ne(t,t.gzhead.time>>8&255),ne(t,t.gzhead.time>>16&255),ne(t,t.gzhead.time>>24&255),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ne(t,t.gzhead.extra.length&255),ne(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=xe(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=to;else if(ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,tf),t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===to){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=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Ye(i),t.pending!==0)return t.last_flush=-1,Te;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=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=io}if(t.status===io){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=xe(i.adler,t.pending_buf,t.pending-n,n)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ne(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ro}if(t.status===ro){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=xe(i.adler,t.pending_buf,t.pending-n,n)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ne(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n))}t.status=no}if(t.status===no){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ye(i),t.pending!==0))return t.last_flush=-1,Te;ne(t,i.adler&255),ne(t,i.adler>>8&255),i.adler=0}if(t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(i.avail_in!==0||t.lookahead!==0||e!==Xt&&t.status!==rn){let n=t.level===0?eu(t,e):t.strategy===Xn?sf(t,e):t.strategy===Bp?af(t,e):nn[t.level].func(t,e);if((n===Fi||n===Lr)&&(t.status=rn),n===je||n===Fi)return i.avail_out===0&&(t.last_flush=-1),Te;if(n===Cr&&(e===Dp?Op(t):e!==vc&&(Xs(t,0,0,!1),e===Mp&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ye(i),i.avail_out===0))return t.last_flush=-1,Te}return e!==ct?Te:t.wrap<=0?bc:(t.wrap===2?(ne(t,i.adler&255),ne(t,i.adler>>8&255),ne(t,i.adler>>16&255),ne(t,i.adler>>24&255),ne(t,i.total_in&255),ne(t,i.total_in>>8&255),ne(t,i.total_in>>16&255),ne(t,i.total_in>>24&255)):(Br(t,i.adler>>>16),Br(t,i.adler&65535)),Ye(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Te:bc)},pf=i=>{if(Ln(i))return $t;let e=i.state.status;return i.state=null,e===Ti?Ci(i,Up):Te},ff=(i,e)=>{let t=e.length;if(Ln(i))return $t;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==br||r.lookahead)return $t;if(n===1&&(i.adler=En(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 l=new Uint8Array(r.w_size);l.set(e.subarray(t-r.w_size,t),0),e=l,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,wr(r);r.lookahead>=X;){let l=r.strstart,c=r.lookahead-(X-1);do r.ins_h=ei(r,r.ins_h,r.window[l+X-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=X-1,wr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=X-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Te},hf=uf,gf=ru,mf=iu,yf=tu,vf=lf,bf=df,wf=pf,Sf=ff,_f="pako deflate (from Nodeca project)",pn={deflateInit:hf,deflateInit2:gf,deflateReset:mf,deflateResetKeep:yf,deflateSetHeader:vf,deflate:bf,deflateEnd:wf,deflateSetDictionary:Sf,deflateInfo:_f},Ef=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),xf=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)Ef(t,r)&&(i[r]=t[r])}}return i},$f=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},Ja={assign:xf,flattenChunks:$f},nu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){nu=!1}var xn=new Uint8Array(256);for(let i=0;i<256;i++)xn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;xn[254]=xn[254]=1;var Af=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},kf=(i,e)=>{if(e<65534&&i.subarray&&nu)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},If=(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=xn[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 kf(a,n)},Tf=(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+xn[i[t]]>e?t:e},$n={string2buf:Af,buf2string:If,utf8border:Tf};function Cf(){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 au=Cf,su=Object.prototype.toString,{Z_NO_FLUSH:Lf,Z_SYNC_FLUSH:Nf,Z_FULL_FLUSH:Rf,Z_FINISH:Pf,Z_OK:Oa,Z_STREAM_END:Of,Z_DEFAULT_COMPRESSION:Df,Z_DEFAULT_STRATEGY:Mf,Z_DEFLATED:Uf}=Qi;function Nn(i){this.options=Ja.assign({level:Df,method:Uf,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mf},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 au,this.strm.avail_out=0;let t=pn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Oa)throw new Error(Ui[t]);if(e.header&&pn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=$n.string2buf(e.dictionary):su.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=pn.deflateSetDictionary(this.strm,r),t!==Oa)throw new Error(Ui[t]);this._dict_set=!0}}Nn.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?Pf:Lf,typeof i=="string"?t.input=$n.string2buf(i):su.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===Nf||a===Rf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=pn.deflate(t,a),n===Of)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=pn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Oa;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};Nn.prototype.onData=function(i){this.chunks.push(i)};Nn.prototype.onEnd=function(i){i===Oa&&(this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function wo(i,e){let t=new Nn(e);if(t.push(i,!0),t.err)throw t.msg||Ui[t.err];return t.result}function Ff(i,e){return e=e||{},e.raw=!0,wo(i,e)}function jf(i,e){return e=e||{},e.gzip=!0,wo(i,e)}var Bf=Nn,qf=wo,Hf=Ff,Vf=jf,zf=Qi,Wf={Deflate:Bf,deflate:qf,deflateRaw:Hf,gzip:Vf,constants:zf},ea=16209,Kf=16191,Qf=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,p,f,S,E,A,k,b,T,R,C,Q,V,L,W=e.state;r=e.next_in,V=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),l=W.dmax,c=W.wsize,u=W.whave,m=W.wnext,y=W.window,d=W.hold,p=W.bits,f=W.lencode,S=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=f[d&E];t:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b===0)L[a++]=k&65535;else if(b&16){T=k&65535,b&=15,b&&(p<b&&(d+=V[r++]<<p,p+=8),T+=d&(1<<b)-1,d>>>=b,p-=b),p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=S[d&A];i:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b&16){if(R=k&65535,b&=15,p<b&&(d+=V[r++]<<p,p+=8,p<b&&(d+=V[r++]<<p,p+=8)),R+=d&(1<<b)-1,R>l){e.msg="invalid distance too far back",W.mode=ea;break e}if(d>>>=b,p-=b,b=a-s,R>b){if(b=R-b,b>u&&W.sane){e.msg="invalid distance too far back",W.mode=ea;break e}if(C=0,Q=y,m===0){if(C+=c-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}else if(m<b){if(C+=c+m-b,b-=m,b<T){T-=b;do L[a++]=y[C++];while(--b);if(C=0,m<T){b=m,T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}}else if(C+=m-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}for(;T>2;)L[a++]=Q[C++],L[a++]=Q[C++],L[a++]=Q[C++],T-=3;T&&(L[a++]=Q[C++],T>1&&(L[a++]=Q[C++]))}else{C=a-R;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((b&64)===0){k=S[(k&65535)+(d&(1<<b)-1)];continue i}else{e.msg="invalid distance code",W.mode=ea;break e}break}}else if((b&64)===0){k=f[(k&65535)+(d&(1<<b)-1)];continue t}else if(b&32){W.mode=Kf;break e}else{e.msg="invalid literal/length code",W.mode=ea;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),W.hold=d,W.bits=p},lr=15,Sc=852,_c=592,Ec=0,Cs=1,xc=2,Gf=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]),Zf=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]),Jf=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]),Yf=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]),Xf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,p=0,f=0,S=0,E=0,A=0,k,b,T,R,C,Q=null,V,L=new Uint16Array(lr+1),W=new Uint16Array(lr+1),He=null,Rr,I,On;for(c=0;c<=lr;c++)L[c]=0;for(u=0;u<r;u++)L[e[t+u]]++;for(d=l,y=lr;y>=1&&L[y]===0;y--);if(d>y&&(d=y),y===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<y&&L[m]===0;m++);for(d<m&&(d=m),S=1,c=1;c<=lr;c++)if(S<<=1,S-=L[c],S<0)return-1;if(S>0&&(i===Ec||y!==1))return-1;for(W[1]=0,c=1;c<lr;c++)W[c+1]=W[c]+L[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[W[e[t+u]]++]=u);if(i===Ec?(Q=He=s,V=20):i===Cs?(Q=Gf,He=Zf,V=257):(Q=Jf,He=Yf,V=0),A=0,u=0,c=m,C=a,p=d,f=0,T=-1,E=1<<d,R=E-1,i===Cs&&E>Sc||i===xc&&E>_c)return 1;for(;;){Rr=c-f,s[u]+1<V?(I=0,On=s[u]):s[u]>=V?(I=He[s[u]-V],On=Q[s[u]-V]):(I=32+64,On=0),k=1<<c-f,b=1<<p,m=b;do b-=k,n[C+(A>>f)+b]=Rr<<24|I<<16|On|0;while(b!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,u++,--L[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&R)!==T){for(f===0&&(f=d),C+=m,p=c-f,S=1<<p;p+f<y&&(S-=L[p+f],!(S<=0));)p++,S<<=1;if(E+=1<<p,i===Cs&&E>Sc||i===xc&&E>_c)return 1;T=A&R,n[T]=d<<24|p<<16|C-a|0}}return A!==0&&(n[C+A]=c-f<<24|64<<16|0),o.bits=d,0},fn=Xf,eh=0,ou=1,cu=2,{Z_FINISH:$c,Z_BLOCK:th,Z_TREES:ta,Z_OK:ji,Z_STREAM_END:ih,Z_NEED_DICT:rh,Z_STREAM_ERROR:lt,Z_DATA_ERROR:lu,Z_MEM_ERROR:uu,Z_BUF_ERROR:nh,Z_DEFLATED:Ac}=Qi,Ya=16180,kc=16181,Ic=16182,Tc=16183,Cc=16184,Lc=16185,Nc=16186,Rc=16187,Pc=16188,Oc=16189,Da=16190,Nt=16191,Ls=16192,Dc=16193,Ns=16194,Mc=16195,Uc=16196,Fc=16197,jc=16198,ia=16199,ra=16200,Bc=16201,qc=16202,Hc=16203,Vc=16204,zc=16205,Rs=16206,Wc=16207,Kc=16208,de=16209,du=16210,pu=16211,ah=852,sh=592,oh=15,ch=oh,Qc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function lh(){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 Gi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Ya||e.mode>pu?1:0},fu=i=>{if(Gi(i))return lt;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=Ya,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(ah),e.distcode=e.distdyn=new Int32Array(sh),e.sane=1,e.back=-1,ji},hu=i=>{if(Gi(i))return lt;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,fu(i)},gu=(i,e)=>{let t;if(Gi(i))return lt;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?lt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,hu(i))},mu=(i,e)=>{if(!i)return lt;let t=new lh;i.state=t,t.strm=i,t.window=null,t.mode=Ya;let r=gu(i,e);return r!==ji&&(i.state=null),r},uh=i=>mu(i,ch),Gc=!0,Ps,Os,dh=i=>{if(Gc){Ps=new Int32Array(512),Os=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(fn(ou,i.lens,0,288,Ps,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;fn(cu,i.lens,0,32,Os,0,i.work,{bits:5}),Gc=!1}i.lencode=Ps,i.lenbits=9,i.distcode=Os,i.distbits=5},yu=(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},ph=(i,e)=>{let t,r,n,a,s,o,l,c,u,m,y,d,p,f,S=0,E,A,k,b,T,R,C,Q,V=new Uint8Array(4),L,W,He=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Gi(i)||!i.output||!i.input&&i.avail_in!==0)return lt;t=i.state,t.mode===Nt&&(t.mode=Ls),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,m=o,y=l,Q=ji;e:for(;;)switch(t.mode){case Ya:if(t.wrap===0){t.mode=Ls;break}for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0),c=0,u=0,t.mode=kc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=de;break}if((c&15)!==Ac){i.msg="unknown compression method",t.mode=de;break}if(c>>>=4,u-=4,C=(c&15)+8,t.wbits===0&&(t.wbits=C),C>15||C>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=c&512?Oc:Nt,c=0,u=0;break;case kc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==Ac){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=c>>8&1),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Ic;case Ic:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,V[2]=c>>>16&255,V[3]=c>>>24&255,t.check=xe(t.check,V,4,0)),c=0,u=0,t.mode=Tc;case Tc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Cc;case Cc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Lc;case Lc: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=xe(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Nc;case Nc: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=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Rc;case Rc: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=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.comment=null);t.mode=Pc;case Pc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=de;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Nt;break;case Oc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=Qc(c),c=0,u=0,t.mode=Da;case Da:if(t.havedict===0)return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,rh;i.adler=t.check=1,t.mode=Nt;case Nt:if(e===th||e===ta)break e;case Ls:if(t.last){c>>>=u&7,u-=u&7,t.mode=Rs;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=Dc;break;case 1:if(dh(t),t.mode=ia,e===ta){c>>>=2,u-=2;break e}break;case 2:t.mode=Uc;break;case 3:i.msg="invalid block type",t.mode=de}c>>>=2,u-=2;break;case Dc:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=de;break}if(t.length=c&65535,c=0,u=0,t.mode=Ns,e===ta)break e;case Ns:t.mode=Mc;case Mc:if(d=t.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,t.length-=d;break}t.mode=Nt;break;case Uc:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=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=Fc;case Fc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[He[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[He[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,L={bits:t.lenbits},Q=fn(eh,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid code lengths set",t.mode=de;break}t.have=0,t.mode=jc;case jc:for(;t.have<t.nlen+t.ndist;){for(;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(k<16)c>>>=E,u-=E,t.lens[t.have++]=k;else{if(k===16){for(W=E+2;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=de;break}C=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(k===17){for(W=E+3;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=0,d=3+(c&7),c>>>=3,u-=3}else{for(W=E+7;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=0,d=11+(c&127),c>>>=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++]=C}}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,L={bits:t.lenbits},Q=fn(ou,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid literal/lengths set",t.mode=de;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},Q=fn(cu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,Q){i.msg="invalid distances set",t.mode=de;break}if(t.mode=ia,e===ta)break e;case ia:t.mode=ra;case ra:if(o>=6&&l>=258){i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,Qf(i,y),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,t.mode===Nt&&(t.back=-1);break}for(t.back=0;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(b=E,T=A,R=k;S=t.lencode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,t.length=k,A===0){t.mode=zc;break}if(A&32){t.back=-1,t.mode=Nt;break}if(A&64){i.msg="invalid literal/length code",t.mode=de;break}t.extra=A&15,t.mode=Bc;case Bc:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=qc;case qc:for(;S=t.distcode[c&(1<<t.distbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(b=E,T=A,R=k;S=t.distcode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,A&64){i.msg="invalid distance code",t.mode=de;break}t.offset=k,t.extra=A&15,t.mode=Hc;case Hc:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=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=Vc;case Vc:if(l===0)break e;if(d=y-l,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,p=t.wsize-d):p=t.wnext-d,d>t.length&&(d=t.length),f=t.window}else f=n,p=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=f[p++];while(--d);t.length===0&&(t.mode=ra);break;case zc:if(l===0)break e;n[s++]=t.length,l--,t.mode=ra;break;case Rs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(y-=l,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,s-y):En(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:Qc(c))!==t.check){i.msg="incorrect data check",t.mode=de;break}c=0,u=0}t.mode=Wc;case Wc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=de;break}c=0,u=0}t.mode=Kc;case Kc:Q=ih;break e;case de:Q=lu;break e;case du:return uu;case pu:default:return lt}return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,(t.wsize||y!==i.avail_out&&t.mode<de&&(t.mode<Rs||e!==$c))&&yu(i,i.output,i.next_out,y-i.avail_out),m-=i.avail_in,y-=i.avail_out,i.total_in+=m,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,i.next_out-y):En(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Nt?128:0)+(t.mode===ia||t.mode===Ns?256:0),(m===0&&y===0||e===$c)&&Q===ji&&(Q=nh),Q},fh=i=>{if(Gi(i))return lt;let e=i.state;return e.window&&(e.window=null),i.state=null,ji},hh=(i,e)=>{if(Gi(i))return lt;let t=i.state;return(t.wrap&2)===0?lt:(t.head=e,e.done=!1,ji)},gh=(i,e)=>{let t=e.length,r,n,a;return Gi(i)||(r=i.state,r.wrap!==0&&r.mode!==Da)?lt:r.mode===Da&&(n=1,n=En(n,e,t,0),n!==r.check)?lu:(a=yu(i,e,t,t),a?(r.mode=du,uu):(r.havedict=1,ji))},mh=hu,yh=gu,vh=fu,bh=uh,wh=mu,Sh=ph,_h=fh,Eh=hh,xh=gh,$h="pako inflate (from Nodeca project)",Mt={inflateReset:mh,inflateReset2:yh,inflateResetKeep:vh,inflateInit:bh,inflateInit2:wh,inflate:Sh,inflateEnd:_h,inflateGetHeader:Eh,inflateSetDictionary:xh,inflateInfo:$h};function Ah(){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 kh=Ah,vu=Object.prototype.toString,{Z_NO_FLUSH:Ih,Z_FINISH:Th,Z_OK:An,Z_STREAM_END:Ds,Z_NEED_DICT:Ms,Z_STREAM_ERROR:Ch,Z_DATA_ERROR:Zc,Z_MEM_ERROR:Lh}=Qi;function Rn(i){this.options=Ja.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 au,this.strm.avail_out=0;let t=Mt.inflateInit2(this.strm,e.windowBits);if(t!==An)throw new Error(Ui[t]);if(this.header=new kh,Mt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=$n.string2buf(e.dictionary):vu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Mt.inflateSetDictionary(this.strm,e.dictionary),t!==An)))throw new Error(Ui[t])}Rn.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?Th:Ih,vu.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=Mt.inflate(t,s),a===Ms&&n&&(a=Mt.inflateSetDictionary(t,n),a===An?a=Mt.inflate(t,s):a===Zc&&(a=Ms));t.avail_in>0&&a===Ds&&t.state.wrap>0&&i[t.next_in]!==0;)Mt.inflateReset(t),a=Mt.inflate(t,s);switch(a){case Ch:case Zc:case Ms:case Lh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Ds))if(this.options.to==="string"){let l=$n.utf8border(t.output,t.next_out),c=t.next_out-l,u=$n.buf2string(t.output,l);t.next_out=c,t.avail_out=r-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===An&&o===0)){if(a===Ds)return a=Mt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Rn.prototype.onData=function(i){this.chunks.push(i)};Rn.prototype.onEnd=function(i){i===An&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function So(i,e){let t=new Rn(e);if(t.push(i),t.err)throw t.msg||Ui[t.err];return t.result}function Nh(i,e){return e=e||{},e.raw=!0,So(i,e)}var Rh=Rn,Ph=So,Oh=Nh,Dh=So,Mh=Qi,Uh={Inflate:Rh,inflate:Ph,inflateRaw:Oh,ungzip:Dh,constants:Mh},{Deflate:Fh,deflate:jh,deflateRaw:Bh,gzip:qh}=Wf,{Inflate:Hh,inflate:Vh,inflateRaw:zh,ungzip:Wh}=Uh,Kh=Fh,Qh=jh,Gh=Bh,Zh=qh,Jh=Hh,Yh=Vh,Xh=zh,eg=Wh,tg=Qi,ig={Deflate:Kh,deflate:Qh,deflateRaw:Gh,gzip:Zh,Inflate:Jh,inflate:Yh,inflateRaw:Xh,ungzip:eg,constants:tg},ce=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},le=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ma.prototype,"input",void 0);ce([h(),le("design:type",String)],Ma.prototype,"output",void 0);Ma=ce([Ae(),le("design:paramtypes",[String,String])],Ma);var Ua=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ua.prototype,"input",void 0);ce([h(),le("design:type",String)],Ua.prototype,"output",void 0);Ua=ce([F(),le("design:paramtypes",[String,String])],Ua);var ni=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ce([h(),le("design:type",String)],ni.prototype,"name",void 0);ce([h(),le("design:type",String)],ni.prototype,"modelId",void 0);ce([h(),le("design:type",String)],ni.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],ni.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],ni.prototype,"metaData",void 0);ni=ce([Ae(),le("design:paramtypes",[String,String,String,Array,String])],ni);var Tt=class{constructor(e,t,r,n,a,s,o,l){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=l}};ce([h(),le("design:type",String)],Tt.prototype,"name",void 0);ce([h(),le("design:type",String)],Tt.prototype,"modelId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"taskId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],Tt.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],Tt.prototype,"metaData",void 0);ce([h(),le("design:type",String)],Tt.prototype,"createdAt",void 0);ce([h(),le("design:type",String)],Tt.prototype,"updatedAt",void 0);Tt=ce([F(),le("design:paramtypes",[String,String,String,String,Array,String,String,String])],Tt);var Bi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ce([h(),le("design:type",String)],Bi.prototype,"model",void 0);ce([h(),le("design:type",String)],Bi.prototype,"status",void 0);ce([h(),le("design:type",Number)],Bi.prototype,"progress",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"downloaded",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"loaded",void 0);Bi=ce([F(),le("design:paramtypes",[String,String,Number,Boolean,Boolean])],Bi);var rg=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},Se=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,va,so=class{constructor(e,t=!0){be.set(this,void 0),va.set(this,new Map),rg(this,be,e,"f")}async getModels(){let e=await Se(this,be,"f").query({query:v`
1257
+ }`,variables:{url:e,interactionCall:t}}));return r}};Ft=new WeakMap;var rs={};rs.byteLength=wp;rs.toByteArray=_p;rs.fromByteArray=$p;var $t=[],ut=[],bp=typeof Uint8Array<"u"?Uint8Array:Array,Rs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($i=0,kc=Rs.length;$i<kc;++$i)$t[$i]=Rs[$i],ut[Rs.charCodeAt($i)]=$i;var $i,kc;ut["-".charCodeAt(0)]=62;ut["_".charCodeAt(0)]=63;function eu(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 wp(i){var e=eu(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Sp(i,e,t){return(e+t)*3/4-t}function _p(i){var e,t=eu(i),r=t[0],n=t[1],a=new bp(Sp(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=ut[i.charCodeAt(l)]<<18|ut[i.charCodeAt(l+1)]<<12|ut[i.charCodeAt(l+2)]<<6|ut[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=ut[i.charCodeAt(l)]<<2|ut[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=ut[i.charCodeAt(l)]<<10|ut[i.charCodeAt(l+1)]<<4|ut[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function xp(i){return $t[i>>18&63]+$t[i>>12&63]+$t[i>>6&63]+$t[i&63]}function Ep(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(xp(r));return n.join("")}function $p(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(Ep(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push($t[e>>2]+$t[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push($t[e>>10]+$t[e>>4&63]+$t[e<<2&63]+"=")),n.join("")}var Ap=4,Ic=0,Tc=1,kp=2;function Pr(i){let e=i.length;for(;--e>=0;)i[e]=0}var Ip=0,tu=1,Tp=2,Cp=3,Lp=258,$o=29,Un=256,An=Un+1+$o,br=30,Ao=19,iu=2*An+1,Di=15,Ns=16,Pp=7,ko=256,ru=16,nu=17,au=18,oo=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]),$a=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]),Rp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),su=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Np=512,jt=new Array((An+2)*2);Pr(jt);var vn=new Array(br*2);Pr(vn);var kn=new Array(Np);Pr(kn);var In=new Array(Lp-Cp+1);Pr(In);var Io=new Array($o);Pr(Io);var Ha=new Array(br);Pr(Ha);function Os(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 ou,cu,lu;function Ds(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var uu=i=>i<256?kn[i]:kn[256+(i>>>7)],Tn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},et=(i,e,t)=>{i.bi_valid>Ns-t?(i.bi_buf|=e<<i.bi_valid&65535,Tn(i,i.bi_buf),i.bi_buf=e>>Ns-i.bi_valid,i.bi_valid+=t-Ns):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},At=(i,e,t)=>{et(i,t[e*2],t[e*2+1])},du=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Op=i=>{i.bi_valid===16?(Tn(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)},Dp=(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,l=e.stat_desc.max_length,c,u,m,y,d,h,g=0;for(y=0;y<=Di;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<iu;c++)u=i.heap[c],y=t[t[u*2+1]*2+1]+1,y>l&&(y=l,g++),t[u*2+1]=y,!(u>r)&&(i.bl_count[y]++,d=0,u>=o&&(d=s[u-o]),h=t[u*2],i.opt_len+=h*(y+d),a&&(i.static_len+=h*(n[u*2+1]+d)));if(g!==0){do{for(y=l-1;i.bl_count[y]===0;)y--;i.bl_count[y]--,i.bl_count[y+1]+=2,i.bl_count[l]--,g-=2}while(g>0);for(y=l;y!==0;y--)for(u=i.bl_count[y];u!==0;)m=i.heap[--c],!(m>r)&&(t[m*2+1]!==y&&(i.opt_len+=(y-t[m*2+1])*t[m*2],t[m*2+1]=y),u--)}},pu=(i,e,t)=>{let r=new Array(Di+1),n=0,a,s;for(a=1;a<=Di;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]=du(r[o]++,o))}},Up=()=>{let i,e,t,r,n,a=new Array(Di+1);for(t=0,r=0;r<$o-1;r++)for(Io[r]=t,i=0;i<1<<oo[r];i++)In[t++]=r;for(In[t-1]=r,n=0,r=0;r<16;r++)for(Ha[r]=n,i=0;i<1<<$a[r];i++)kn[n++]=r;for(n>>=7;r<br;r++)for(Ha[r]=n<<7,i=0;i<1<<$a[r]-7;i++)kn[256+n++]=r;for(e=0;e<=Di;e++)a[e]=0;for(i=0;i<=143;)jt[i*2+1]=8,i++,a[8]++;for(;i<=255;)jt[i*2+1]=9,i++,a[9]++;for(;i<=279;)jt[i*2+1]=7,i++,a[7]++;for(;i<=287;)jt[i*2+1]=8,i++,a[8]++;for(pu(jt,An+1,a),i=0;i<br;i++)vn[i*2+1]=5,vn[i*2]=du(i,5);ou=new Os(jt,oo,Un+1,An,Di),cu=new Os(vn,$a,0,br,Di),lu=new Os(new Array(0),Rp,0,Ao,Pp)},hu=i=>{let e;for(e=0;e<An;e++)i.dyn_ltree[e*2]=0;for(e=0;e<br;e++)i.dyn_dtree[e*2]=0;for(e=0;e<Ao;e++)i.bl_tree[e*2]=0;i.dyn_ltree[ko*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},fu=i=>{i.bi_valid>8?Tn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},Cc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},Us=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&Cc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!Cc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},Lc=(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?At(i,n,e):(s=In[n],At(i,s+Un+1,e),o=oo[s],o!==0&&(n-=Io[s],et(i,n,o)),r--,s=uu(r),At(i,s,t),o=$a[s],o!==0&&(r-=Ha[s],et(i,r,o)));while(a<i.sym_next);At(i,ko,e)},co=(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,l=-1,c;for(i.heap_len=0,i.heap_max=iu,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=l=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,t[c*2]=1,i.depth[c]=0,i.opt_len--,n&&(i.static_len-=r[c*2+1]);for(e.max_code=l,s=i.heap_len>>1;s>=1;s--)Us(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Us(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[c*2]=t[s*2]+t[o*2],i.depth[c]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=c,i.heap[1]=c++,Us(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Dp(i,e),pu(t,l,i.bl_count)},Pc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)&&(o<c?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[ru*2]++):o<=10?i.bl_tree[nu*2]++:i.bl_tree[au*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},Rc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)){if(o<c)do At(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(At(i,a,i.bl_tree),o--),At(i,ru,i.bl_tree),et(i,o-3,2)):o<=10?(At(i,nu,i.bl_tree),et(i,o-3,3)):(At(i,au,i.bl_tree),et(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},Mp=i=>{let e;for(Pc(i,i.dyn_ltree,i.l_desc.max_code),Pc(i,i.dyn_dtree,i.d_desc.max_code),co(i,i.bl_desc),e=Ao-1;e>=3&&i.bl_tree[su[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Fp=(i,e,t,r)=>{let n;for(et(i,e-257,5),et(i,t-1,5),et(i,r-4,4),n=0;n<r;n++)et(i,i.bl_tree[su[n]*2+1],3);Rc(i,i.dyn_ltree,e-1),Rc(i,i.dyn_dtree,t-1)},jp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return Ic;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return Tc;for(t=32;t<Un;t++)if(i.dyn_ltree[t*2]!==0)return Tc;return Ic},Nc=!1,Bp=i=>{Nc||(Up(),Nc=!0),i.l_desc=new Ds(i.dyn_ltree,ou),i.d_desc=new Ds(i.dyn_dtree,cu),i.bl_desc=new Ds(i.bl_tree,lu),i.bi_buf=0,i.bi_valid=0,hu(i)},gu=(i,e,t,r)=>{et(i,(Ip<<1)+(r?1:0),3),fu(i),Tn(i,t),Tn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},Hp=i=>{et(i,tu<<1,3),At(i,ko,jt),Op(i)},qp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===kp&&(i.strm.data_type=jp(i)),co(i,i.l_desc),co(i,i.d_desc),s=Mp(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?gu(i,e,t,r):i.strategy===Ap||a===n?(et(i,(tu<<1)+(r?1:0),3),Lc(i,jt,vn)):(et(i,(Tp<<1)+(r?1:0),3),Fp(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),Lc(i,i.dyn_ltree,i.dyn_dtree)),hu(i),r&&fu(i)},zp=(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[(In[t]+Un+1)*2]++,i.dyn_dtree[uu(e)*2]++),i.sym_next===i.sym_end),Vp=Bp,Wp=gu,Kp=qp,Qp=zp,Gp=Hp,Zp={_tr_init:Vp,_tr_stored_block:Wp,_tr_flush_block:Kp,_tr_tally:Qp,_tr_align:Gp},Jp=(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},Cn=Jp,Yp=()=>{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},Xp=new Uint32Array(Yp()),eh=(i,e,t,r)=>{let n=Xp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},Ie=eh,Wi={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"},tr={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:th,_tr_stored_block:lo,_tr_flush_block:ih,_tr_tally:ai,_tr_align:rh}=Zp,{Z_NO_FLUSH:si,Z_PARTIAL_FLUSH:nh,Z_FULL_FLUSH:ah,Z_FINISH:pt,Z_BLOCK:Oc,Z_OK:Pe,Z_STREAM_END:Dc,Z_STREAM_ERROR:Tt,Z_DATA_ERROR:sh,Z_BUF_ERROR:Ms,Z_DEFAULT_COMPRESSION:oh,Z_FILTERED:ch,Z_HUFFMAN_ONLY:oa,Z_RLE:lh,Z_FIXED:uh,Z_DEFAULT_STRATEGY:dh,Z_UNKNOWN:ph,Z_DEFLATED:ns}=tr,hh=9,fh=15,gh=8,mh=29,yh=256,uo=yh+1+mh,vh=30,bh=19,wh=2*uo+1,Sh=15,te=3,ti=258,Ct=ti+te+1,_h=32,Er=42,To=57,po=69,ho=73,fo=91,go=103,Ui=113,un=666,He=1,Rr=2,Ki=3,Nr=4,xh=3,Mi=(i,e)=>(i.msg=Wi[e],e),Uc=i=>i*2-(i>4?9:0),ei=i=>{let e=i.length;for(;--e>=0;)i[e]=0},Eh=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)},$h=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,oi=$h,rt=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))},at=(i,e)=>{ih(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,rt(i.strm)},se=(i,e)=>{i.pending_buf[i.pending++]=e},Kr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},mo=(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=Cn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=Ie(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},mu=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,l=i.strstart>i.w_size-Ct?i.strstart-(i.w_size-Ct):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+ti,d=c[r+s-1],h=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==h||c[n+s-1]!==d||c[n]!==c[r]||c[++n]!==c[r+1])){r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&r<y);if(a=ti-(y-r),r=y-ti,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],h=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},$r=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-Ct)&&(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),Eh(i),r+=e),i.strm.avail_in===0)break;if(t=mo(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=te)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=oi(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=oi(i,i.ins_h,i.window[n+te-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<te)););}while(i.lookahead<Ct&&i.strm.avail_in!==0)},yu=(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!==pt||e===si||r!==n+i.strm.avail_in)))break;s=e===pt&&r===n+i.strm.avail_in?1:0,lo(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,rt(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&&(mo(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?Nr:e!==si&&e!==pt&&i.strm.avail_in===0&&i.strstart===i.block_start?Rr:(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&&(mo(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===pt)&&e!==si&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===pt&&i.strm.avail_in===0&&r===n?1:0,lo(i,i.block_start,r,s),i.block_start+=r,rt(i.strm)),s?Ki:He)},Fs=(i,e)=>{let t,r;for(;;){if(i.lookahead<Ct){if($r(i),i.lookahead<Ct&&e===si)return He;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=oi(i,i.ins_h,i.window[i.strstart+te-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-Ct&&(i.match_length=mu(i,t)),i.match_length>=te)if(r=ai(i,i.strstart-i.match_start,i.match_length-te),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=te){i.match_length--;do i.strstart++,i.ins_h=oi(i,i.ins_h,i.window[i.strstart+te-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=oi(i,i.ins_h,i.window[i.strstart+1]);else r=ai(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(at(i,!1),i.strm.avail_out===0))return He}return i.insert=i.strstart<te-1?i.strstart:te-1,e===pt?(at(i,!0),i.strm.avail_out===0?Ki:Nr):i.sym_next&&(at(i,!1),i.strm.avail_out===0)?He:Rr},hr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<Ct){if($r(i),i.lookahead<Ct&&e===si)return He;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=oi(i,i.ins_h,i.window[i.strstart+te-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=te-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-Ct&&(i.match_length=mu(i,t),i.match_length<=5&&(i.strategy===ch||i.match_length===te&&i.strstart-i.match_start>4096)&&(i.match_length=te-1)),i.prev_length>=te&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-te,r=ai(i,i.strstart-1-i.prev_match,i.prev_length-te),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=oi(i,i.ins_h,i.window[i.strstart+te-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=te-1,i.strstart++,r&&(at(i,!1),i.strm.avail_out===0))return He}else if(i.match_available){if(r=ai(i,0,i.window[i.strstart-1]),r&&at(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return He}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=ai(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<te-1?i.strstart:te-1,e===pt?(at(i,!0),i.strm.avail_out===0?Ki:Nr):i.sym_next&&(at(i,!1),i.strm.avail_out===0)?He:Rr},Ah=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=ti){if($r(i),i.lookahead<=ti&&e===si)return He;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=te&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+ti;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=ti-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=te?(t=ai(i,1,i.match_length-te),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=ai(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(at(i,!1),i.strm.avail_out===0))return He}return i.insert=0,e===pt?(at(i,!0),i.strm.avail_out===0?Ki:Nr):i.sym_next&&(at(i,!1),i.strm.avail_out===0)?He:Rr},kh=(i,e)=>{let t;for(;;){if(i.lookahead===0&&($r(i),i.lookahead===0)){if(e===si)return He;break}if(i.match_length=0,t=ai(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(at(i,!1),i.strm.avail_out===0))return He}return i.insert=0,e===pt?(at(i,!0),i.strm.avail_out===0?Ki:Nr):i.sym_next&&(at(i,!1),i.strm.avail_out===0)?He:Rr};function wt(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 dn=[new wt(0,0,0,0,yu),new wt(4,4,8,4,Fs),new wt(4,5,16,8,Fs),new wt(4,6,32,32,Fs),new wt(4,4,16,16,hr),new wt(8,16,32,32,hr),new wt(8,16,128,128,hr),new wt(8,32,128,256,hr),new wt(32,128,258,1024,hr),new wt(32,258,258,4096,hr)],Ih=i=>{i.window_size=2*i.w_size,ei(i.head),i.max_lazy_match=dn[i.level].max_lazy,i.good_match=dn[i.level].good_length,i.nice_match=dn[i.level].nice_length,i.max_chain_length=dn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=te-1,i.match_available=0,i.ins_h=0};function Th(){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=ns,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(wh*2),this.dyn_dtree=new Uint16Array((2*vh+1)*2),this.bl_tree=new Uint16Array((2*bh+1)*2),ei(this.dyn_ltree),ei(this.dyn_dtree),ei(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Sh+1),this.heap=new Uint16Array(2*uo+1),ei(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*uo+1),ei(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 Mn=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==Er&&e.status!==To&&e.status!==po&&e.status!==ho&&e.status!==fo&&e.status!==go&&e.status!==Ui&&e.status!==un?1:0},vu=i=>{if(Mn(i))return Mi(i,Tt);i.total_in=i.total_out=0,i.data_type=ph;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?To:e.wrap?Er:Ui,i.adler=e.wrap===2?0:1,e.last_flush=-2,th(e),Pe},bu=i=>{let e=vu(i);return e===Pe&&Ih(i.state),e},Ch=(i,e)=>Mn(i)||i.state.wrap!==2?Tt:(i.state.gzhead=e,Pe),wu=(i,e,t,r,n,a)=>{if(!i)return Tt;let s=1;if(e===oh&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>hh||t!==ns||r<8||r>15||e<0||e>9||a<0||a>uh||r===8&&s!==1)return Mi(i,Tt);r===8&&(r=9);let o=new Th;return i.state=o,o.strm=i,o.status=Er,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+te-1)/te),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,bu(i)},Lh=(i,e)=>wu(i,e,ns,fh,gh,dh),Ph=(i,e)=>{if(Mn(i)||e>Oc||e<0)return i?Mi(i,Tt):Tt;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===un&&e!==pt)return Mi(i,i.avail_out===0?Ms:Tt);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(rt(i),i.avail_out===0)return t.last_flush=-1,Pe}else if(i.avail_in===0&&Uc(e)<=Uc(r)&&e!==pt)return Mi(i,Ms);if(t.status===un&&i.avail_in!==0)return Mi(i,Ms);if(t.status===Er&&t.wrap===0&&(t.status=Ui),t.status===Er){let n=ns+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=oa||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=_h),n+=31-n%31,Kr(t,n),t.strstart!==0&&(Kr(t,i.adler>>>16),Kr(t,i.adler&65535)),i.adler=1,t.status=Ui,rt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===To){if(i.adler=0,se(t,31),se(t,139),se(t,8),t.gzhead)se(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)),se(t,t.gzhead.time&255),se(t,t.gzhead.time>>8&255),se(t,t.gzhead.time>>16&255),se(t,t.gzhead.time>>24&255),se(t,t.level===9?2:t.strategy>=oa||t.level<2?4:0),se(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(se(t,t.gzhead.extra.length&255),se(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=Ie(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=po;else if(se(t,0),se(t,0),se(t,0),se(t,0),se(t,0),se(t,t.level===9?2:t.strategy>=oa||t.level<2?4:0),se(t,xh),t.status=Ui,rt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===po){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=Ie(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,rt(i),t.pending!==0)return t.last_flush=-1,Pe;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=Ie(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ho}if(t.status===ho){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=Ie(i.adler,t.pending_buf,t.pending-n,n)),rt(i),t.pending!==0)return t.last_flush=-1,Pe;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,se(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ie(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=fo}if(t.status===fo){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=Ie(i.adler,t.pending_buf,t.pending-n,n)),rt(i),t.pending!==0)return t.last_flush=-1,Pe;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,se(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ie(i.adler,t.pending_buf,t.pending-n,n))}t.status=go}if(t.status===go){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(rt(i),t.pending!==0))return t.last_flush=-1,Pe;se(t,i.adler&255),se(t,i.adler>>8&255),i.adler=0}if(t.status=Ui,rt(i),t.pending!==0)return t.last_flush=-1,Pe}if(i.avail_in!==0||t.lookahead!==0||e!==si&&t.status!==un){let n=t.level===0?yu(t,e):t.strategy===oa?kh(t,e):t.strategy===lh?Ah(t,e):dn[t.level].func(t,e);if((n===Ki||n===Nr)&&(t.status=un),n===He||n===Ki)return i.avail_out===0&&(t.last_flush=-1),Pe;if(n===Rr&&(e===nh?rh(t):e!==Oc&&(lo(t,0,0,!1),e===ah&&(ei(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),rt(i),i.avail_out===0))return t.last_flush=-1,Pe}return e!==pt?Pe:t.wrap<=0?Dc:(t.wrap===2?(se(t,i.adler&255),se(t,i.adler>>8&255),se(t,i.adler>>16&255),se(t,i.adler>>24&255),se(t,i.total_in&255),se(t,i.total_in>>8&255),se(t,i.total_in>>16&255),se(t,i.total_in>>24&255)):(Kr(t,i.adler>>>16),Kr(t,i.adler&65535)),rt(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Pe:Dc)},Rh=i=>{if(Mn(i))return Tt;let e=i.state.status;return i.state=null,e===Ui?Mi(i,sh):Pe},Nh=(i,e)=>{let t=e.length;if(Mn(i))return Tt;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==Er||r.lookahead)return Tt;if(n===1&&(i.adler=Cn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(ei(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(t-r.w_size,t),0),e=l,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,$r(r);r.lookahead>=te;){let l=r.strstart,c=r.lookahead-(te-1);do r.ins_h=oi(r,r.ins_h,r.window[l+te-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=te-1,$r(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=te-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Pe},Oh=Lh,Dh=wu,Uh=bu,Mh=vu,Fh=Ch,jh=Ph,Bh=Rh,Hh=Nh,qh="pako deflate (from Nodeca project)",bn={deflateInit:Oh,deflateInit2:Dh,deflateReset:Uh,deflateResetKeep:Mh,deflateSetHeader:Fh,deflate:jh,deflateEnd:Bh,deflateSetDictionary:Hh,deflateInfo:qh},zh=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),Vh=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)zh(t,r)&&(i[r]=t[r])}}return i},Wh=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},as={assign:Vh,flattenChunks:Wh},Su=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){Su=!1}var Ln=new Uint8Array(256);for(let i=0;i<256;i++)Ln[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Ln[254]=Ln[254]=1;var Kh=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},Qh=(i,e)=>{if(e<65534&&i.subarray&&Su)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},Gh=(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=Ln[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 Qh(a,n)},Zh=(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+Ln[i[t]]>e?t:e},Pn={string2buf:Kh,buf2string:Gh,utf8border:Zh};function Jh(){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 _u=Jh,xu=Object.prototype.toString,{Z_NO_FLUSH:Yh,Z_SYNC_FLUSH:Xh,Z_FULL_FLUSH:ef,Z_FINISH:tf,Z_OK:qa,Z_STREAM_END:rf,Z_DEFAULT_COMPRESSION:nf,Z_DEFAULT_STRATEGY:af,Z_DEFLATED:sf}=tr;function Fn(i){this.options=as.assign({level:nf,method:sf,chunkSize:16384,windowBits:15,memLevel:8,strategy:af},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 _u,this.strm.avail_out=0;let t=bn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==qa)throw new Error(Wi[t]);if(e.header&&bn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Pn.string2buf(e.dictionary):xu.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=bn.deflateSetDictionary(this.strm,r),t!==qa)throw new Error(Wi[t]);this._dict_set=!0}}Fn.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?tf:Yh,typeof i=="string"?t.input=Pn.string2buf(i):xu.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===Xh||a===ef)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=bn.deflate(t,a),n===rf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=bn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===qa;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};Fn.prototype.onData=function(i){this.chunks.push(i)};Fn.prototype.onEnd=function(i){i===qa&&(this.result=as.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Co(i,e){let t=new Fn(e);if(t.push(i,!0),t.err)throw t.msg||Wi[t.err];return t.result}function of(i,e){return e=e||{},e.raw=!0,Co(i,e)}function cf(i,e){return e=e||{},e.gzip=!0,Co(i,e)}var lf=Fn,uf=Co,df=of,pf=cf,hf=tr,ff={Deflate:lf,deflate:uf,deflateRaw:df,gzip:pf,constants:hf},ca=16209,gf=16191,mf=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,h,g,_,E,A,I,w,L,U,P,G,V,R,W=e.state;r=e.next_in,V=e.input,n=r+(e.avail_in-5),a=e.next_out,R=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=W.dmax,c=W.wsize,u=W.whave,m=W.wnext,y=W.window,d=W.hold,h=W.bits,g=W.lencode,_=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{h<15&&(d+=V[r++]<<h,h+=8,d+=V[r++]<<h,h+=8),I=g[d&E];t:for(;;){if(w=I>>>24,d>>>=w,h-=w,w=I>>>16&255,w===0)R[a++]=I&65535;else if(w&16){L=I&65535,w&=15,w&&(h<w&&(d+=V[r++]<<h,h+=8),L+=d&(1<<w)-1,d>>>=w,h-=w),h<15&&(d+=V[r++]<<h,h+=8,d+=V[r++]<<h,h+=8),I=_[d&A];i:for(;;){if(w=I>>>24,d>>>=w,h-=w,w=I>>>16&255,w&16){if(U=I&65535,w&=15,h<w&&(d+=V[r++]<<h,h+=8,h<w&&(d+=V[r++]<<h,h+=8)),U+=d&(1<<w)-1,U>l){e.msg="invalid distance too far back",W.mode=ca;break e}if(d>>>=w,h-=w,w=a-s,U>w){if(w=U-w,w>u&&W.sane){e.msg="invalid distance too far back",W.mode=ca;break e}if(P=0,G=y,m===0){if(P+=c-w,w<L){L-=w;do R[a++]=y[P++];while(--w);P=a-U,G=R}}else if(m<w){if(P+=c+m-w,w-=m,w<L){L-=w;do R[a++]=y[P++];while(--w);if(P=0,m<L){w=m,L-=w;do R[a++]=y[P++];while(--w);P=a-U,G=R}}}else if(P+=m-w,w<L){L-=w;do R[a++]=y[P++];while(--w);P=a-U,G=R}for(;L>2;)R[a++]=G[P++],R[a++]=G[P++],R[a++]=G[P++],L-=3;L&&(R[a++]=G[P++],L>1&&(R[a++]=G[P++]))}else{P=a-U;do R[a++]=R[P++],R[a++]=R[P++],R[a++]=R[P++],L-=3;while(L>2);L&&(R[a++]=R[P++],L>1&&(R[a++]=R[P++]))}}else if((w&64)===0){I=_[(I&65535)+(d&(1<<w)-1)];continue i}else{e.msg="invalid distance code",W.mode=ca;break e}break}}else if((w&64)===0){I=g[(I&65535)+(d&(1<<w)-1)];continue t}else if(w&32){W.mode=gf;break e}else{e.msg="invalid literal/length code",W.mode=ca;break e}break}}while(r<n&&a<o);L=h>>3,r-=L,h-=L<<3,d&=(1<<h)-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),W.hold=d,W.bits=h},fr=15,Mc=852,Fc=592,jc=0,js=1,Bc=2,yf=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]),vf=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]),bf=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]),wf=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]),Sf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,h=0,g=0,_=0,E=0,A=0,I,w,L,U,P,G=null,V,R=new Uint16Array(fr+1),W=new Uint16Array(fr+1),Ke=null,Dr,T,Hn;for(c=0;c<=fr;c++)R[c]=0;for(u=0;u<r;u++)R[e[t+u]]++;for(d=l,y=fr;y>=1&&R[y]===0;y--);if(d>y&&(d=y),y===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<y&&R[m]===0;m++);for(d<m&&(d=m),_=1,c=1;c<=fr;c++)if(_<<=1,_-=R[c],_<0)return-1;if(_>0&&(i===jc||y!==1))return-1;for(W[1]=0,c=1;c<fr;c++)W[c+1]=W[c]+R[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[W[e[t+u]]++]=u);if(i===jc?(G=Ke=s,V=20):i===js?(G=yf,Ke=vf,V=257):(G=bf,Ke=wf,V=0),A=0,u=0,c=m,P=a,h=d,g=0,L=-1,E=1<<d,U=E-1,i===js&&E>Mc||i===Bc&&E>Fc)return 1;for(;;){Dr=c-g,s[u]+1<V?(T=0,Hn=s[u]):s[u]>=V?(T=Ke[s[u]-V],Hn=G[s[u]-V]):(T=32+64,Hn=0),I=1<<c-g,w=1<<h,m=w;do w-=I,n[P+(A>>g)+w]=Dr<<24|T<<16|Hn|0;while(w!==0);for(I=1<<c-1;A&I;)I>>=1;if(I!==0?(A&=I-1,A+=I):A=0,u++,--R[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&U)!==L){for(g===0&&(g=d),P+=m,h=c-g,_=1<<h;h+g<y&&(_-=R[h+g],!(_<=0));)h++,_<<=1;if(E+=1<<h,i===js&&E>Mc||i===Bc&&E>Fc)return 1;L=A&U,n[L]=d<<24|h<<16|P-a|0}}return A!==0&&(n[P+A]=c-g<<24|64<<16|0),o.bits=d,0},wn=Sf,_f=0,Eu=1,$u=2,{Z_FINISH:Hc,Z_BLOCK:xf,Z_TREES:la,Z_OK:Qi,Z_STREAM_END:Ef,Z_NEED_DICT:$f,Z_STREAM_ERROR:ft,Z_DATA_ERROR:Au,Z_MEM_ERROR:ku,Z_BUF_ERROR:Af,Z_DEFLATED:qc}=tr,ss=16180,zc=16181,Vc=16182,Wc=16183,Kc=16184,Qc=16185,Gc=16186,Zc=16187,Jc=16188,Yc=16189,za=16190,Dt=16191,Bs=16192,Xc=16193,Hs=16194,el=16195,tl=16196,il=16197,rl=16198,ua=16199,da=16200,nl=16201,al=16202,sl=16203,ol=16204,cl=16205,qs=16206,ll=16207,ul=16208,he=16209,Iu=16210,Tu=16211,kf=852,If=592,Tf=15,Cf=Tf,dl=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Lf(){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 ir=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<ss||e.mode>Tu?1:0},Cu=i=>{if(ir(i))return ft;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=ss,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(kf),e.distcode=e.distdyn=new Int32Array(If),e.sane=1,e.back=-1,Qi},Lu=i=>{if(ir(i))return ft;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,Cu(i)},Pu=(i,e)=>{let t;if(ir(i))return ft;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?ft:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,Lu(i))},Ru=(i,e)=>{if(!i)return ft;let t=new Lf;i.state=t,t.strm=i,t.window=null,t.mode=ss;let r=Pu(i,e);return r!==Qi&&(i.state=null),r},Pf=i=>Ru(i,Cf),pl=!0,zs,Vs,Rf=i=>{if(pl){zs=new Int32Array(512),Vs=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(wn(Eu,i.lens,0,288,zs,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;wn($u,i.lens,0,32,Vs,0,i.work,{bits:5}),pl=!1}i.lencode=zs,i.lenbits=9,i.distcode=Vs,i.distbits=5},Nu=(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},Nf=(i,e)=>{let t,r,n,a,s,o,l,c,u,m,y,d,h,g,_=0,E,A,I,w,L,U,P,G,V=new Uint8Array(4),R,W,Ke=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ir(i)||!i.output||!i.input&&i.avail_in!==0)return ft;t=i.state,t.mode===Dt&&(t.mode=Bs),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,m=o,y=l,G=Qi;e:for(;;)switch(t.mode){case ss:if(t.wrap===0){t.mode=Bs;break}for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,V[0]=c&255,V[1]=c>>>8&255,t.check=Ie(t.check,V,2,0),c=0,u=0,t.mode=zc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=he;break}if((c&15)!==qc){i.msg="unknown compression method",t.mode=he;break}if(c>>>=4,u-=4,P=(c&15)+8,t.wbits===0&&(t.wbits=P),P>15||P>t.wbits){i.msg="invalid window size",t.mode=he;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Yc:Dt,c=0,u=0;break;case zc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==qc){i.msg="unknown compression method",t.mode=he;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=he;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=Ie(t.check,V,2,0)),c=0,u=0,t.mode=Vc;case Vc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,V[2]=c>>>16&255,V[3]=c>>>24&255,t.check=Ie(t.check,V,4,0)),c=0,u=0,t.mode=Wc;case Wc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=Ie(t.check,V,2,0)),c=0,u=0,t.mode=Kc;case Kc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=Ie(t.check,V,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Qc;case Qc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(P=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),P)),t.flags&512&&t.wrap&4&&(t.check=Ie(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Gc;case Gc:if(t.flags&2048){if(o===0)break e;d=0;do P=r[a+d++],t.head&&P&&t.length<65536&&(t.head.name+=String.fromCharCode(P));while(P&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ie(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Zc;case Zc:if(t.flags&4096){if(o===0)break e;d=0;do P=r[a+d++],t.head&&P&&t.length<65536&&(t.head.comment+=String.fromCharCode(P));while(P&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ie(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.comment=null);t.mode=Jc;case Jc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=he;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Dt;break;case Yc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=dl(c),c=0,u=0,t.mode=za;case za:if(t.havedict===0)return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,$f;i.adler=t.check=1,t.mode=Dt;case Dt:if(e===xf||e===la)break e;case Bs:if(t.last){c>>>=u&7,u-=u&7,t.mode=qs;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=Xc;break;case 1:if(Rf(t),t.mode=ua,e===la){c>>>=2,u-=2;break e}break;case 2:t.mode=tl;break;case 3:i.msg="invalid block type",t.mode=he}c>>>=2,u-=2;break;case Xc:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=he;break}if(t.length=c&65535,c=0,u=0,t.mode=Hs,e===la)break e;case Hs:t.mode=el;case el:if(d=t.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,t.length-=d;break}t.mode=Dt;break;case tl:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=4,u-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=he;break}t.have=0,t.mode=il;case il:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[Ke[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[Ke[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},G=wn(_f,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,G){i.msg="invalid code lengths set",t.mode=he;break}t.have=0,t.mode=rl;case rl:for(;t.have<t.nlen+t.ndist;){for(;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,I=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(I<16)c>>>=E,u-=E,t.lens[t.have++]=I;else{if(I===16){for(W=E+2;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=he;break}P=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(I===17){for(W=E+3;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,P=0,d=3+(c&7),c>>>=3,u-=3}else{for(W=E+7;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,P=0,d=11+(c&127),c>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=he;break}for(;d--;)t.lens[t.have++]=P}}if(t.mode===he)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=he;break}if(t.lenbits=9,R={bits:t.lenbits},G=wn(Eu,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,G){i.msg="invalid literal/lengths set",t.mode=he;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},G=wn($u,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,G){i.msg="invalid distances set",t.mode=he;break}if(t.mode=ua,e===la)break e;case ua:t.mode=da;case da:if(o>=6&&l>=258){i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,mf(i,y),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,t.mode===Dt&&(t.back=-1);break}for(t.back=0;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,I=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(w=E,L=A,U=I;_=t.lencode[U+((c&(1<<w+L)-1)>>w)],E=_>>>24,A=_>>>16&255,I=_&65535,!(w+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=w,u-=w,t.back+=w}if(c>>>=E,u-=E,t.back+=E,t.length=I,A===0){t.mode=cl;break}if(A&32){t.back=-1,t.mode=Dt;break}if(A&64){i.msg="invalid literal/length code",t.mode=he;break}t.extra=A&15,t.mode=nl;case nl:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=al;case al:for(;_=t.distcode[c&(1<<t.distbits)-1],E=_>>>24,A=_>>>16&255,I=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(w=E,L=A,U=I;_=t.distcode[U+((c&(1<<w+L)-1)>>w)],E=_>>>24,A=_>>>16&255,I=_&65535,!(w+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=w,u-=w,t.back+=w}if(c>>>=E,u-=E,t.back+=E,A&64){i.msg="invalid distance code",t.mode=he;break}t.offset=I,t.extra=A&15,t.mode=sl;case sl:if(t.extra){for(W=t.extra;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=he;break}t.mode=ol;case ol:if(l===0)break e;if(d=y-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=he;break}d>t.wnext?(d-=t.wnext,h=t.wsize-d):h=t.wnext-d,d>t.length&&(d=t.length),g=t.window}else g=n,h=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=g[h++];while(--d);t.length===0&&(t.mode=da);break;case cl:if(l===0)break e;n[s++]=t.length,l--,t.mode=da;break;case qs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(y-=l,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?Ie(t.check,n,y,s-y):Cn(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:dl(c))!==t.check){i.msg="incorrect data check",t.mode=he;break}c=0,u=0}t.mode=ll;case ll:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=he;break}c=0,u=0}t.mode=ul;case ul:G=Ef;break e;case he:G=Au;break e;case Iu:return ku;case Tu:default:return ft}return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,(t.wsize||y!==i.avail_out&&t.mode<he&&(t.mode<qs||e!==Hc))&&Nu(i,i.output,i.next_out,y-i.avail_out),m-=i.avail_in,y-=i.avail_out,i.total_in+=m,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?Ie(t.check,n,y,i.next_out-y):Cn(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Dt?128:0)+(t.mode===ua||t.mode===Hs?256:0),(m===0&&y===0||e===Hc)&&G===Qi&&(G=Af),G},Of=i=>{if(ir(i))return ft;let e=i.state;return e.window&&(e.window=null),i.state=null,Qi},Df=(i,e)=>{if(ir(i))return ft;let t=i.state;return(t.wrap&2)===0?ft:(t.head=e,e.done=!1,Qi)},Uf=(i,e)=>{let t=e.length,r,n,a;return ir(i)||(r=i.state,r.wrap!==0&&r.mode!==za)?ft:r.mode===za&&(n=1,n=Cn(n,e,t,0),n!==r.check)?Au:(a=Nu(i,e,t,t),a?(r.mode=Iu,ku):(r.havedict=1,Qi))},Mf=Lu,Ff=Pu,jf=Cu,Bf=Pf,Hf=Ru,qf=Nf,zf=Of,Vf=Df,Wf=Uf,Kf="pako inflate (from Nodeca project)",Bt={inflateReset:Mf,inflateReset2:Ff,inflateResetKeep:jf,inflateInit:Bf,inflateInit2:Hf,inflate:qf,inflateEnd:zf,inflateGetHeader:Vf,inflateSetDictionary:Wf,inflateInfo:Kf};function Qf(){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 Gf=Qf,Ou=Object.prototype.toString,{Z_NO_FLUSH:Zf,Z_FINISH:Jf,Z_OK:Rn,Z_STREAM_END:Ws,Z_NEED_DICT:Ks,Z_STREAM_ERROR:Yf,Z_DATA_ERROR:hl,Z_MEM_ERROR:Xf}=tr;function jn(i){this.options=as.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 _u,this.strm.avail_out=0;let t=Bt.inflateInit2(this.strm,e.windowBits);if(t!==Rn)throw new Error(Wi[t]);if(this.header=new Gf,Bt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Pn.string2buf(e.dictionary):Ou.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Bt.inflateSetDictionary(this.strm,e.dictionary),t!==Rn)))throw new Error(Wi[t])}jn.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?Jf:Zf,Ou.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=Bt.inflate(t,s),a===Ks&&n&&(a=Bt.inflateSetDictionary(t,n),a===Rn?a=Bt.inflate(t,s):a===hl&&(a=Ks));t.avail_in>0&&a===Ws&&t.state.wrap>0&&i[t.next_in]!==0;)Bt.inflateReset(t),a=Bt.inflate(t,s);switch(a){case Yf:case hl:case Ks:case Xf:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Ws))if(this.options.to==="string"){let l=Pn.utf8border(t.output,t.next_out),c=t.next_out-l,u=Pn.buf2string(t.output,l);t.next_out=c,t.avail_out=r-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===Rn&&o===0)){if(a===Ws)return a=Bt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};jn.prototype.onData=function(i){this.chunks.push(i)};jn.prototype.onEnd=function(i){i===Rn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=as.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Lo(i,e){let t=new jn(e);if(t.push(i),t.err)throw t.msg||Wi[t.err];return t.result}function eg(i,e){return e=e||{},e.raw=!0,Lo(i,e)}var tg=jn,ig=Lo,rg=eg,ng=Lo,ag=tr,sg={Inflate:tg,inflate:ig,inflateRaw:rg,ungzip:ng,constants:ag},{Deflate:og,deflate:cg,deflateRaw:lg,gzip:ug}=ff,{Inflate:dg,inflate:pg,inflateRaw:hg,ungzip:fg}=sg,gg=og,mg=cg,yg=lg,vg=ug,bg=dg,wg=pg,Sg=hg,_g=fg,xg=tr,Eg={Deflate:gg,deflate:mg,deflateRaw:yg,gzip:vg,Inflate:bg,inflate:wg,inflateRaw:Sg,ungzip:_g,constants:xg},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},de=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Va=class{constructor(e,t){this.input=e,this.output=t}};ue([f(),de("design:type",String)],Va.prototype,"input",void 0);ue([f(),de("design:type",String)],Va.prototype,"output",void 0);Va=ue([Ce(),de("design:paramtypes",[String,String])],Va);var Wa=class{constructor(e,t){this.input=e,this.output=t}};ue([f(),de("design:type",String)],Wa.prototype,"input",void 0);ue([f(),de("design:type",String)],Wa.prototype,"output",void 0);Wa=ue([q(),de("design:paramtypes",[String,String])],Wa);var di=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ue([f(),de("design:type",String)],di.prototype,"name",void 0);ue([f(),de("design:type",String)],di.prototype,"modelId",void 0);ue([f(),de("design:type",String)],di.prototype,"systemPrompt",void 0);ue([f(),de("design:type",Array)],di.prototype,"promptExamples",void 0);ue([f(),de("design:type",String)],di.prototype,"metaData",void 0);di=ue([Ce(),de("design:paramtypes",[String,String,String,Array,String])],di);var Rt=class{constructor(e,t,r,n,a,s,o,l){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=l}};ue([f(),de("design:type",String)],Rt.prototype,"name",void 0);ue([f(),de("design:type",String)],Rt.prototype,"modelId",void 0);ue([f(),de("design:type",String)],Rt.prototype,"taskId",void 0);ue([f(),de("design:type",String)],Rt.prototype,"systemPrompt",void 0);ue([f(),de("design:type",Array)],Rt.prototype,"promptExamples",void 0);ue([f(),de("design:type",String)],Rt.prototype,"metaData",void 0);ue([f(),de("design:type",String)],Rt.prototype,"createdAt",void 0);ue([f(),de("design:type",String)],Rt.prototype,"updatedAt",void 0);Rt=ue([q(),de("design:paramtypes",[String,String,String,String,Array,String,String,String])],Rt);var Gi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ue([f(),de("design:type",String)],Gi.prototype,"model",void 0);ue([f(),de("design:type",String)],Gi.prototype,"status",void 0);ue([f(),de("design:type",Number)],Gi.prototype,"progress",void 0);ue([f(),de("design:type",Boolean)],Gi.prototype,"downloaded",void 0);ue([f(),de("design:type",Boolean)],Gi.prototype,"loaded",void 0);Gi=ue([q(),de("design:paramtypes",[String,String,Number,Boolean,Boolean])],Gi);var $g=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)},_e,Aa,yo=class{constructor(e,t=!0){_e.set(this,void 0),Aa.set(this,new Map),$g(this,_e,e,"f")}async getModels(){let e=await Ae(this,_e,"f").query({query:v`
1185
1258
  query {
1186
1259
  aiGetModels {
1187
1260
  id
@@ -1205,23 +1278,23 @@ triggerMatch
1205
1278
  modelType
1206
1279
  }
1207
1280
  }
1208
- `});return w(e).aiGetModels}async addModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
1281
+ `});return b(e).aiGetModels}async addModel(e){let t=await Ae(this,_e,"f").mutate({mutation:v`
1209
1282
  mutation($model: ModelInput!) {
1210
1283
  aiAddModel(model: $model)
1211
1284
  }
1212
- `,variables:{model:e}});return w(t).aiAddModel}async updateModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
1285
+ `,variables:{model:e}});return b(t).aiAddModel}async updateModel(e,t){let r=await Ae(this,_e,"f").mutate({mutation:v`
1213
1286
  mutation($modelId: String!, $model: ModelInput!) {
1214
1287
  aiUpdateModel(modelId: $modelId, model: $model)
1215
1288
  }
1216
- `,variables:{modelId:e,model:t}});return w(r).aiUpdateModel}async removeModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
1289
+ `,variables:{modelId:e,model:t}});return b(r).aiUpdateModel}async removeModel(e){let t=await Ae(this,_e,"f").mutate({mutation:v`
1217
1290
  mutation($modelId: String!) {
1218
1291
  aiRemoveModel(modelId: $modelId)
1219
1292
  }
1220
- `,variables:{modelId:e}});return w(t).aiRemoveModel}async setDefaultModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
1293
+ `,variables:{modelId:e}});return b(t).aiRemoveModel}async setDefaultModel(e,t){let r=await Ae(this,_e,"f").mutate({mutation:v`
1221
1294
  mutation($modelType: ModelType!, $modelId: String!) {
1222
1295
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
1223
1296
  }
1224
- `,variables:{modelId:t,modelType:e}});return w(r).aiSetDefaultModel}async getDefaultModel(e){let t=await Se(this,be,"f").query({query:v`
1297
+ `,variables:{modelId:t,modelType:e}});return b(r).aiSetDefaultModel}async getDefaultModel(e){let t=await Ae(this,_e,"f").query({query:v`
1225
1298
  query($modelType: ModelType!) {
1226
1299
  aiGetDefaultModel(modelType: $modelType) {
1227
1300
  id
@@ -1245,7 +1318,7 @@ triggerMatch
1245
1318
  modelType
1246
1319
  }
1247
1320
  }
1248
- `,variables:{modelType:e}});return w(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=w(await Se(this,be,"f").query({query:v`
1321
+ `,variables:{modelType:e}});return b(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=b(await Ae(this,_e,"f").query({query:v`
1249
1322
  query {
1250
1323
  aiTasks {
1251
1324
  name
@@ -1261,7 +1334,7 @@ triggerMatch
1261
1334
  updatedAt
1262
1335
  }
1263
1336
  }
1264
- `}));return e}async addTask(e,t,r,n,a){let s=new ni(e,t,r,n,a),{aiAddTask:o}=w(await Se(this,be,"f").mutate({mutation:v`
1337
+ `}));return e}async addTask(e,t,r,n,a){let s=new di(e,t,r,n,a),{aiAddTask:o}=b(await Ae(this,_e,"f").mutate({mutation:v`
1265
1338
  mutation AiAddTask($task: AITaskInput!) {
1266
1339
  aiAddTask(task: $task) {
1267
1340
  name
@@ -1277,7 +1350,7 @@ triggerMatch
1277
1350
  updatedAt
1278
1351
  }
1279
1352
  }
1280
- `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=w(await Se(this,be,"f").mutate({mutation:v`
1353
+ `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=b(await Ae(this,_e,"f").mutate({mutation:v`
1281
1354
  mutation AiRemoveTask($taskId: String!) {
1282
1355
  aiRemoveTask(taskId: $taskId) {
1283
1356
  name
@@ -1293,7 +1366,7 @@ triggerMatch
1293
1366
  updatedAt
1294
1367
  }
1295
1368
  }
1296
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=w(await Se(this,be,"f").mutate({mutation:v`
1369
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
1297
1370
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
1298
1371
  aiUpdateTask(taskId: $taskId, task: $task) {
1299
1372
  name
@@ -1309,7 +1382,7 @@ triggerMatch
1309
1382
  updatedAt
1310
1383
  }
1311
1384
  }
1312
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=w(await Se(this,be,"f").query({query:v`
1385
+ `,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 Ae(this,_e,"f").query({query:v`
1313
1386
  query AiModelLoadingStatus($model: String!) {
1314
1387
  aiModelLoadingStatus(model: $model) {
1315
1388
  model
@@ -1319,30 +1392,30 @@ triggerMatch
1319
1392
  downloaded
1320
1393
  }
1321
1394
  }
1322
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=w(await Se(this,be,"f").mutate({mutation:v`
1395
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
1323
1396
  mutation AiPrompt($taskId: String!, $prompt: String!) {
1324
1397
  aiPrompt(taskId: $taskId, prompt: $prompt)
1325
1398
  }
1326
- `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=w(await Se(this,be,"f").mutate({mutation:v`
1399
+ `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
1327
1400
  mutation aiEmbed($modelId: String!, $text: String!) {
1328
1401
  aiEmbed(modelId: $modelId, text: $text)
1329
1402
  }
1330
- `,variables:{modelId:e,text:t}})),n=Ga.toByteArray(r);return JSON.parse(ig.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=w(await Se(this,be,"f").mutate({mutation:v`
1403
+ `,variables:{modelId:e,text:t}})),n=rs.toByteArray(r);return JSON.parse(Eg.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=b(await Ae(this,_e,"f").mutate({mutation:v`
1331
1404
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
1332
1405
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
1333
1406
  }
1334
- `,variables:{modelId:e,params:r}})),a=Se(this,be,"f").subscribe({query:v` subscription {
1407
+ `,variables:{modelId:e,params:r}})),a=Ae(this,_e,"f").subscribe({query:v` subscription {
1335
1408
  aiTranscriptionText(streamId: "${n}")
1336
- }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return Se(this,va,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=w(await Se(this,be,"f").mutate({mutation:v`
1409
+ }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return Ae(this,Aa,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=b(await Ae(this,_e,"f").mutate({mutation:v`
1337
1410
  mutation aiCloseTranscriptionStream($streamId: String!) {
1338
1411
  aiCloseTranscriptionStream(streamId: $streamId)
1339
1412
  }
1340
- `,variables:{streamId:e}})),r=Se(this,va,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=w(await Se(this,be,"f").mutate({mutation:v`
1413
+ `,variables:{streamId:e}})),r=Ae(this,Aa,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
1341
1414
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
1342
1415
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
1343
1416
  }
1344
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};be=new WeakMap,va=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)},bt,ba,an,wa,sn,$i,Sa,on,Jc=class{constructor(e,t=!0){bt.set(this,void 0),ba.set(this,void 0),an.set(this,void 0),wa.set(this,void 0),sn.set(this,void 0),$i.set(this,void 0),Sa.set(this,void 0),on.set(this,void 0),Vt(this,bt,e,"f"),Vt(this,ba,new vn(ve(this,bt,"f"),t),"f"),Vt(this,an,new Zs(ve(this,bt,"f")),"f"),Vt(this,wa,new Ks(ve(this,bt,"f")),"f"),Vt(this,sn,new Qs(ve(this,bt,"f")),"f"),Vt(this,on,new so(ve(this,bt,"f"),t),"f"),Vt(this,$i,new Ra(ve(this,bt,"f"),t),"f"),ve(this,$i,"f").setExpressionClient(ve(this,an,"f")),ve(this,$i,"f").setNeighbourhoodClient(ve(this,sn,"f")),ve(this,$i,"f").setAIClient(ve(this,on,"f")),Vt(this,Sa,new Gs(ve(this,bt,"f"),t),"f")}get agent(){return ve(this,ba,"f")}get expression(){return ve(this,an,"f")}get languages(){return ve(this,wa,"f")}get neighbourhood(){return ve(this,sn,"f")}get perspective(){return ve(this,$i,"f")}get runtime(){return ve(this,Sa,"f")}get ai(){return ve(this,on,"f")}};bt=new WeakMap,ba=new WeakMap,an=new WeakMap,wa=new WeakMap,sn=new WeakMap,$i=new WeakMap,Sa=new WeakMap,on=new WeakMap;var oo;(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"})(oo||(oo={}));var _o=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},Eo=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}};_o([h(),Eo("design:type",Et)],Li.prototype,"language",void 0);_o([h(),Eo("design:type",String)],Li.prototype,"expression",void 0);Li=_o([F(),Eo("design:paramtypes",[Et,String])],Li);function r0(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function n0(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 rt=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},Ct=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fa=class{};rt([h(),Ct("design:type",String)],Fa.prototype,"name",void 0);rt([h(),Ct("design:type",String)],Fa.prototype,"type",void 0);Fa=rt([F()],Fa);var kn=class{};rt([h(),Ct("design:type",String)],kn.prototype,"label",void 0);rt([h(),Ct("design:type",String)],kn.prototype,"name",void 0);rt([h(),Ct("design:type",Array)],kn.prototype,"parameters",void 0);kn=rt([F()],kn);var ja=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};rt([h(),Ct("design:type",String)],ja.prototype,"name",void 0);rt([h(),Ct("design:type",String)],ja.prototype,"parametersStringified",void 0);ja=rt([Ae(),Ct("design:paramtypes",[String,Object])],ja);var Ba=class{};rt([h(),Ct("design:type",String)],Ba.prototype,"did",void 0);rt([h(),Ct("design:type",Oi)],Ba.prototype,"status",void 0);Ba=rt([F()],Ba);var Yc=class{},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},Nr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ai=class{};Zi([h(),Nr("design:type",String)],ai.prototype,"name",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"address",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"settings",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"icon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"constructorIcon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"settingsIcon",void 0);ai=Zi([F()],ai);var qe=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)},ft=class{};qe([h(),Ze("design:type",String)],ft.prototype,"name",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"address",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"description",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"author",void 0);qe([h(),Ze("design:type",Boolean)],ft.prototype,"templated",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateSourceLanguageAddress",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateAppliedParams",void 0);qe([h(),Ze("design:type",Array)],ft.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"sourceCodeLink",void 0);ft=qe([F()],ft);var Sr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};qe([h(),Ze("design:type",String)],Sr.prototype,"name",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"description",void 0);qe([h(),Ze("design:type",Array)],Sr.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"sourceCodeLink",void 0);Sr=qe([Ae(),Ze("design:paramtypes",[String,String])],Sr);var Xc=class{},el=class extends ci(){},tl=class{},Xa=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},xo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},qa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Xa([h(),xo("design:type",String)],qa.prototype,"linkLanguage",void 0);Xa([h(),xo("design:type",kt)],qa.prototype,"meta",void 0);qa=Xa([F(),xo("design:paramtypes",[String,kt])],qa);var co=class extends ci(){};co=Xa([F()],co);var Ji=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},Yi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},lo;(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"})(lo||(lo={}));var si=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=lo.Private}};Ji([h(),Yi("design:type",String)],si.prototype,"uuid",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"name",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"state",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"sharedUrl",void 0);Ji([h(),Yi("design:type",co)],si.prototype,"neighbourhood",void 0);Ji([h(),Yi("design:type",Array)],si.prototype,"owners",void 0);si=Ji([F(),Yi("design:paramtypes",[String,String,String])],si);var il=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
1345
- ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurrealDB=!0,r.initialized&&typeof r.initialized.catch=="function"&&r.initialized.catch(()=>{});try{await r.subscribe(),await r.initialized}catch(a){let s=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${s}`);try{r.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),r.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let s=this.seenMessages.get(e.id)??new Set,o=[];for(let u of a)u&&u.source&&!s.has(u.source)&&o.push(u.source);if(o.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${o.length} new message(s) out of ${a.length} total`);let l=[];for(let u of o){let m=[];try{let d=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${u.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let p=await this.perspectiveClient.querySurrealDB(e.perspective,d);if(Array.isArray(p))for(let f of p)f&&f.source&&m.push(f.source)}catch(y){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${y?.message??y}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${m.length} parent(s): ${m.join(", ")}`),l.push({address:u,parents:m})}for(let u of o)s.add(u);this.seenMessages.set(e.id,s);let c=this.debounceTimers.get(e.id);c&&clearTimeout(c),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,l),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let s=this.debounceTimers.get(e.id);s&&clearTimeout(s),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,r),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let r=this.proxies.get(e);if(r){try{r.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,r]of this.seenMessages)e[t]=Array.from(r);this.onPersist(this.getActive(),e)}}},es=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},bu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ha=class{};es([h(),bu("design:type",Array)],Ha.prototype,"additions",void 0);es([h(),bu("design:type",Array)],Ha.prototype,"removals",void 0);Ha=es([F()],Ha);var rl=class extends ci(){};rl=es([F()],rl);var nl=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},ur=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)},cn,Ai,na="smart_literal://content";function ng(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 In=class{constructor(e,t){cn.set(this,void 0),Ai.set(this,void 0),nl(this,cn,e,"f"),nl(this,Ai,t,"f")}get base(){return ur(this,Ai,"f")}static async create(e,t){let r=oe.from(ng(10)).toUrl(),n=new In(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new re({source:t,predicate:na}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new re({predicate:na}))).map(r=>new In(e,r.data.source))}async get(){let e=await ur(this,cn,"f").getSingleTarget(new re({source:ur(this,Ai,"f"),predicate:na}));if(!e)throw`No content for smart literal ${ur(this,Ai,"f")}`;return oe.fromUrl(e).get()}async set(e){let t=oe.from(e);await ur(this,cn,"f").setSingleTarget(new Ke({source:ur(this,Ai,"f"),predicate:na,target:t.toUrl()}))}};cn=new WeakMap,Ai=new WeakMap;function ln(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=wt(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 al(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function sl(){return`
1417
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};_e=new WeakMap,Aa=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},Se=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)},xt,ka,pn,Ia,hn,Ri,Ta,fn,fl=class{constructor(e,t=!0){xt.set(this,void 0),ka.set(this,void 0),pn.set(this,void 0),Ia.set(this,void 0),hn.set(this,void 0),Ri.set(this,void 0),Ta.set(this,void 0),fn.set(this,void 0),Jt(this,xt,e,"f"),Jt(this,ka,new $n(Se(this,xt,"f"),t),"f"),Jt(this,pn,new so(Se(this,xt,"f")),"f"),Jt(this,Ia,new ro(Se(this,xt,"f")),"f"),Jt(this,hn,new no(Se(this,xt,"f")),"f"),Jt(this,fn,new yo(Se(this,xt,"f"),t),"f"),Jt(this,Ri,new Ba(Se(this,xt,"f"),t),"f"),Se(this,Ri,"f").setExpressionClient(Se(this,pn,"f")),Se(this,Ri,"f").setNeighbourhoodClient(Se(this,hn,"f")),Se(this,Ri,"f").setAIClient(Se(this,fn,"f")),Jt(this,Ta,new ao(Se(this,xt,"f"),t),"f")}get agent(){return Se(this,ka,"f")}get expression(){return Se(this,pn,"f")}get languages(){return Se(this,Ia,"f")}get neighbourhood(){return Se(this,hn,"f")}get perspective(){return Se(this,Ri,"f")}get runtime(){return Se(this,Ta,"f")}get ai(){return Se(this,fn,"f")}};xt=new WeakMap,ka=new WeakMap,pn=new WeakMap,Ia=new WeakMap,hn=new WeakMap,Ri=new WeakMap,Ta=new WeakMap,fn=new WeakMap;var vo;(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"})(vo||(vo={}));var Po=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},Ro=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fi=class{constructor(e,t){this.language=e,this.expression=t}};Po([f(),Ro("design:type",kt)],Fi.prototype,"language",void 0);Po([f(),Ro("design:type",String)],Fi.prototype,"expression",void 0);Fi=Po([q(),Ro("design:paramtypes",[kt,String])],Fi);function F0(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function j0(i){if(i.startsWith("literal://")){let a=new kt;a.address="literal",a.name="literal";let s=i.substring(10);return new Fi(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new kt;return o.address=a,new Fi(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new kt;return a.address="did",new Fi(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var ct=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},Nt=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ka=class{};ct([f(),Nt("design:type",String)],Ka.prototype,"name",void 0);ct([f(),Nt("design:type",String)],Ka.prototype,"type",void 0);Ka=ct([q()],Ka);var Nn=class{};ct([f(),Nt("design:type",String)],Nn.prototype,"label",void 0);ct([f(),Nt("design:type",String)],Nn.prototype,"name",void 0);ct([f(),Nt("design:type",Array)],Nn.prototype,"parameters",void 0);Nn=ct([q()],Nn);var Qa=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};ct([f(),Nt("design:type",String)],Qa.prototype,"name",void 0);ct([f(),Nt("design:type",String)],Qa.prototype,"parametersStringified",void 0);Qa=ct([Ce(),Nt("design:paramtypes",[String,Object])],Qa);var Ga=class{};ct([f(),Nt("design:type",String)],Ga.prototype,"did",void 0);ct([f(),Nt("design:type",qi)],Ga.prototype,"status",void 0);Ga=ct([q()],Ga);var gl=class{},rr=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},Or=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},pi=class{};rr([f(),Or("design:type",String)],pi.prototype,"name",void 0);rr([f(),Or("design:type",String)],pi.prototype,"address",void 0);rr([f(),Or("design:type",String)],pi.prototype,"settings",void 0);rr([f(),Or("design:type",Bi)],pi.prototype,"icon",void 0);rr([f(),Or("design:type",Bi)],pi.prototype,"constructorIcon",void 0);rr([f(),Or("design:type",Bi)],pi.prototype,"settingsIcon",void 0);pi=rr([q()],pi);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},tt=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},bt=class{};ze([f(),tt("design:type",String)],bt.prototype,"name",void 0);ze([f(),tt("design:type",String)],bt.prototype,"address",void 0);ze([f(),tt("design:type",String)],bt.prototype,"description",void 0);ze([f(),tt("design:type",String)],bt.prototype,"author",void 0);ze([f(),tt("design:type",Boolean)],bt.prototype,"templated",void 0);ze([f(),tt("design:type",String)],bt.prototype,"templateSourceLanguageAddress",void 0);ze([f(),tt("design:type",String)],bt.prototype,"templateAppliedParams",void 0);ze([f(),tt("design:type",Array)],bt.prototype,"possibleTemplateParams",void 0);ze([f(),tt("design:type",String)],bt.prototype,"sourceCodeLink",void 0);bt=ze([q()],bt);var Ar=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ze([f(),tt("design:type",String)],Ar.prototype,"name",void 0);ze([f(),tt("design:type",String)],Ar.prototype,"description",void 0);ze([f(),tt("design:type",Array)],Ar.prototype,"possibleTemplateParams",void 0);ze([f(),tt("design:type",String)],Ar.prototype,"sourceCodeLink",void 0);Ar=ze([Ce(),tt("design:paramtypes",[String,String])],Ar);var ml=class{},yl=class extends mi(){},vl=class{},os=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},No=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Za=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};os([f(),No("design:type",String)],Za.prototype,"linkLanguage",void 0);os([f(),No("design:type",Lt)],Za.prototype,"meta",void 0);Za=os([q(),No("design:paramtypes",[String,Lt])],Za);var bo=class extends mi(){};bo=os([q()],bo);var nr=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)},wo;(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"})(wo||(wo={}));var hi=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=wo.Private}};nr([f(),ar("design:type",String)],hi.prototype,"uuid",void 0);nr([f(),ar("design:type",String)],hi.prototype,"name",void 0);nr([f(),ar("design:type",String)],hi.prototype,"state",void 0);nr([f(),ar("design:type",String)],hi.prototype,"sharedUrl",void 0);nr([f(),ar("design:type",bo)],hi.prototype,"neighbourhood",void 0);nr([f(),ar("design:type",Array)],hi.prototype,"owners",void 0);hi=nr([q(),ar("design:paramtypes",[String,String,String])],hi);var bl=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
1418
+ ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurrealDB=!0,r.initialized&&typeof r.initialized.catch=="function"&&r.initialized.catch(()=>{});try{await r.subscribe(),await r.initialized}catch(a){let s=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${s}`);try{r.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),r.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let s=this.seenMessages.get(e.id)??new Set,o=[];for(let u of a)u&&u.source&&!s.has(u.source)&&o.push(u.source);if(o.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${o.length} new message(s) out of ${a.length} total`);let l=[];for(let u of o){let m=[];try{let d=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${u.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let h=await this.perspectiveClient.querySurrealDB(e.perspective,d);if(Array.isArray(h))for(let g of h)g&&g.source&&m.push(g.source)}catch(y){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${y?.message??y}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${m.length} parent(s): ${m.join(", ")}`),l.push({address:u,parents:m})}for(let u of o)s.add(u);this.seenMessages.set(e.id,s);let c=this.debounceTimers.get(e.id);c&&clearTimeout(c),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,l),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let s=this.debounceTimers.get(e.id);s&&clearTimeout(s),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,r),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let r=this.proxies.get(e);if(r){try{r.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,r]of this.seenMessages)e[t]=Array.from(r);this.onPersist(this.getActive(),e)}}},cs=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},Du=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ja=class{};cs([f(),Du("design:type",Array)],Ja.prototype,"additions",void 0);cs([f(),Du("design:type",Array)],Ja.prototype,"removals",void 0);Ja=cs([q()],Ja);var wl=class extends mi(){};wl=cs([q()],wl);var Sl=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},gr=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)},gn,Ni,pa="smart_literal://content";function Ag(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 On=class{constructor(e,t){gn.set(this,void 0),Ni.set(this,void 0),Sl(this,gn,e,"f"),Sl(this,Ni,t,"f")}get base(){return gr(this,Ni,"f")}static async create(e,t){let r=le.from(Ag(10)).toUrl(),n=new On(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new ae({source:t,predicate:pa}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ae({predicate:pa}))).map(r=>new On(e,r.data.source))}async get(){let e=await gr(this,gn,"f").getSingleTarget(new ae({source:gr(this,Ni,"f"),predicate:pa}));if(!e)throw`No content for smart literal ${gr(this,Ni,"f")}`;return le.fromUrl(e).get()}async set(e){let t=le.from(e);await gr(this,gn,"f").setSingleTarget(new Xe({source:gr(this,Ni,"f"),predicate:pa,target:t.toUrl()}))}};gn=new WeakMap,Ni=new WeakMap;function mn(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=Et(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 _l(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function xl(){return`
1346
1419
  findall(
1347
1420
  [T, A],
1348
1421
  link(Base, _, _, T, A),
@@ -1350,18 +1423,18 @@ ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurre
1350
1423
  ),
1351
1424
  sort(AllLinks, SortedLinks),
1352
1425
  SortedLinks = [[Timestamp, Author]|_]
1353
- `}function ag(i){return`
1426
+ `}function kg(i){return`
1354
1427
  findall([PropertyName, PropertyValue, Resolve], (
1355
1428
  % Constrain to specified properties if provided
1356
1429
  ${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
1357
1430
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1358
1431
  ), Properties)
1359
- `}function ol(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":Be(t);if(Array.isArray(r)){let o=r.map(l=>e(l)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:l,lt:c,lte:u,gt:m,gte:y}=r;if(o!==void 0)if(Array.isArray(o)){let p=o.map(f=>e(f)).join(", ");return n?`\\+ member(${s}, [${p}])`:`${a}, \\+ member(Value${t}, [${p}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(l!==void 0&&Array.isArray(l)&&l.length===2)return n?`${s} >= ${l[0]}, ${s} =< ${l[1]}`:`${a}, Value${t} >= ${l[0]}, Value${t} =< ${l[1]}`;let d=[{value:c,symbol:"<"},{value:u,symbol:"=<"},{value:m,symbol:">"},{value:y,symbol:">="}];for(let{value:p,symbol:f}of d)if(p!==void 0)return n?`${s} ${f} ${p}`:`${a}, Value${t} ${f} ${p}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function cl(i){return i?"length(UnsortedInstances, TotalCount)":""}function ll(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(`,
1360
- `)}function ul(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function dl(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function pl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function $o(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 wu(i,e){return $o(i.type)===e}function Su(i){return wu(i,"array")}function fl(i){return wu(i,"object")}function sg(i){let e=$o(i.type);return e==="number"||e==="integer"}function _u(i,e){if(e.namespace)return e.namespace;if(i["x-ad4m"]?.namespace)return i["x-ad4m"].namespace;if(i.title)return`${i.title.toLowerCase()}://`;if(i.$id)try{let r=new URL(i.$id).pathname.split("/").filter(n=>n);if(r.length>0)return`${r[r.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1432
+ `}function El(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":qe(t);if(Array.isArray(r)){let o=r.map(l=>e(l)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:l,lt:c,lte:u,gt:m,gte:y}=r;if(o!==void 0)if(Array.isArray(o)){let h=o.map(g=>e(g)).join(", ");return n?`\\+ member(${s}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(l!==void 0&&Array.isArray(l)&&l.length===2)return n?`${s} >= ${l[0]}, ${s} =< ${l[1]}`:`${a}, Value${t} >= ${l[0]}, Value${t} =< ${l[1]}`;let d=[{value:c,symbol:"<"},{value:u,symbol:"=<"},{value:m,symbol:">"},{value:y,symbol:">="}];for(let{value:h,symbol:g}of d)if(h!==void 0)return n?`${s} ${g} ${h}`:`${a}, Value${t} ${g} ${h}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function $l(i){return i?"length(UnsortedInstances, TotalCount)":""}function Al(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(`,
1433
+ `)}function kl(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function Il(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function Tl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function Oo(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 Oo(i.type)===e}function Mu(i){return Uu(i,"array")}function Cl(i){return Uu(i,"object")}function Ig(i){let e=Oo(i.type);return e==="number"||e==="integer"}function Fu(i,e){if(e.namespace)return e.namespace;if(i["x-ad4m"]?.namespace)return i["x-ad4m"].namespace;if(i.title)return`${i.title.toLowerCase()}://`;if(i.$id)try{let r=new URL(i.$id).pathname.split("/").filter(n=>n);if(r.length>0)return`${r[r.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1361
1434
  - options.namespace
1362
1435
  - schema["x-ad4m"].namespace
1363
1436
  - schema.title
1364
- - valid schema.$id`)}function Eu(i,e,t,r,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let s=pl(r),[o,l]=s.includes("://")?s.split("://"):["",s],c=l||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",o).replace("${ns}",c).replace("${title}",i.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(i.title||"",e);let a=pl(r);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function qr(i,e,t,r,n){return t.propertyOptions?.[i]?.[r]!==void 0?t.propertyOptions[i][r]:e["x-ad4m"]?.[r]!==void 0?e["x-ad4m"][r]:t[r]!==void 0?t[r]:n}function og(i){switch(i){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function cg(i,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=_u(e,t),n=class extends i{};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,c]of Object.entries(e.properties)){let u=Eu(e,l,c,r,t),m=e.required?.includes(l)||!1,y=$o(c.type);if(Su(c)){s[l]={through:u,local:qr(l,c,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let p=`add${Be(l)}`,f=`remove${Be(l)}`,S=`set${Be(l)}`;n.prototype[p]=function(){},n.prototype[f]=function(){},n.prototype[S]=function(){}}else{let p=qr(l,c,t,"resolveLanguage");!p&&t.resolveLanguage&&(p=t.resolveLanguage);let f=qr(l,c,t,"local"),S=qr(l,c,t,"readOnly");if(S===void 0){let k=c["x-ad4m"]?.writable;S=k!==void 0?!k:!1}let E=!S,A=qr(l,c,t,"initial");if(fl(c)&&!p&&(p="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),p==null&&sg(c)&&(p="literal"),p==null&&(p="literal"),m&&!A&&(fl(c)?A="literal://json:{}":A="ad4m://undefined"),a[l]={through:u,required:m,writable:E,...p&&{resolveLanguage:p},...f!==void 0&&{local:f},...A&&{initial:A}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:og(y)}),E){let k=Wa(l);n.prototype[k]=function(){}}}}for(let[l,c]of Object.entries(a))Bd(n,l,c);for(let[l,c]of Object.entries(s))qd(n,l,{predicate:c.through||"",kind:"hasMany",...c.getter!==void 0&&{getter:c.getter},...c.local!==void 0&&{local:c.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Hd({name:t.name})(n),n}function lg(i,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 l=a.map(c=>se(c)).join(", ");r.push(`${o} IN [${l}]`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let c=l.not.map(u=>se(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${se(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${se(l.between[0])} AND ${o} <= ${se(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${se(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${se(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${se(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${se(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${se(l.contains)}`)}else r.push(`${o} = ${se(a)}`)}else{let o=e[n],l=o?.kind==="belongsToOne"||o?.kind==="belongsToMany";if(o){let y=Y(o.predicate);if(Array.isArray(a)){let d=a.map(p=>se(p)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${d}]]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let p=d.not.map(f=>se(f)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${p}]]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${p}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(d.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(d.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(a)}]) > 0`);continue}let c=i.properties[n];if(!c)continue;let u=Y(c.predicate),m=c.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let y=a.map(d=>se(d)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let p=y.not.map(f=>se(f)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${p}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(y.not)}]) = 0`);(y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${u}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(a)}]) > 0`)}return r.join(" AND ")}function ug(i,e,t,r){let{where:n}=t,a=[];if(t.parent){let c=ln(t.parent,r);a.push(`count(<-link[WHERE in.uri = ${se(t.parent.id)} AND predicate = '${Y(c)}']) > 0`)}for(let[,c]of Object.entries(i.properties))if(c.required){if(c.getter)continue;c.flag&&c.initial?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`)}if(a.length===0){for(let[,c]of Object.entries(i.properties))if(c.initial){c.flag?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`);break}}if(a.length===0){let c=[];for(let[,u]of Object.entries(i.properties))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);if(i.relations)for(let[,u]of Object.entries(i.relations))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);c.length>0&&a.push(`count(->link[WHERE (${c.join(" OR ")})]) > 0`)}let s=lg(i,e,n),o=[];return o.push(...a),s&&o.push(s),o.push("count(->link) > 0"),`
1437
+ - valid schema.$id`)}function ju(i,e,t,r,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let s=Tl(r),[o,l]=s.includes("://")?s.split("://"):["",s],c=l||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",o).replace("${ns}",c).replace("${title}",i.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(i.title||"",e);let a=Tl(r);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function Qr(i,e,t,r,n){return t.propertyOptions?.[i]?.[r]!==void 0?t.propertyOptions[i][r]:e["x-ad4m"]?.[r]!==void 0?e["x-ad4m"][r]:t[r]!==void 0?t[r]:n}function Tg(i){switch(i){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function Cg(i,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=Fu(e,t),n=class extends i{};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,c]of Object.entries(e.properties)){let u=ju(e,l,c,r,t),m=e.required?.includes(l)||!1,y=Oo(c.type);if(Mu(c)){s[l]={through:u,local:Qr(l,c,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let h=`add${qe(l)}`,g=`remove${qe(l)}`,_=`set${qe(l)}`;n.prototype[h]=function(){},n.prototype[g]=function(){},n.prototype[_]=function(){}}else{let h=Qr(l,c,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let g=Qr(l,c,t,"local"),_=Qr(l,c,t,"readOnly");if(_===void 0){let I=c["x-ad4m"]?.writable;_=I!==void 0?!I:!1}let E=!_,A=Qr(l,c,t,"initial");if(Cl(c)&&!h&&(h="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),h==null&&Ig(c)&&(h="literal"),h==null&&(h="literal"),m&&!A&&(Cl(c)?A="literal://json:{}":A="ad4m://undefined"),a[l]={through:u,required:m,writable:E,...h&&{resolveLanguage:h},...g!==void 0&&{local:g},...A&&{initial:A}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:Tg(y)}),E){let I=es(l);n.prototype[I]=function(){}}}}for(let[l,c]of Object.entries(a))lp(n,l,c);for(let[l,c]of Object.entries(s))up(n,l,{predicate:c.through||"",kind:"hasMany",...c.getter!==void 0&&{getter:c.getter},...c.local!==void 0&&{local:c.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,dp({name:t.name})(n),n}function Lg(i,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 l=a.map(c=>ce(c)).join(", ");r.push(`${o} IN [${l}]`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let c=l.not.map(u=>ce(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${ce(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${ce(l.between[0])} AND ${o} <= ${ce(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${ce(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${ce(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${ce(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${ce(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${ce(l.contains)}`)}else r.push(`${o} = ${ce(a)}`)}else{let o=e[n],l=o?.kind==="belongsToOne"||o?.kind==="belongsToMany";if(o){let y=ee(o.predicate);if(Array.isArray(a)){let d=a.map(h=>ce(h)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${d}]]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri 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(g=>ce(g)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${h}]]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${h}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${ce(d.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${ce(d.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${ce(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${ce(a)}]) > 0`);continue}let c=i.properties[n];if(!c)continue;let u=ee(c.predicate),m=c.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let y=a.map(d=>ce(d)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let h=y.not.map(g=>ce(g)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${h}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${ce(y.not)}]) = 0`);(y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${u}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${ce(a)}]) > 0`)}return r.join(" AND ")}function Pg(i,e,t,r){let{where:n}=t,a=[];if(t.parent){let c=mn(t.parent,r);a.push(`count(<-link[WHERE in.uri = ${ce(t.parent.id)} AND predicate = '${ee(c)}']) > 0`)}for(let[,c]of Object.entries(i.properties))if(c.required){if(c.getter)continue;c.flag&&c.initial?a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}' AND out.uri = '${ee(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}']) > 0`)}if(a.length===0){for(let[,c]of Object.entries(i.properties))if(c.initial){c.flag?a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}' AND out.uri = '${ee(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}']) > 0`);break}}if(a.length===0){let c=[];for(let[,u]of Object.entries(i.properties))u.predicate&&c.push(`predicate = '${ee(u.predicate)}'`);if(i.relations)for(let[,u]of Object.entries(i.relations))u.predicate&&c.push(`predicate = '${ee(u.predicate)}'`);c.length>0&&a.push(`count(->link[WHERE (${c.join(" OR ")})]) > 0`)}let s=Lg(i,e,n),o=[];return o.push(...a),s&&o.push(s),o.push("count(->link) > 0"),`
1365
1438
  SELECT
1366
1439
  id AS source,
1367
1440
  uri AS source_uri,
@@ -1369,33 +1442,33 @@ SELECT
1369
1442
  FROM node
1370
1443
  WHERE ${o.join(" AND ")}
1371
1444
  FETCH links
1372
- `.trim()}var uo=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:m,totalCount:y}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}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:m,totalCount:y}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}}};function aa(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function hl(i,e){if(Array.isArray(e))return e.includes(i);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(i):i!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return i>=t.between[0]&&i<=t.between[1];let r=!0;return t.gt!==void 0&&(r=r&&i>t.gt),t.gte!==void 0&&(r=r&&i>=t.gte),t.lt!==void 0&&(r=r&&i<t.lt),t.lte!==void 0&&(r=r&&i<=t.lte),t.contains!==void 0&&(typeof i=="string"?r=r&&i.includes(String(t.contains)):Array.isArray(i)?r=r&&i.includes(t.contains):r=!1),r}return i===e}async function dg(i,e,t,r){let n=i;if(i!=null&&i!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof i=="string"&&!i.startsWith("literal://"))try{let a=await t.getExpression(i);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof i=="string"&&i.startsWith("literal://"))try{let a=oe.fromUrl(i).get();n=a.data!==void 0?a.data:a}catch{}else typeof i=="string"&&r&&(r==="number"?n=Number(i):r==="boolean"&&(n=i==="true"||i==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function gl(i,e,t,r,n){if(!e||e.length===0)return;let a=null,s=null,o=null,l=n&&n.length>0?new Set(n):null,c=new Map;for(let[p,f]of Object.entries(t.properties))f.getter||l&&!l.has(p)||c.set(f.predicate,[p,f]);let u=new Map,m=[];for(let[p,f]of Object.entries(t.relations))if(!f.getter){if(f.target&&f.filter!==!1){m.push([p,f]);continue}u.set(f.predicate,[p,f])}for(let[p,f]of m)u.has(f.predicate)||u.set(f.predicate,[p,f]);let y=new Map,d=new Map;for(let p=0;p<e.length;p++){let f=e[p],{predicate:S,target:E,author:A,timestamp:k}=f;if(E==="None"||E===void 0||E===null)continue;k!=null&&((a==null||k<a)&&(a=k,o=A??null),(s==null||k>s)&&(s=k));let b=c.get(S);if(b){y.get(b[0]),y.set(b[0],{target:E,timestamp:k});continue}let T=u.get(S);if(T){let[R]=T,C=d.get(R);C||(C=[],d.set(R,C)),C.push({target:E,timestamp:k??"",index:p})}}for(let[p,{target:f}]of y){let[,S]=c.get(t.properties[p].predicate),E=typeof i[p];i[p]=await dg(f,S,r,E!=="undefined"?E:void 0)}for(let[p,f]of d)f.sort((S,E)=>{let A=String(S.timestamp).localeCompare(String(E.timestamp));return A!==0?A:S.index-E.index}),i[p]=f.map(S=>S.target).filter(S=>S!=null&&S!==""&&S!=="None");o&&(i.author=o),a!=null&&(i.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),s!=null&&(i.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}async function pg(i,e,t){let r=Object.fromEntries(await Promise.all(t.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let m=Array.from(s,p=>p.codePointAt(0)),y=m.every(p=>p<=255),d=m.some(p=>p>=128);if(y&&d)try{let p=Uint8Array.from(m),f=new TextDecoder("utf-8",{fatal:!0}).decode(p);f!==s&&(l=f)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:p})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Mi(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(l=u(l)),[a,l]}))),n=Object.fromEntries(Object.entries(r).filter(([a])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(e,n)}function fg(i,e){let t=Pl(i,e);if(!t){let r=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${r}".`);return}return t.getter}async function ml(i,e,t,r){let n=se(i.id),s=r?.requestedProperties&&r.requestedProperties.length>0?new Set(r.requestedProperties):null;for(let[o,l]of Object.entries(t.properties))if(!(s&&!s.has(o))&&l.getter)try{let c=l.getter.replace(/Base/g,n),u=await e.querySurrealDB(`SELECT (${c}) AS value FROM node WHERE uri = ${n}`);u&&u.length>0&&u[0].value!==void 0&&u[0].value!==null&&u[0].value!=="None"&&u[0].value!==""&&(i[o]=u[0].value)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,l]of Object.entries(t.relations)){if(s&&!s.has(o)&&!(r?.include&&o in r.include))continue;let c=l,u=c.getter;if(!u&&c.where&&c.direction!=="reverse")try{let m=c.target?.(),y=m?m.getModelMetadata?.()??null:null,d=Rl(c.where,y);d.length>0&&(u=`(->link[WHERE predicate = '${Y(c.predicate)}'].out[WHERE ${d.join(" AND ")}].uri)`)}catch{}if(!u&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let m=c.target();u=fg(c.predicate,m),u||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(m){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,m)}if(u)try{let y=`SELECT (${u.replace(/Base/g,n)}) AS value FROM node WHERE uri = ${n}`,d=await e.querySurrealDB(y);if(d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null){let p=d[0].value;i[o]=Array.isArray(p)?p.filter(f=>f!=null&&f!==""&&f!=="None"):p}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function hn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=wt(i);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 l=o.target(),c=typeof s=="object"&&s!==null?s:void 0,u=c?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let k=(await t.get(new re({predicate:o.predicate,target:E.id}))).filter(b=>b.data.target===E.id).map(b=>b.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let b=k[k.length-1];try{let T=new l(t,b);await T.get(),E[a]=T}catch{E[a]=null}}else{let b=[];if(c&&(c.where||c.order||c.properties)){let T={id:k,...c.where??{}};b=await l.findAll(t,{where:T,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(k.map(async T=>{try{let R=new l(t,T);await R.get(c?.properties?{properties:c.properties}:void 0),b.push(R)}catch{}}));if(c?.order&&!(c.where||c.properties)){let T=Object.entries(c.order);b=b.sort((R,C)=>{for(let[Q,V]of T){let L=String(R[Q]??""),W=String(C[Q]??""),He=L.localeCompare(W);if(He!==0)return V==="DESC"?-He:He}return 0})}if(c?.offset!=null||c?.limit!=null){let T=c.offset??0,R=c.limit!=null?T+c.limit:void 0;b=b.slice(T,R)}E[a]=b,u&&b.length>0&&await hn(l,b,t,u)}}continue}let m=new Set,y=new Map;for(let E of e){let A=E[a];if(y.set(E,Array.isArray(A)?[...A]:A),A!=null)if(Array.isArray(A))for(let k of A)typeof k=="string"?m.add(k):k&&typeof k=="object"&&typeof k.id=="string"&&m.add(k.id);else typeof A=="string"?m.add(A):A&&typeof A=="object"&&typeof A.id=="string"&&m.add(A.id)}if(m.size===0)continue;let d=new Map,f={where:{id:Array.from(m),...c?.where??{}},...c?.order&&{order:c.order},...c?.properties&&{properties:c.properties}},S=await l.findAll(t,f);for(let E of S)d.set(E.id,E);for(let E of e){let A=y.get(E);if(A!=null)if(Array.isArray(A)){let k=A.map(b=>typeof b=="string"?d.has(b)?d.get(b):null:b&&typeof b=="object"&&typeof b.id=="string"?d.has(b.id)?d.get(b.id):b:null).filter(b=>b!==null);if(c?.order){let b=Object.entries(c.order);k=k.sort((T,R)=>{for(let[C,Q]of b){let V=String(T[C]??""),L=String(R[C]??""),W=V.localeCompare(L);if(W!==0)return Q==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let b=c.offset??0,T=c.limit!=null?b+c.limit:void 0;k=k.slice(b,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 A=="string"&&d.has(A)?E[a]=d.get(A):A&&typeof A=="object"&&typeof A.id=="string"&&(E[a]=d.has(A.id)?d.get(A.id):A)}if(u){let E=Array.from(d.values());await hn(l,E,t,u)}}}var _r=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===_r)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=Mi(this);for(let[m,y]of Object.entries(n)){let d=y;r[m]={name:m,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=wt(this),o=Object.fromEntries(Object.entries(s).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let[m,y]of Object.entries(o)){let d=y;a[m]={name:m,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",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let l=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(l||c)&&e.__jsonSchema){let m=e.__jsonSchema,y=e.__jsonSchemaOptions||{};if(m.properties)for(let[d,p]of Object.entries(m.properties)){let f=Su(p),S=Eu(m,d,p,_u(m,y),y);if(f)a[d]={name:d,predicate:S,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:S,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||oe.from(Ll(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 Mi(t)[e]}getRelationOptions(e){let t=this.constructor;return wt(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 assignValuesToInstance(e,t,r){return pg(e,t,r)}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=aa(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]=aa(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=aa(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let l=Array.isArray(s)?[...s].sort():[],c=Array.isArray(o)?[...o].sort():[];(l.length!==c.length||l.some((u,m)=>u!==c[m]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
1445
+ `.trim()}var So=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:m,totalCount:y}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}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:m,totalCount:y}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}}};function ha(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function Ll(i,e){if(Array.isArray(e))return e.includes(i);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(i):i!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return i>=t.between[0]&&i<=t.between[1];let r=!0;return t.gt!==void 0&&(r=r&&i>t.gt),t.gte!==void 0&&(r=r&&i>=t.gte),t.lt!==void 0&&(r=r&&i<t.lt),t.lte!==void 0&&(r=r&&i<=t.lte),t.contains!==void 0&&(typeof i=="string"?r=r&&i.includes(String(t.contains)):Array.isArray(i)?r=r&&i.includes(t.contains):r=!1),r}return i===e}async function Rg(i,e,t,r){let n=i;if(i!=null&&i!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof i=="string"&&!i.startsWith("literal://"))try{let a=await t.getExpression(i);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof i=="string"&&i.startsWith("literal://"))try{let a=le.fromUrl(i).get();n=a.data!==void 0?a.data:a}catch{}else typeof i=="string"&&r&&(r==="number"?n=Number(i):r==="boolean"&&(n=i==="true"||i==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function Pl(i,e,t,r,n){if(!e||e.length===0)return;let a=null,s=null,o=null,l=n&&n.length>0?new Set(n):null,c=new Map;for(let[h,g]of Object.entries(t.properties))g.getter||l&&!l.has(h)||c.set(g.predicate,[h,g]);let u=new Map,m=[];for(let[h,g]of Object.entries(t.relations))if(!g.getter){if(g.target&&g.filter!==!1){m.push([h,g]);continue}u.set(g.predicate,[h,g])}for(let[h,g]of m)u.has(g.predicate)||u.set(g.predicate,[h,g]);let y=new Map,d=new Map;for(let h=0;h<e.length;h++){let g=e[h],{predicate:_,target:E,author:A,timestamp:I}=g;if(E==="None"||E===void 0||E===null)continue;I!=null&&((a==null||I<a)&&(a=I,o=A??null),(s==null||I>s)&&(s=I));let w=c.get(_);if(w){y.get(w[0]),y.set(w[0],{target:E,timestamp:I});continue}let L=u.get(_);if(L){let[U]=L,P=d.get(U);P||(P=[],d.set(U,P)),P.push({target:E,timestamp:I??"",index:h})}}for(let[h,{target:g}]of y){let[,_]=c.get(t.properties[h].predicate),E=typeof i[h];i[h]=await Rg(g,_,r,E!=="undefined"?E:void 0)}for(let[h,g]of d)g.sort((_,E)=>{let A=String(_.timestamp).localeCompare(String(E.timestamp));return A!==0?A:_.index-E.index}),i[h]=g.map(_=>_.target).filter(_=>_!=null&&_!==""&&_!=="None");o&&(i.author=o),a!=null&&(i.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),s!=null&&(i.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}async function Ng(i,e,t){let r=Object.fromEntries(await Promise.all(t.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let m=Array.from(s,h=>h.codePointAt(0)),y=m.every(h=>h<=255),d=m.some(h=>h>=128);if(y&&d)try{let h=Uint8Array.from(m),g=new TextDecoder("utf-8",{fatal:!0}).decode(h);g!==s&&(l=g)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:h})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Vi(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(l=u(l)),[a,l]}))),n=Object.fromEntries(Object.entries(r).filter(([a])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(e,n)}function Og(i,e){let t=Jl(i,e);if(!t){let r=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${r}".`);return}return t.getter}async function Rl(i,e,t,r){let n=ce(i.id),s=r?.requestedProperties&&r.requestedProperties.length>0?new Set(r.requestedProperties):null;for(let[o,l]of Object.entries(t.properties))if(!(s&&!s.has(o))&&l.getter)try{let c=l.getter.replace(/Base/g,n),u=await e.querySurrealDB(`SELECT (${c}) AS value FROM node WHERE uri = ${n}`);u&&u.length>0&&u[0].value!==void 0&&u[0].value!==null&&u[0].value!=="None"&&u[0].value!==""&&(i[o]=u[0].value)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,l]of Object.entries(t.relations)){if(s&&!s.has(o)&&!(r?.include&&o in r.include))continue;let c=l,u=c.getter;if(!u&&c.where&&c.direction!=="reverse")try{let m=c.target?.(),y=m?m.getModelMetadata?.()??null:null,d=Zl(c.where,y);d.length>0&&(u=`(->link[WHERE predicate = '${ee(c.predicate)}'].out[WHERE ${d.join(" AND ")}].uri)`)}catch{}if(!u&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let m=c.target();u=Og(c.predicate,m),u||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(m){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,m)}if(u)try{let y=`SELECT (${u.replace(/Base/g,n)}) AS value FROM node WHERE uri = ${n}`,d=await e.querySurrealDB(y);if(d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null){let h=d[0].value;i[o]=Array.isArray(h)?h.filter(g=>g!=null&&g!==""&&g!=="None"):h}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function Sn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=Et(i);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 l=o.target(),c=typeof s=="object"&&s!==null?s:void 0,u=c?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let I=(await t.get(new ae({predicate:o.predicate,target:E.id}))).filter(w=>w.data.target===E.id).map(w=>w.data.source);if(o.kind==="belongsToOne"){if(I.length===0){E[a]=null;continue}let w=I[I.length-1];try{let L=new l(t,w);await L.get(),E[a]=L}catch{E[a]=null}}else{let w=[];if(c&&(c.where||c.order||c.properties)){let L={id:I,...c.where??{}};w=await l.findAll(t,{where:L,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(I.map(async L=>{try{let U=new l(t,L);await U.get(c?.properties?{properties:c.properties}:void 0),w.push(U)}catch{}}));if(c?.order&&!(c.where||c.properties)){let L=Object.entries(c.order);w=w.sort((U,P)=>{for(let[G,V]of L){let R=String(U[G]??""),W=String(P[G]??""),Ke=R.localeCompare(W);if(Ke!==0)return V==="DESC"?-Ke:Ke}return 0})}if(c?.offset!=null||c?.limit!=null){let L=c.offset??0,U=c.limit!=null?L+c.limit:void 0;w=w.slice(L,U)}E[a]=w,u&&w.length>0&&await Sn(l,w,t,u)}}continue}let m=new Set,y=new Map;for(let E of e){let A=E[a];if(y.set(E,Array.isArray(A)?[...A]:A),A!=null)if(Array.isArray(A))for(let I of A)typeof I=="string"?m.add(I):I&&typeof I=="object"&&typeof I.id=="string"&&m.add(I.id);else typeof A=="string"?m.add(A):A&&typeof A=="object"&&typeof A.id=="string"&&m.add(A.id)}if(m.size===0)continue;let d=new Map,g={where:{id:Array.from(m),...c?.where??{}},...c?.order&&{order:c.order},...c?.properties&&{properties:c.properties}},_=await l.findAll(t,g);for(let E of _)d.set(E.id,E);for(let E of e){let A=y.get(E);if(A!=null)if(Array.isArray(A)){let I=A.map(w=>typeof w=="string"?d.has(w)?d.get(w):null:w&&typeof w=="object"&&typeof w.id=="string"?d.has(w.id)?d.get(w.id):w:null).filter(w=>w!==null);if(c?.order){let w=Object.entries(c.order);I=I.sort((L,U)=>{for(let[P,G]of w){let V=String(L[P]??""),R=String(U[P]??""),W=V.localeCompare(R);if(W!==0)return G==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let w=c.offset??0,L=c.limit!=null?w+c.limit:void 0;I=I.slice(w,L)}o.maxCount===1?(I.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${I.length} values found; keeping the last`),E[a]=I.length>0?I[I.length-1]:null):E[a]=I}else typeof A=="string"&&d.has(A)?E[a]=d.get(A):A&&typeof A=="object"&&typeof A.id=="string"&&(E[a]=d.has(A.id)?d.get(A.id):A)}if(u){let E=Array.from(d.values());await Sn(l,E,t,u)}}}var kr=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===kr)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=Vi(this);for(let[m,y]of Object.entries(n)){let d=y;r[m]={name:m,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=Et(this),o=Object.fromEntries(Object.entries(s).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let[m,y]of Object.entries(o)){let d=y;a[m]={name:m,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",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let l=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(l||c)&&e.__jsonSchema){let m=e.__jsonSchema,y=e.__jsonSchemaOptions||{};if(m.properties)for(let[d,h]of Object.entries(m.properties)){let g=Mu(h),_=ju(m,d,h,Fu(m,y),y);if(g)a[d]={name:d,predicate:_,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:_,required:E,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||le.from(Ql(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 Vi(t)[e]}getRelationOptions(e){let t=this.constructor;return Et(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 assignValuesToInstance(e,t,r){return Ng(e,t,r)}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=ha(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=ha(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]=ha(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=ha(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let l=Array.isArray(s)?[...s].sort():[],c=Array.isArray(o)?[...o].sort():[];(l.length!==c.length||l.some((u,m)=>u!==c[m]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
1373
1446
  SELECT id, predicate, out.uri AS target, author, timestamp
1374
1447
  FROM link
1375
- WHERE in.uri = ${se(this._baseExpression)}
1448
+ WHERE in.uri = ${ce(this._baseExpression)}
1376
1449
  ORDER BY timestamp ASC
1377
- `,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await gl(this,s,r,this._perspective,u)}let o=wt(t),l=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,m]of Object.entries(o)){if(m.kind!=="belongsToOne"&&m.kind!=="belongsToMany"||l&&!l.has(u))continue;let d=(await this._perspective.get(new re({predicate:m.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);m.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await ml(this,this._perspective,r,c),e?.include&&await hn(t,[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:l,count:c}=t,u=r||await this.getClassName(e),m=t.parent?ln(t.parent,this):void 0,y=[sl(),al(t.parent,m),ag(n),ol(a)],d=[cl(c),ll(s),ul(o),dl(l)];return`
1450
+ `,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await Pl(this,s,r,this._perspective,u)}let o=Et(t),l=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,m]of Object.entries(o)){if(m.kind!=="belongsToOne"&&m.kind!=="belongsToMany"||l&&!l.has(u))continue;let d=(await this._perspective.get(new ae({predicate:m.predicate,target:this._baseExpression}))).filter(h=>h.data.target===this._baseExpression).map(h=>h.data.source);m.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Rl(this,this._perspective,r,c),e?.include&&await Sn(t,[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:l,count:c}=t,u=r||await this.getClassName(e),m=t.parent?mn(t.parent,this):void 0,y=[xl(),_l(t.parent,m),kg(n),El(a)],d=[$l(c),Al(s),kl(o),Il(l)];return`
1378
1451
  findall([Base, Properties, Collections, Timestamp, Author], (
1379
1452
  subject_class("${u}", SubjectClass),
1380
1453
  instance(SubjectClass, Base),
1381
- ${y.filter(f=>f).join(", ")}
1454
+ ${y.filter(g=>g).join(", ")}
1382
1455
  ), UnsortedInstances),
1383
- ${d.filter(f=>f).join(", ")}
1384
- `}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n=wt(this);return ug(r,n,t,this)}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([l,c,u,m,y])=>{try{let d=new this(e,l);n.length&&Object.keys(d).forEach(f=>{!n.includes(f)&&f!=="createdAt"&&f!=="updatedAt"&&f!=="author"&&f!=="id"&&f!=="baseExpression"&&delete d[f]});let p=[...c,...u,["createdAt",m],["author",y]];return await _r.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${l}:`,d),null}}))).filter(l=>l!==null);t.include&&s.length>0&&await hn(this,s,e,t.include);let o=t.include;for(let l of s)l.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 f of r){let S;try{if(S=f.source_uri,!S)continue;let E=f.links||[],A=new this(e,S);if(await gl(A,E,n,e,a.length>0?a:void 0),a.length>0){let k=new Set(a);for(let b of Object.keys(n.properties))k.has(b)||delete A[b];for(let b of Object.keys(n.relations))!k.has(b)&&!(t.include&&b in t.include)&&delete A[b];for(let b of["author","createdAt","updatedAt"])k.has(b)||delete A[b]}s.push(A)}catch(E){console.error(`Failed to process SurrealDB instance ${S}:`,E)}}let o=wt(this),l=Object.entries(o).filter(([f,S])=>(S.kind==="belongsToOne"||S.kind==="belongsToMany")&&(a.length===0||a.includes(f)));l.length>0&&s.length>0&&await Promise.all(s.map(async f=>{for(let[S,E]of l){let k=(await e.get(new re({predicate:E.predicate,target:f.id}))).filter(b=>b.data.target===f.id).map(b=>b.data.source);E.kind==="belongsToOne"?f[S]=k.length>0?k[k.length-1]:null:f[S]=k}}));let c=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let f of s)await ml(f,e,n,c);let u=s;t.where&&(u=s.filter(f=>{for(let[S,E]of Object.entries(t.where))if(S!=="base"){if(S==="author"||S==="timestamp"){if(!hl(f[S],E))return!1;continue}if(typeof E=="object"&&E!==null&&!Array.isArray(E)){let A=E;if((A.gt!==void 0||A.gte!==void 0||A.lt!==void 0||A.lte!==void 0||A.between!==void 0||A.contains!==void 0)&&!hl(f[S],E))return!1}}return!0}));let m=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(m){let f=Object.entries(m);u.sort((S,E)=>{for(let[A,k]of f){let b=S[A],T=E[A];if(b===void 0&&T===void 0)continue;if(b===void 0)return k==="ASC"?1:-1;if(T===void 0)return k==="ASC"?-1:1;let R=0;if(typeof b=="number"&&typeof T=="number"?R=b-T:typeof b=="string"&&typeof T=="string"?R=b.localeCompare(T):R=String(b).localeCompare(String(T)),R!==0)return k==="DESC"?-R:R}return 0})}let y=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,S=t.limit?f+t.limit:void 0;d=u.slice(f,S)}t.include&&d.length>0&&await hn(this,d,e,t.include);let p=t.include;for(let f of d)f.takeSnapshot(p);return{results:d,totalCount:y}}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),l=await e.querySurrealDB(o),{results:c,totalCount:u}=await this.instancesFromSurrealResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),l=await e.infer(o),{results:c,totalCount:u}=await this.instancesFromPrologResult(e,s,l);return{results:c,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?ln(t.parent,this):void 0,o=[sl(),al(t.parent,s),ol(n)],l=[cl(!0),ll(),ul(),dl()];return`
1456
+ ${d.filter(g=>g).join(", ")}
1457
+ `}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n=Et(this);return Pg(r,n,t,this)}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([l,c,u,m,y])=>{try{let d=new this(e,l);n.length&&Object.keys(d).forEach(g=>{!n.includes(g)&&g!=="createdAt"&&g!=="updatedAt"&&g!=="author"&&g!=="id"&&g!=="baseExpression"&&delete d[g]});let h=[...c,...u,["createdAt",m],["author",y]];return await kr.assignValuesToInstance(e,d,h),d}catch(d){return console.error(`Failed to process instance ${l}:`,d),null}}))).filter(l=>l!==null);t.include&&s.length>0&&await Sn(this,s,e,t.include);let o=t.include;for(let l of s)l.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 g of r){let _;try{if(_=g.source_uri,!_)continue;let E=g.links||[],A=new this(e,_);if(await Pl(A,E,n,e,a.length>0?a:void 0),a.length>0){let I=new Set(a);for(let w of Object.keys(n.properties))I.has(w)||delete A[w];for(let w of Object.keys(n.relations))!I.has(w)&&!(t.include&&w in t.include)&&delete A[w];for(let w of["author","createdAt","updatedAt"])I.has(w)||delete A[w]}s.push(A)}catch(E){console.error(`Failed to process SurrealDB instance ${_}:`,E)}}let o=Et(this),l=Object.entries(o).filter(([g,_])=>(_.kind==="belongsToOne"||_.kind==="belongsToMany")&&(a.length===0||a.includes(g)));l.length>0&&s.length>0&&await Promise.all(s.map(async g=>{for(let[_,E]of l){let I=(await e.get(new ae({predicate:E.predicate,target:g.id}))).filter(w=>w.data.target===g.id).map(w=>w.data.source);E.kind==="belongsToOne"?g[_]=I.length>0?I[I.length-1]:null:g[_]=I}}));let c=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let g of s)await Rl(g,e,n,c);let u=s;t.where&&(u=s.filter(g=>{for(let[_,E]of Object.entries(t.where))if(_!=="base"){if(_==="author"||_==="timestamp"){if(!Ll(g[_],E))return!1;continue}if(typeof E=="object"&&E!==null&&!Array.isArray(E)){let A=E;if((A.gt!==void 0||A.gte!==void 0||A.lt!==void 0||A.lte!==void 0||A.between!==void 0||A.contains!==void 0)&&!Ll(g[_],E))return!1}}return!0}));let m=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(m){let g=Object.entries(m);u.sort((_,E)=>{for(let[A,I]of g){let w=_[A],L=E[A];if(w===void 0&&L===void 0)continue;if(w===void 0)return I==="ASC"?1:-1;if(L===void 0)return I==="ASC"?-1:1;let U=0;if(typeof w=="number"&&typeof L=="number"?U=w-L:typeof w=="string"&&typeof L=="string"?U=w.localeCompare(L):U=String(w).localeCompare(String(L)),U!==0)return I==="DESC"?-U:U}return 0})}let y=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let g=t.offset||0,_=t.limit?g+t.limit:void 0;d=u.slice(g,_)}t.include&&d.length>0&&await Sn(this,d,e,t.include);let h=t.include;for(let g of d)g.takeSnapshot(h);return{results:d,totalCount:y}}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),l=await e.querySurrealDB(o),{results:c,totalCount:u}=await this.instancesFromSurrealResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),l=await e.infer(o),{results:c,totalCount:u}=await this.instancesFromPrologResult(e,s,l);return{results:c,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?mn(t.parent,this):void 0,o=[xl(),_l(t.parent,s),El(n)],l=[$l(!0),Al(),kl(),Il()];return`
1385
1458
  findall([Base, Properties, Collections, Timestamp, Author], (
1386
1459
  subject_class("${a}", SubjectClass),
1387
1460
  instance(SubjectClass, Base),
1388
1461
  ${o.filter(u=>u).join(", ")}
1389
1462
  ), UnsortedInstances),
1390
1463
  ${l.filter(u=>u).join(", ")}
1391
- `}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(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[l,c]of Object.entries(this))if(c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action){let u=r.properties[l];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof c=="object"){a.push(l);continue}s[l]=c}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,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,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[l,c]of o){if(!s.has(l)||n&&!n.has(l))continue;let u=a.relations[l];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([y,d])=>y!==l&&d.predicate===u.predicate)))&&c!=null){if(c?.action)switch(c.action){case"setter":await this.setRelationValues(l,c.value,t);break;case"adder":await this.addRelationValue(l,c.value,t);break;case"remover":await this.removeRelationValue(l,c.value,t);break;default:await this.setRelationValues(l,c.value,t);break}else if(Array.isArray(c))await this.setRelationValues(l,c,t);else if(c!=null&&c!==""&&e){if(this.getRelationOptions(l)||this.getPropertyMetadata(l)?.flag)continue;await this.setProperty(l,c,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,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=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new re({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new re({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=ln(r.parent,this),o=new Ke({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=ln(r.parent,this),s=new Ke({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 uo(e,this,t)}static fromJSONSchema(e,t){return cg(this,e,t)}};_r.classNamesByClass=new WeakMap;function Ao(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function hg(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(`,
1464
+ `}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(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[l,c]of Object.entries(this))if(c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action){let u=r.properties[l];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof c=="object"){a.push(l);continue}s[l]=c}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,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,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[l,c]of o){if(!s.has(l)||n&&!n.has(l))continue;let u=a.relations[l];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([y,d])=>y!==l&&d.predicate===u.predicate)))&&c!=null){if(c?.action)switch(c.action){case"setter":await this.setRelationValues(l,c.value,t);break;case"adder":await this.addRelationValue(l,c.value,t);break;case"remover":await this.removeRelationValue(l,c.value,t);break;default:await this.setRelationValues(l,c.value,t);break}else if(Array.isArray(c))await this.setRelationValues(l,c,t);else if(c!=null&&c!==""&&e){if(this.getRelationOptions(l)||this.getPropertyMetadata(l)?.flag)continue;await this.setProperty(l,c,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,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=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new ae({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new ae({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=mn(r.parent,this),o=new Xe({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=mn(r.parent,this),s=new Xe({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 So(e,this,t)}static fromJSONSchema(e,t){return Cg(this,e,t)}};kr.classNamesByClass=new WeakMap;function Do(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function Dg(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(`,
1392
1465
  `);return`${i}(X) :-
1393
1466
  ${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(`,
1394
1467
  `);return`${i}(X) :-
1395
1468
  ${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(` ;
1396
1469
  `);return`${i}(X) :-
1397
- (${s}).`}return null}function gg(i,e){return e.flag||!e.predicate?null:`${`${i}_${Ao(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function mg(i,e){if(!e.predicate)return null;let t=`${i}_${Ao(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 y0(i){let e=i.getModelMetadata(),t=Ao(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=hg(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>gg(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=>mg(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
1398
- `)}var v0=`
1470
+ (${s}).`}return null}function Ug(i,e){return e.flag||!e.predicate?null:`${`${i}_${Do(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function Mg(i,e){if(!e.predicate)return null;let t=`${i}_${Do(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 X0(i){let e=i.getModelMetadata(),t=Do(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=Dg(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>Ug(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=>Mg(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
1471
+ `)}var ev=`
1399
1472
  type AIModelLoadingStatus {
1400
1473
  downloaded: Boolean!
1401
1474
  loaded: Boolean!
@@ -1538,6 +1611,7 @@ type ExpressionRendered {
1538
1611
 
1539
1612
  type HostingUserInfo {
1540
1613
  email: String!
1614
+ freeAccess: Boolean!
1541
1615
  hotWalletAddress: String
1542
1616
  remainingCredits: String!
1543
1617
  }
@@ -1772,6 +1846,7 @@ type Mutation {
1772
1846
  runtimeLoginUser(email: String!, password: String!): String!
1773
1847
  runtimeOpenLink(url: String!): Boolean!
1774
1848
  runtimeQuit: Boolean!
1849
+ runtimeReinstallUnytDna: PaymentRequestResult!
1775
1850
  runtimeRemoveFriends(dids: [String!]!): [String!]!
1776
1851
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
1777
1852
  runtimeRemoveNotification(id: String!): Boolean!
@@ -1779,9 +1854,14 @@ type Mutation {
1779
1854
  runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
1780
1855
  runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
1781
1856
  runtimeRestartHolochain: Boolean!
1857
+ runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
1858
+ runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
1782
1859
  runtimeSetHotWalletAddress(address: String!): Boolean!
1783
1860
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
1784
1861
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
1862
+ runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
1863
+ runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
1864
+ runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
1785
1865
  runtimeTestEmail(to: String!): Boolean!
1786
1866
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
1787
1867
  runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
@@ -1890,11 +1970,15 @@ type Query {
1890
1970
  perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
1891
1971
  perspectiveSnapshot(uuid: String!): Perspective
1892
1972
  perspectives: [PerspectiveHandle!]!
1973
+ runtimeFreeHostingEnabled: Boolean!
1893
1974
  runtimeFriendStatus(did: String!): PerspectiveExpression
1894
1975
  runtimeFriends: [String!]!
1895
1976
  runtimeGetNetworkMetrics: String!
1896
1977
  runtimeHcAgentInfos: String!
1897
1978
  runtimeHostingUserInfo: HostingUserInfo!
1979
+ runtimeHotAgentPubkey: String!
1980
+ runtimeHotWalletBalance: String!
1981
+ runtimeHotWalletHistory(page: Float, perPage: Float): String!
1898
1982
  runtimeInfo: RuntimeInfo!
1899
1983
  runtimeKnownLinkLanguageTemplates: [String!]!
1900
1984
  runtimeListUsers: [UserStatistics!]!
@@ -1902,6 +1986,8 @@ type Query {
1902
1986
  runtimeMessageOutbox(filter: String): [SentMessage!]!
1903
1987
  runtimeMultiUserEnabled: Boolean!
1904
1988
  runtimeNotifications: [Notification!]!
1989
+ runtimeUnytAgentKey: String!
1990
+ runtimeUnytVersionInfo: String!
1905
1991
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
1906
1992
  }
1907
1993
 
@@ -1977,8 +2063,11 @@ type UserCreationResult {
1977
2063
  type UserStatistics {
1978
2064
  did: String!
1979
2065
  email: String!
2066
+ freeAccess: Boolean!
2067
+ hotWalletAddress: String
1980
2068
  lastSeen: String
1981
2069
  perspectiveCount: Int!
2070
+ remainingCredits: String!
1982
2071
  }
1983
2072
 
1984
2073
  type VerificationRequestResult {
@@ -1995,26 +2084,22 @@ input VoiceActivityParamsInput {
1995
2084
  startWindow: Float
1996
2085
  timeBeforeSpeech: Float
1997
2086
  }
1998
- `,x=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)}},Pn=new ti;Pn.author="did:ad4m:test";Pn.timestamp=Date.now();Pn.data={source:"root",target:"neighbourhood://Qm12345"};Pn.proof={signature:"",key:"",valid:!0};var Gt=new Oi;Gt.author="did:ad4m:test";Gt.timestamp=Date.now().toString();Gt.proof=new Ut("","");Gt.data=new kt([Pn]);var Va=class{};x([h(),g("design:type",String)],Va.prototype,"recipient",void 0);x([h(),g("design:type",Oi)],Va.prototype,"message",void 0);Va=x([F()],Va);var Er=class{};x([h(),g("design:type",String)],Er.prototype,"ad4mExecutorVersion",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isInitialized",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isUnlocked",void 0);Er=x([F()],Er);var qi=class{};x([h(),g("design:type",String)],qi.prototype,"title",void 0);x([h(),g("design:type",String)],qi.prototype,"message",void 0);x([h(),g("design:type",String)],qi.prototype,"type",void 0);x([h(),g("design:type",String)],qi.prototype,"addon",void 0);qi=x([F()],qi);var ut=class{};x([h(),g("design:type",String)],ut.prototype,"description",void 0);x([h(),g("design:type",String)],ut.prototype,"appName",void 0);x([h(),g("design:type",String)],ut.prototype,"appUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],ut.prototype,"trigger",void 0);x([h(),g("design:type",Array)],ut.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookAuth",void 0);ut=x([Ae()],ut);var tt=class{};x([h(),g("design:type",String)],tt.prototype,"id",void 0);x([h(),g("design:type",Boolean)],tt.prototype,"granted",void 0);x([h(),g("design:type",String)],tt.prototype,"description",void 0);x([h(),g("design:type",String)],tt.prototype,"appName",void 0);x([h(),g("design:type",String)],tt.prototype,"appUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],tt.prototype,"trigger",void 0);x([h(),g("design:type",Array)],tt.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookAuth",void 0);tt=x([F()],tt);var xr=class{};x([h(),g("design:type",tt)],xr.prototype,"notification",void 0);x([h(),g("design:type",String)],xr.prototype,"perspectiveId",void 0);x([h(),g("design:type",String)],xr.prototype,"triggerMatch",void 0);xr=x([F()],xr);var $e=class{};x([h(),g("design:type",Number)],$e.prototype,"total",void 0);x([h(),g("design:type",Number)],$e.prototype,"imported",void 0);x([h(),g("design:type",Number)],$e.prototype,"failed",void 0);x([h(),g("design:type",Number)],$e.prototype,"omitted",void 0);x([h(),g("design:type",Array)],$e.prototype,"errors",void 0);$e=x([F()],$e);var it=class{};x([h(),g("design:type",$e)],it.prototype,"perspectives",void 0);x([h(),g("design:type",$e)],it.prototype,"links",void 0);x([h(),g("design:type",$e)],it.prototype,"expressions",void 0);x([h(),g("design:type",$e)],it.prototype,"perspectiveDiffs",void 0);x([h(),g("design:type",$e)],it.prototype,"notifications",void 0);x([h(),g("design:type",$e)],it.prototype,"models",void 0);x([h(),g("design:type",$e)],it.prototype,"defaultModels",void 0);x([h(),g("design:type",$e)],it.prototype,"tasks",void 0);x([h(),g("design:type",$e)],it.prototype,"friends",void 0);x([h(),g("design:type",$e)],it.prototype,"trustedAgents",void 0);x([h(),g("design:type",$e)],it.prototype,"knownLinkLanguages",void 0);it=x([F()],it);var $r=class{};x([h(),g("design:type",String)],$r.prototype,"email",void 0);x([h(),g("design:type",String)],$r.prototype,"did",void 0);x([h(),g("design:type",String)],$r.prototype,"lastSeen",void 0);x([h(),g("design:type",Number)],$r.prototype,"perspectiveCount",void 0);$r=x([F()],$r);var Hi=class{};x([h(),g("design:type",Boolean)],Hi.prototype,"success",void 0);x([h(),g("design:type",String)],Hi.prototype,"message",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"requiresPassword",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"isExistingUser",void 0);Hi=x([F()],Hi);var Vi=class{constructor(e,t,r){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r}};x([h(),g("design:type",String)],Vi.prototype,"email",void 0);x([h(),g("design:type",String)],Vi.prototype,"remainingCredits",void 0);x([h(),g("design:type",String)],Vi.prototype,"hotWalletAddress",void 0);Vi=x([F(),g("design:paramtypes",[String,String,String])],Vi);var Ar=class{constructor(e,t){this.success=e,this.message=t}};x([h(),g("design:type",Boolean)],Ar.prototype,"success",void 0);x([h(),g("design:type",String)],Ar.prototype,"message",void 0);Ar=x([F(),g("design:paramtypes",[Boolean,String])],Ar);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 Gt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Gt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Gt}]}runtimeMessageReceived(){return Gt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:oo.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}runtimeHostingUserInfo(){return new Vi("test@example.com","100000000",null)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Ar(!0,"Mock payment of "+e+" base units credited")}};x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeQuit",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeOpenLink",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Er)],D.prototype,"runtimeInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"addTrustedAgents",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"deleteTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"getTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveFriends",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeHcAgentInfos",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeGetNetworkMetrics",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeRestartHolochain",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],D.prototype,"runtimeHcAddAgentInfos",null);x([Ge(),H(0,q()),H(1,q()),H(2,q()),H(3,q()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],D.prototype,"runtimeVerifyStringSignedByDid",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[kt]),g("design:returntype",Boolean)],D.prototype,"runtimeSetStatus",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Oi)],D.prototype,"runtimeFriendStatus",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,Ia]),g("design:returntype",Boolean)],D.prototype,"runtimeFriendSendMessage",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageInbox",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageOutbox",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Oi)],D.prototype,"runtimeMessageReceived",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",qi)],D.prototype,"exceptionOccurred",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[ut]),g("design:returntype",String)],D.prototype,"runtimeRequestInstallNotification",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeNotifications",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,ut]),g("design:returntype",Boolean)],D.prototype,"runtimeUpdateNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeRemoveNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeGrantNotification",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",xr)],D.prototype,"runtimeNotificationTriggered",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportDb",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportDb",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportPerspective",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportPerspective",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeMultiUserEnabled",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],D.prototype,"runtimeSetMultiUserEnabled",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeListUsers",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,It]),g("design:returntype",Hi)],D.prototype,"runtimeRequestLoginVerification",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],D.prototype,"runtimeVerifyEmailCode",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeTestEmail",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,It]),g("design:returntype",Di)],D.prototype,"runtimeCreateUser",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],D.prototype,"runtimeLoginUser",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeEnable",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeDisable",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],D.prototype,"runtimeEmailTestGetCode",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestClearCodes",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestSetExpiry",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Vi)],D.prototype,"runtimeHostingUserInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeSetHotWalletAddress",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Ar)],D.prototype,"runtimeRequestPayment",null);D=x([Rd()],D);var ht=class extends Le{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`
2087
+ `,S=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)},F=function(i,e){return function(t,r){e(t,r,i)}},Bn=new ci;Bn.author="did:ad4m:test";Bn.timestamp=Date.now();Bn.data={source:"root",target:"neighbourhood://Qm12345"};Bn.proof={signature:"",key:"",valid:!0};var ii=new qi;ii.author="did:ad4m:test";ii.timestamp=Date.now().toString();ii.proof=new Ht("","");ii.data=new Lt([Bn]);var Ya=class{};S([f(),p("design:type",String)],Ya.prototype,"recipient",void 0);S([f(),p("design:type",qi)],Ya.prototype,"message",void 0);Ya=S([q()],Ya);var Ir=class{};S([f(),p("design:type",String)],Ir.prototype,"ad4mExecutorVersion",void 0);S([f(),p("design:type",Boolean)],Ir.prototype,"isInitialized",void 0);S([f(),p("design:type",Boolean)],Ir.prototype,"isUnlocked",void 0);Ir=S([q()],Ir);var Zi=class{};S([f(),p("design:type",String)],Zi.prototype,"title",void 0);S([f(),p("design:type",String)],Zi.prototype,"message",void 0);S([f(),p("design:type",String)],Zi.prototype,"type",void 0);S([f(),p("design:type",String)],Zi.prototype,"addon",void 0);Zi=S([q()],Zi);var gt=class{};S([f(),p("design:type",String)],gt.prototype,"description",void 0);S([f(),p("design:type",String)],gt.prototype,"appName",void 0);S([f(),p("design:type",String)],gt.prototype,"appUrl",void 0);S([f(),p("design:type",String)],gt.prototype,"appIconPath",void 0);S([f(),p("design:type",String)],gt.prototype,"trigger",void 0);S([f(),p("design:type",Array)],gt.prototype,"perspectiveIds",void 0);S([f(),p("design:type",String)],gt.prototype,"webhookUrl",void 0);S([f(),p("design:type",String)],gt.prototype,"webhookAuth",void 0);gt=S([Ce()],gt);var st=class{};S([f(),p("design:type",String)],st.prototype,"id",void 0);S([f(),p("design:type",Boolean)],st.prototype,"granted",void 0);S([f(),p("design:type",String)],st.prototype,"description",void 0);S([f(),p("design:type",String)],st.prototype,"appName",void 0);S([f(),p("design:type",String)],st.prototype,"appUrl",void 0);S([f(),p("design:type",String)],st.prototype,"appIconPath",void 0);S([f(),p("design:type",String)],st.prototype,"trigger",void 0);S([f(),p("design:type",Array)],st.prototype,"perspectiveIds",void 0);S([f(),p("design:type",String)],st.prototype,"webhookUrl",void 0);S([f(),p("design:type",String)],st.prototype,"webhookAuth",void 0);st=S([q()],st);var Tr=class{};S([f(),p("design:type",st)],Tr.prototype,"notification",void 0);S([f(),p("design:type",String)],Tr.prototype,"perspectiveId",void 0);S([f(),p("design:type",String)],Tr.prototype,"triggerMatch",void 0);Tr=S([q()],Tr);var Te=class{};S([f(),p("design:type",Number)],Te.prototype,"total",void 0);S([f(),p("design:type",Number)],Te.prototype,"imported",void 0);S([f(),p("design:type",Number)],Te.prototype,"failed",void 0);S([f(),p("design:type",Number)],Te.prototype,"omitted",void 0);S([f(),p("design:type",Array)],Te.prototype,"errors",void 0);Te=S([q()],Te);var ot=class{};S([f(),p("design:type",Te)],ot.prototype,"perspectives",void 0);S([f(),p("design:type",Te)],ot.prototype,"links",void 0);S([f(),p("design:type",Te)],ot.prototype,"expressions",void 0);S([f(),p("design:type",Te)],ot.prototype,"perspectiveDiffs",void 0);S([f(),p("design:type",Te)],ot.prototype,"notifications",void 0);S([f(),p("design:type",Te)],ot.prototype,"models",void 0);S([f(),p("design:type",Te)],ot.prototype,"defaultModels",void 0);S([f(),p("design:type",Te)],ot.prototype,"tasks",void 0);S([f(),p("design:type",Te)],ot.prototype,"friends",void 0);S([f(),p("design:type",Te)],ot.prototype,"trustedAgents",void 0);S([f(),p("design:type",Te)],ot.prototype,"knownLinkLanguages",void 0);ot=S([q()],ot);var zt=class{};S([f(),p("design:type",String)],zt.prototype,"email",void 0);S([f(),p("design:type",String)],zt.prototype,"did",void 0);S([f(),p("design:type",String)],zt.prototype,"lastSeen",void 0);S([f(),p("design:type",Number)],zt.prototype,"perspectiveCount",void 0);S([f(),p("design:type",String)],zt.prototype,"remainingCredits",void 0);S([f(),p("design:type",Boolean)],zt.prototype,"freeAccess",void 0);S([f(),p("design:type",String)],zt.prototype,"hotWalletAddress",void 0);zt=S([q()],zt);var Ji=class{};S([f(),p("design:type",Boolean)],Ji.prototype,"success",void 0);S([f(),p("design:type",String)],Ji.prototype,"message",void 0);S([f(),p("design:type",Boolean)],Ji.prototype,"requiresPassword",void 0);S([f(),p("design:type",Boolean)],Ji.prototype,"isExistingUser",void 0);Ji=S([q()],Ji);var fi=class{constructor(e,t,r,n=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r,this.freeAccess=n}};S([f(),p("design:type",String)],fi.prototype,"email",void 0);S([f(),p("design:type",String)],fi.prototype,"remainingCredits",void 0);S([f(),p("design:type",String)],fi.prototype,"hotWalletAddress",void 0);S([f(),p("design:type",Boolean)],fi.prototype,"freeAccess",void 0);fi=S([q(),p("design:paramtypes",[String,String,String,Boolean])],fi);var ht=class{constructor(e,t){this.success=e,this.message=t}};S([f(),p("design:type",Boolean)],ht.prototype,"success",void 0);S([f(),p("design:type",String)],ht.prototype,"message",void 0);ht=S([q(),p("design:paramtypes",[Boolean,String])],ht);var O=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 ii}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[ii]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:ii}]}runtimeMessageReceived(){return ii}exceptionOccurred(){return{title:"Test title",message:"Test message",type:vo.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}runtimeFreeHostingEnabled(){return!0}runtimeSetFreeHostingEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5,remainingCredits:"0",freeAccess:!1}]}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 zi("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}runtimeHostingUserInfo(){return new fi("test@example.com","100000000",null,!1)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new ht(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new ht(!0,"")}runtimeSendHot(e,t){return new ht(!0,"")}runtimeSetUnytMembraneProof(e){return new ht(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytAgentKey(){return""}runtimeUnytVersionInfo(){return""}};S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeQuit",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeOpenLink",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Ir)],O.prototype,"runtimeInfo",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"addTrustedAgents",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"deleteTrustedAgents",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"getTrustedAgents",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeKnownLinkLanguageTemplates",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddKnownLinkLanguageTemplates",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeFriends",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddFriends",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveFriends",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHcAgentInfos",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeGetNetworkMetrics",null);S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeRestartHolochain",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",Boolean)],O.prototype,"runtimeHcAddAgentInfos",null);S([Ee(),F(0,M()),F(1,M()),F(2,M()),F(3,M()),p("design:type",Function),p("design:paramtypes",[String,String,String,String]),p("design:returntype",void 0)],O.prototype,"runtimeVerifyStringSignedByDid",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Lt]),p("design:returntype",Boolean)],O.prototype,"runtimeSetStatus",null);S([Ee(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",qi)],O.prototype,"runtimeFriendStatus",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,Da]),p("design:returntype",Boolean)],O.prototype,"runtimeFriendSendMessage",null);S([Ee(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageInbox",null);S([Ee(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageOutbox",null);S([_o(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",qi)],O.prototype,"runtimeMessageReceived",null);S([_o(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Zi)],O.prototype,"exceptionOccurred",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[gt]),p("design:returntype",String)],O.prototype,"runtimeRequestInstallNotification",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeNotifications",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,gt]),p("design:returntype",Boolean)],O.prototype,"runtimeUpdateNotification",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeRemoveNotification",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeGrantNotification",null);S([_o(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Tr)],O.prototype,"runtimeNotificationTriggered",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportDb",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportDb",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportPerspective",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportPerspective",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeMultiUserEnabled",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetMultiUserEnabled",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeFreeHostingEnabled",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetFreeHostingEnabled",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeListUsers",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,Pt]),p("design:returntype",Ji)],O.prototype,"runtimeRequestLoginVerification",null);S([Y(),F(0,M()),F(1,M()),F(2,M()),p("design:type",Function),p("design:paramtypes",[String,String,String]),p("design:returntype",String)],O.prototype,"runtimeVerifyEmailCode",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeTestEmail",null);S([Y(),F(0,M()),F(1,M()),F(2,M()),p("design:type",Function),p("design:paramtypes",[String,String,Pt]),p("design:returntype",zi)],O.prototype,"runtimeCreateUser",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",String)],O.prototype,"runtimeLoginUser",null);S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeEnable",null);S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeDisable",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",String)],O.prototype,"runtimeEmailTestGetCode",null);S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestClearCodes",null);S([Y(),F(0,M()),F(1,M()),F(2,M()),p("design:type",Function),p("design:paramtypes",[String,String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestSetExpiry",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",fi)],O.prototype,"runtimeHostingUserInfo",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeSetHotWalletAddress",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",ht)],O.prototype,"runtimeRequestPayment",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserCredits",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserFreeAccess",null);S([Y(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",ht)],O.prototype,"runtimeReinstallUnytDna",null);S([Y(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",ht)],O.prototype,"runtimeSendHot",null);S([Y(),F(0,M()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",ht)],O.prototype,"runtimeSetUnytMembraneProof",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotWalletBalance",null);S([Ee(),F(0,M()),F(1,M()),p("design:type",Function),p("design:paramtypes",[Number,Number]),p("design:returntype",String)],O.prototype,"runtimeHotWalletHistory",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotAgentPubkey",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeUnytAgentKey",null);S([Ee(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeUnytVersionInfo",null);O=S([tp()],O);var mt=class extends ge{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode="";this.verifying=!1}willUpdate(t){t.has("verificationError")&&this.verificationError&&(this.verifying=!1)}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.verifying=!0,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 k`
1999
2088
  <div class="container">
2000
- <div class="back-button" @click=${this.back}>
2001
- ${nr()}
2002
- </div>
2003
-
2004
2089
  <div class="header">
2005
2090
  <h1>${this.appname}</h1>
2006
2091
  <h3>wants to access your AD4M data</h3>
2007
2092
  </div>
2008
2093
 
2009
2094
  <div class="connection-icons">
2010
- ${this.appiconpath?N`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:N`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2011
- <div class="arrow-icon">${zn()}</div>
2012
- <div class="ad4m-logo">${mi()}</div>
2095
+ ${this.appiconpath?k`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:k`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2096
+ <div class="arrow-icon">${Jn()}</div>
2097
+ <div class="ad4m-logo">${Ei()}</div>
2013
2098
  </div>
2014
2099
 
2015
- ${this.requestSent?N`
2100
+ ${this.requestSent?k`
2016
2101
  <div class="state success" style="margin-bottom: -12px">
2017
- ${dt()}
2102
+ ${Qe()}
2018
2103
  <p>Auth request sent to local AD4M node</p>
2019
2104
  </div>
2020
2105
 
@@ -2030,19 +2115,20 @@ input VoiceActivityParamsInput {
2030
2115
  .value=${this.securityCode||""}
2031
2116
  @input=${this.onInputChange}
2032
2117
  />
2118
+ ${this.verifying?k`<div class="spinner"></div>`:""}
2033
2119
  </div>
2034
2120
 
2035
- ${this.verificationError?N`
2121
+ ${this.verificationError?k`
2036
2122
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2037
- ${Oe()}
2123
+ ${Ue()}
2038
2124
  <p>Verification failed. Please try again.</p>
2039
2125
  </div>
2040
2126
  `:""}
2041
- `:N`
2127
+ `:k`
2042
2128
  <p>This will allow ${this.appname} to</p>
2043
2129
 
2044
2130
  <ul class="box">
2045
- ${this.capabilities.map(t=>N`<li>${dt()}<p>${Nl(t)}</p></li>`)}
2131
+ ${this.capabilities.map(t=>k`<li>${Qe()}<p>${Gl(t)}</p></li>`)}
2046
2132
  </ul>
2047
2133
 
2048
2134
  <div class="row center">
@@ -2052,7 +2138,7 @@ input VoiceActivityParamsInput {
2052
2138
  </div>
2053
2139
  `}
2054
2140
  </div>
2055
- `}};ht.styles=[Bt,Je`
2141
+ `}};mt.styles=[Ge,$e`
2056
2142
  h1 {
2057
2143
  font-size: 34px;
2058
2144
  }
@@ -2117,7 +2203,9 @@ input VoiceActivityParamsInput {
2117
2203
  .security-code {
2118
2204
  width: 100%;
2119
2205
  display: flex;
2206
+ align-items: center;
2120
2207
  justify-content: center;
2208
+ gap: 12px;
2121
2209
  margin-bottom: 20px;
2122
2210
  }
2123
2211
 
@@ -2134,18 +2222,15 @@ input VoiceActivityParamsInput {
2134
2222
  .state {
2135
2223
  justify-content: center;
2136
2224
  }
2137
- `],j([fe({type:Array})],ht.prototype,"capabilities",2),j([fe({type:String})],ht.prototype,"appname",2),j([fe({type:String})],ht.prototype,"appiconpath",2),j([fe({type:Boolean})],ht.prototype,"verificationError",2),j([ue()],ht.prototype,"requestSent",2),j([ue()],ht.prototype,"securityCode",2),ht=j([gt("local-authentication")],ht);var nt=class extends Le{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`
2225
+ `],C([ie({type:Array})],mt.prototype,"capabilities",2),C([ie({type:String})],mt.prototype,"appname",2),C([ie({type:String})],mt.prototype,"appiconpath",2),C([ie({type:Boolean})],mt.prototype,"verificationError",2),C([Z()],mt.prototype,"requestSent",2),C([Z()],mt.prototype,"securityCode",2),C([Z()],mt.prototype,"verifying",2),mt=C([Ne("local-authentication")],mt);var Ve=class extends ge{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.host=null;this.email="";this.password="";this.emailSecurityCode="";this.confirmPassword=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.clearSensitiveState()}clearSensitiveState(){this.password="",this.confirmPassword="",this.emailSecurityCode="",this.email=""}tryAgain(){this.clearSensitiveState(),this.dispatchEvent(new CustomEvent("reset-auth-state",{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()}get passwordsMatch(){return this.password.length>0&&this.password===this.confirmPassword}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 k`
2138
2226
  <div class="container">
2139
- <div class="back-button" @click=${this.back}>
2140
- ${nr()}
2141
- </div>
2142
-
2143
2227
  <div class="header">
2144
- <h1>Login</h1>
2228
+ <h1 style="font-size: 28px;">${n?"Login":a?"Register":"Login or Register"}</h1>
2229
+ ${this.host?k`<p style="font-size: 15px; color: rgba(255,255,255,0.4); margin-top: 10px;">${this.host.url}</p>`:""}
2145
2230
  </div>
2146
2231
 
2147
- ${t?N`
2148
- <h3>Enter your email to login to the remote node</h3>
2232
+ ${t?k`
2233
+ <h3>Enter your email to login to ${this.host?k`<strong>${this.host.name}</strong>`:"the remote node"}</h3>
2149
2234
 
2150
2235
  <div class="input-row">
2151
2236
  <input
@@ -2159,27 +2244,24 @@ input VoiceActivityParamsInput {
2159
2244
 
2160
2245
  <div class="login-button" style="margin-top: 10px;">
2161
2246
  <button class="primary" @click=${this.emailLogin} .disabled=${this.remoteAuthLoading||!this.isValidEmail()}>
2162
- ${this.remoteAuthLoading?"Loading...":"Login"}
2247
+ ${this.remoteAuthLoading?"Loading...":"Continue"}
2163
2248
  </button>
2164
2249
  </div>
2165
2250
  `:""}
2166
2251
 
2167
- ${s?N`
2252
+ ${s?k`
2168
2253
  <div class="state danger">
2169
- ${Oe()}
2254
+ ${Ue()}
2170
2255
  <p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
2171
2256
  </div>
2172
-
2173
- <div class="login-button">
2174
- <button class="primary" @click=${this.back}>
2175
- Back
2176
- </button>
2257
+ <div class="login-button" style="margin-top: 10px;">
2258
+ <button class="primary" @click=${this.tryAgain}>Try again</button>
2177
2259
  </div>
2178
2260
  `:""}
2179
2261
 
2180
- ${r?N`
2262
+ ${r?k`
2181
2263
  <div class="state success" style="margin-bottom: -12px">
2182
- ${dt()}
2264
+ ${Qe()}
2183
2265
  <p>Email verification code sent</p>
2184
2266
  </div>
2185
2267
 
@@ -2195,19 +2277,20 @@ input VoiceActivityParamsInput {
2195
2277
  .value=${this.emailSecurityCode||""}
2196
2278
  @input=${this.onEmailSecurityCodeChange}
2197
2279
  />
2280
+ ${this.remoteAuthLoading?k`<div class="spinner"></div>`:""}
2198
2281
  </div>
2199
2282
 
2200
- ${this.emailCodeError?N`
2283
+ ${this.emailCodeError?k`
2201
2284
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2202
- ${Oe()}
2285
+ ${Ue()}
2203
2286
  <p>Verification failed. Please try again.</p>
2204
2287
  </div>
2205
2288
  `:""}
2206
2289
  `:""}
2207
2290
 
2208
- ${n?N`
2291
+ ${n?k`
2209
2292
  <div class="state success" style="margin-bottom: -12px">
2210
- ${dt()}
2293
+ ${Qe()}
2211
2294
  <p>Account found</p>
2212
2295
  </div>
2213
2296
 
@@ -2229,21 +2312,21 @@ input VoiceActivityParamsInput {
2229
2312
  </button>
2230
2313
  </div>
2231
2314
 
2232
- ${this.passwordError?N`
2315
+ ${this.passwordError?k`
2233
2316
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2234
- ${Oe()}
2317
+ ${Ue()}
2235
2318
  <p>Incorrect password. Please try again.</p>
2236
2319
  </div>
2237
2320
  `:""}
2238
2321
  `:""}
2239
2322
 
2240
- ${a?N`
2241
- <div class="state danger">
2242
- ${Oe()}
2243
- <p>Email not found</p>
2323
+ ${a?k`
2324
+ <div class="state success">
2325
+ ${Qe()}
2326
+ <p>Creating a new account for <strong>${this.email}</strong></p>
2244
2327
  </div>
2245
2328
 
2246
- <h3>Enter a password to create a new account</h3>
2329
+ <h3>Choose a password</h3>
2247
2330
 
2248
2331
  <div class="input-row">
2249
2332
  <input
@@ -2251,26 +2334,37 @@ input VoiceActivityParamsInput {
2251
2334
  placeholder="Password..."
2252
2335
  .value=${this.password||""}
2253
2336
  @input=${o=>{let l=o.target;this.password=l.value}}
2254
- @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.createAccount()}}
2255
2337
  />
2256
2338
  </div>
2257
2339
 
2340
+ <div class="input-row" style="margin-top: 8px;">
2341
+ <input
2342
+ type="password"
2343
+ placeholder="Confirm password..."
2344
+ .value=${this.confirmPassword||""}
2345
+ @input=${o=>{let l=o.target;this.confirmPassword=l.value}}
2346
+ @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.passwordsMatch&&this.createAccount()}}
2347
+ />
2348
+ </div>
2349
+
2350
+ ${this.confirmPassword.length>0&&!this.passwordsMatch?k`<p style="font-size: 13px; color: var(--ac-danger-color); text-align: center;">Passwords do not match</p>`:""}
2351
+
2258
2352
  <div class="login-button">
2259
- <button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.password.length}>
2353
+ <button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.passwordsMatch}>
2260
2354
  ${this.remoteAuthLoading?"Loading...":"Create Account"}
2261
2355
  </button>
2262
2356
  </div>
2263
2357
 
2264
- ${this.accountCreationError?N`
2358
+ ${this.accountCreationError?k`
2265
2359
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2266
- ${Oe()}
2360
+ ${Ue()}
2267
2361
  <p>Failed to create account. Please try again.</p>
2268
2362
  </div>
2269
2363
  `:""}
2270
2364
  `:""}
2271
2365
 
2272
2366
  </div>
2273
- `}};nt.styles=[Bt,Je`
2367
+ `}};Ve.styles=[Ge,$e`
2274
2368
  .header h1 {
2275
2369
  font-size: 32px;
2276
2370
  margin-bottom: 0;
@@ -2293,7 +2387,9 @@ input VoiceActivityParamsInput {
2293
2387
  .security-code {
2294
2388
  width: 100%;
2295
2389
  display: flex;
2390
+ align-items: center;
2296
2391
  justify-content: center;
2392
+ gap: 12px;
2297
2393
  margin-bottom: 20px;
2298
2394
  }
2299
2395
 
@@ -2316,10 +2412,10 @@ input VoiceActivityParamsInput {
2316
2412
  .state {
2317
2413
  justify-content: center;
2318
2414
  }
2319
- `],j([fe({type:Object})],nt.prototype,"remoteAuthState",2),j([fe({type:Boolean})],nt.prototype,"remoteAuthLoading",2),j([fe({type:Boolean})],nt.prototype,"emailCodeError",2),j([fe({type:Boolean})],nt.prototype,"passwordError",2),j([fe({type:Boolean})],nt.prototype,"accountCreationError",2),j([ue()],nt.prototype,"email",2),j([ue()],nt.prototype,"password",2),j([ue()],nt.prototype,"emailSecurityCode",2),nt=j([gt("remote-authentication")],nt);var li=class extends Le{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`
2415
+ `],C([ie({type:Object})],Ve.prototype,"remoteAuthState",2),C([ie({type:Boolean})],Ve.prototype,"remoteAuthLoading",2),C([ie({type:Boolean})],Ve.prototype,"emailCodeError",2),C([ie({type:Boolean})],Ve.prototype,"passwordError",2),C([ie({type:Boolean})],Ve.prototype,"accountCreationError",2),C([ie({type:Object})],Ve.prototype,"host",2),C([Z()],Ve.prototype,"email",2),C([Z()],Ve.prototype,"password",2),C([Z()],Ve.prototype,"emailSecurityCode",2),C([Z()],Ve.prototype,"confirmPassword",2),Ve=C([Ne("remote-authentication")],Ve);var yi=class extends ge{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 k`
2320
2416
  <div class="container">
2321
2417
  <div class="close-button" @click=${this.close}>
2322
- ${Oe()}
2418
+ ${Ue()}
2323
2419
  </div>
2324
2420
 
2325
2421
  <div class="header">
@@ -2329,11 +2425,11 @@ input VoiceActivityParamsInput {
2329
2425
 
2330
2426
  <div class="box">
2331
2427
  <div class="box-header">
2332
- ${t?ir():rr()}
2428
+ ${t?lr():Qn()}
2333
2429
  <h3>${t?"Local Node":"Remote Node"}</h3>
2334
2430
  </div>
2335
2431
 
2336
- ${t?N`
2432
+ ${t?k`
2337
2433
  <div class="row">
2338
2434
  <span>Port:</span>
2339
2435
  <span class="detail-value">${this.port}</span>
@@ -2342,7 +2438,7 @@ input VoiceActivityParamsInput {
2342
2438
  <span>URL:</span>
2343
2439
  <span class="detail-value">${this.url}</span>
2344
2440
  </div>
2345
- `:N`
2441
+ `:k`
2346
2442
  <div class="row">
2347
2443
  <span>URL:</span>
2348
2444
  <span class="detail-value">${this.url}</span>
@@ -2361,7 +2457,7 @@ input VoiceActivityParamsInput {
2361
2457
  </button>
2362
2458
  </div>
2363
2459
  </div>
2364
- `}};li.styles=[Bt,Je`
2460
+ `}};yi.styles=[Ge,$e`
2365
2461
  .box {
2366
2462
  gap: 15px;
2367
2463
  }
@@ -2396,10 +2492,816 @@ input VoiceActivityParamsInput {
2396
2492
  background: rgba(244, 54, 127, 0.2);
2397
2493
  color: var(--ac-danger-color);
2398
2494
  }
2399
- `],j([fe({type:String})],li.prototype,"url",2),j([fe({type:Number})],li.prototype,"port",2),j([fe({type:String})],li.prototype,"authState",2),li=j([gt("current-state")],li);var yg=Je`
2495
+ `],C([ie({type:String})],yi.prototype,"url",2),C([ie({type:Number})],yi.prototype,"port",2),C([ie({type:String})],yi.prototype,"authState",2),yi=C([Ne("current-state")],yi);function ls(i,e){let t=uc(i.id||i.name),r=lc(i.name);if(i.profilePicUrl){let n=a=>{let s=a.target,o=document.createElement("div");o.className=`${e} fallback`,o.style.background=`hsl(${t},60%,35%)`,o.textContent=r,s.replaceWith(o)};return k`<img class=${e} src=${i.profilePicUrl} alt="" @error=${n} />`}return k`<div class="${e} fallback" style="background:hsl(${t},60%,35%)">${r}</div>`}var yt=class extends ge{constructor(){super(...arguments);this.hosts=[];this.loading=!1;this.error=null;this.lastHostId=null;this.defaultUrl="";this.manualUrl="";this.manualUrlError=null;this.defaultApplied=!1}willUpdate(t){t.has("defaultUrl")&&this.defaultUrl&&!this.defaultApplied&&(this.manualUrl=this.defaultUrl,this.defaultApplied=!0)}selectHost(t){this.dispatchEvent(new CustomEvent("select-host",{detail:{host:t},bubbles:!0,composed:!0}))}connectManualUrl(){let t=this.manualUrl.trim();if(!t)return;let r;try{r=new URL(t)}catch(a){this.manualUrlError="Invalid URL format";return}if(r.protocol!=="ws:"&&r.protocol!=="wss:"){this.manualUrlError="URL must use ws:// or wss:// protocol";return}this.manualUrlError=null;let n={id:`manual-${Date.now()}`,name:r.hostname,profilePicUrl:"",location:"Custom URL",url:t,rates:[],aiModels:[]};this.selectHost(n)}renderAvatar(t){return ls(t,"host-avatar")}retry(){this.dispatchEvent(new CustomEvent("retry",{bubbles:!0,composed:!0}))}formatPrice(t){return t===0?"0.00":t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}getLinkPrice(t){let r=t.find(n=>n.description.trim().toLowerCase()==="link write");return r?r.priceInHOT:null}getAvgTokenPrice(t){let r=t.filter(n=>n.description.trim().toLowerCase()!=="link write");return r.length===0?null:r.reduce((n,a)=>n+a.priceInHOT,0)/r.length}getSortedHosts(){if(!this.lastHostId)return this.hosts;let t=this.hosts.filter(n=>n.id===this.lastHostId),r=this.hosts.filter(n=>n.id!==this.lastHostId);return[...t,...r]}render(){return k`
2496
+ <div class="container">
2497
+ <div class="header">
2498
+ <h1>Remote Node</h1>
2499
+ <h3>Choose a host or enter a URL</h3>
2500
+ </div>
2501
+
2502
+ <div class="trust-notice">
2503
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="rgba(255, 200, 50, 0.9)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
2504
+ <path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/>
2505
+ <line x1="12" y1="9" x2="12" y2="13"/>
2506
+ <line x1="12" y1="17" x2="12.01" y2="17"/>
2507
+ </svg>
2508
+ <span>By connecting to a remote host, you are trusting them to run AD4M on your behalf. Your data will be stored on their machine and they will have access to your agent's operations. Only connect to hosts you trust.</span>
2509
+ </div>
2510
+
2511
+ ${this.loading?k`
2512
+ <div class="spinner-container"><div class="spinner"></div></div>
2513
+ `:this.error?k`
2514
+ <div class="box">
2515
+ <p style="color: var(--ac-danger-color)">${this.error}</p>
2516
+ <button class="primary" @click=${this.retry}>Retry</button>
2517
+ </div>
2518
+ `:k`
2519
+ <div class="host-list">
2520
+ ${this.getSortedHosts().map(t=>k`
2521
+ <div
2522
+ class="host-card ${t.id===this.lastHostId?"pinned":""}"
2523
+ tabindex="0"
2524
+ role="button"
2525
+ aria-label="Connect to ${t.name}"
2526
+ @click=${()=>this.selectHost(t)}
2527
+ @keydown=${r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.selectHost(t))}}
2528
+ >
2529
+ ${this.renderAvatar(t)}
2530
+ <div class="host-info">
2531
+ <div style="display:flex;align-items:center;gap:8px;">
2532
+ <p class="host-name">${t.name}</p>
2533
+ ${t.id===this.lastHostId?k`<span class="pinned-label">Last used</span>`:""}
2534
+ </div>
2535
+ <p class="host-location">${Qt()}${t.location}</p>
2536
+ <div class="host-meta">
2537
+ ${t.aiModels.map(r=>k`<span class="model-chip">${r}</span>`)}
2538
+ </div>
2539
+ ${t.rates.length>0?(()=>{let r=this.getLinkPrice(t.rates),n=this.getAvgTokenPrice(t.rates);return k`
2540
+ <p class="rates-preview">
2541
+ ${r!=null?k`Link: ${this.formatPrice(r)} wHOT`:""}${r!=null&&n!=null?" \xB7 ":""}${n!=null?k`Token: ~${this.formatPrice(n)} wHOT`:""}
2542
+ </p>
2543
+ `})():""}
2544
+ </div>
2545
+ </div>
2546
+ `)}
2547
+ </div>
2548
+ `}
2549
+
2550
+ <div class="divider"><span>or enter URL directly</span></div>
2551
+
2552
+ <div class="manual-entry">
2553
+ <input
2554
+ type="text"
2555
+ placeholder="wss://your-host.example/graphql"
2556
+ .value=${this.manualUrl}
2557
+ @input=${t=>{this.manualUrl=t.target.value,this.manualUrlError=null}}
2558
+ @keydown=${t=>{t.key==="Enter"&&this.connectManualUrl()}}
2559
+ style="font-size: 14px;"
2560
+ />
2561
+ <button
2562
+ class="primary"
2563
+ ?disabled=${!this.manualUrl.trim()}
2564
+ @click=${this.connectManualUrl}
2565
+ >
2566
+ Connect
2567
+ </button>
2568
+ </div>
2569
+ ${this.manualUrlError?k`<p class="state danger" style="margin-top: 6px; font-size: 13px;">${this.manualUrlError}</p>`:""}
2570
+ </div>
2571
+ `}};yt.styles=[Ge,$e`
2572
+ :host {
2573
+ display: flex;
2574
+ flex-direction: column;
2575
+ min-height: 0;
2576
+ flex: 1 1 auto;
2577
+ }
2578
+
2579
+ .container {
2580
+ flex: 1 1 auto;
2581
+ min-height: 0;
2582
+ overflow: hidden;
2583
+ }
2584
+
2585
+ .host-list {
2586
+ display: flex;
2587
+ flex-direction: column;
2588
+ gap: 12px;
2589
+ max-height: min(500px, calc(100vh - 380px));
2590
+ overflow-y: auto;
2591
+ padding: 2px;
2592
+ }
2593
+
2594
+ .host-card {
2595
+ display: flex;
2596
+ align-items: center;
2597
+ gap: 16px;
2598
+ padding: 14px;
2599
+ border-radius: 8px;
2600
+ background: rgba(128, 178, 201, 0.10);
2601
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
2602
+ cursor: pointer;
2603
+ transition: all 0.2s ease;
2604
+ }
2605
+
2606
+ .host-card:hover,
2607
+ .host-card:focus-visible {
2608
+ background: rgba(128, 178, 201, 0.20);
2609
+ box-shadow: 0 0 0 1px var(--ac-primary-color);
2610
+ outline: none;
2611
+ }
2612
+
2613
+ .host-card.pinned {
2614
+ box-shadow: 0 0 0 1px var(--ac-primary-color);
2615
+ background: rgba(128, 178, 201, 0.16);
2616
+ }
2617
+
2618
+ .host-avatar {
2619
+ width: 60px;
2620
+ height: 60px;
2621
+ border-radius: 50%;
2622
+ flex-shrink: 0;
2623
+ object-fit: cover;
2624
+ background: rgba(128, 178, 201, 0.2);
2625
+ }
2626
+
2627
+ .host-avatar.fallback {
2628
+ display: flex;
2629
+ align-items: center;
2630
+ justify-content: center;
2631
+ font-size: 16px;
2632
+ font-weight: 600;
2633
+ color: #fff;
2634
+ }
2635
+
2636
+ .host-info {
2637
+ flex: 1;
2638
+ min-width: 0;
2639
+ }
2640
+
2641
+ .host-name {
2642
+ font-size: 15px;
2643
+ font-weight: 600;
2644
+ color: #ffffff;
2645
+ margin: 0;
2646
+ text-align: left;
2647
+ }
2648
+
2649
+ .host-location {
2650
+ display: inline-flex;
2651
+ align-items: center;
2652
+ gap: 4px;
2653
+ font-size: 13px;
2654
+ color: rgba(255, 255, 255, 0.6);
2655
+ margin: 2px 0 0 0;
2656
+ text-align: left;
2657
+ }
2658
+
2659
+ .host-location svg {
2660
+ opacity: 0.7;
2661
+ }
2662
+
2663
+ .host-meta {
2664
+ display: flex;
2665
+ flex-wrap: wrap;
2666
+ gap: 4px;
2667
+ margin-top: 6px;
2668
+ }
2669
+
2670
+ .model-chip {
2671
+ font-size: 12px;
2672
+ padding: 3px 8px;
2673
+ border-radius: 10px;
2674
+ background: rgba(145, 227, 253, 0.15);
2675
+ color: var(--ac-primary-color);
2676
+ white-space: nowrap;
2677
+ }
2678
+
2679
+ .rates-preview {
2680
+ font-size: 12px;
2681
+ color: rgba(255, 255, 255, 0.5);
2682
+ margin-top: 6px;
2683
+ text-align: left;
2684
+ }
2685
+
2686
+ .spinner-container {
2687
+ display: flex;
2688
+ justify-content: center;
2689
+ padding: 40px 0;
2690
+ }
2691
+
2692
+ .spinner-container .spinner {
2693
+ width: 32px;
2694
+ height: 32px;
2695
+ }
2696
+
2697
+ .divider {
2698
+ display: flex;
2699
+ align-items: center;
2700
+ gap: 12px;
2701
+ margin: 8px 0;
2702
+ }
2703
+
2704
+ .divider::before,
2705
+ .divider::after {
2706
+ content: "";
2707
+ flex: 1;
2708
+ height: 1px;
2709
+ background: var(--ac-border-color-light);
2710
+ }
2711
+
2712
+ .divider span {
2713
+ font-size: 13px;
2714
+ color: rgba(255, 255, 255, 0.4);
2715
+ white-space: nowrap;
2716
+ }
2717
+
2718
+ .manual-entry {
2719
+ display: flex;
2720
+ gap: 8px;
2721
+ width: 100%;
2722
+ padding: 2px;
2723
+ }
2724
+
2725
+ .manual-entry input {
2726
+ flex: 1;
2727
+ }
2728
+
2729
+ .manual-entry button {
2730
+ width: auto;
2731
+ flex-shrink: 0;
2732
+ }
2733
+
2734
+ .trust-notice {
2735
+ display: flex;
2736
+ gap: 10px;
2737
+ padding: 12px 14px;
2738
+ border-radius: 8px;
2739
+ background: rgba(255, 200, 50, 0.08);
2740
+ border: 1px solid rgba(255, 200, 50, 0.25);
2741
+ margin-bottom: 12px;
2742
+ font-size: 13px;
2743
+ line-height: 1.45;
2744
+ color: rgba(255, 255, 255, 0.75);
2745
+ }
2746
+
2747
+ .trust-notice svg {
2748
+ flex-shrink: 0;
2749
+ margin-top: 1px;
2750
+ }
2751
+
2752
+ .pinned-label {
2753
+ font-size: 11px;
2754
+ color: var(--ac-primary-color);
2755
+ text-transform: uppercase;
2756
+ letter-spacing: 0.5px;
2757
+ font-weight: 600;
2758
+ }
2759
+ `],C([ie({type:Array})],yt.prototype,"hosts",2),C([ie({type:Boolean})],yt.prototype,"loading",2),C([ie({type:String})],yt.prototype,"error",2),C([ie({type:String})],yt.prototype,"lastHostId",2),C([ie({type:String})],yt.prototype,"defaultUrl",2),C([Z()],yt.prototype,"manualUrl",2),C([Z()],yt.prototype,"manualUrlError",2),yt=C([Ne("host-browser")],yt);var Vt=class extends ge{proceedToAuth(){this.dispatchEvent(new CustomEvent("proceed-to-auth",{detail:{host:this.host},bubbles:!0,composed:!0}))}renderAvatar(){return ls(this.host,"profile-pic")}isOperationRate(t){return Vt.OPERATION_RATES.has(t.description)}rateLabel(t){return t==="link write"?"Link write":t}formatPrice(t){return t===0?"0.00":t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}render(){return this.host?k`
2760
+ <div class="container">
2761
+ <div class="profile">
2762
+ ${this.renderAvatar()}
2763
+ <p class="profile-name">${this.host.name}</p>
2764
+ <p class="profile-location">${Qt()}${this.host.location}</p>
2765
+ ${this.host.description?k`<p class="profile-description">${this.host.description}</p>`:""}
2766
+
2767
+ ${this.host.aiModels.length>0?k`
2768
+ <div class="models">
2769
+ ${this.host.aiModels.map(t=>k`<span class="model-chip">${t}</span>`)}
2770
+ </div>
2771
+ `:""}
2772
+ </div>
2773
+
2774
+ ${this.host.rates.length>0?k`
2775
+ <div class="box">
2776
+ <div class="rates-section">
2777
+ <h3>Pricing</h3>
2778
+ <table class="rates-table">
2779
+ ${this.host.rates.filter(t=>this.isOperationRate(t)).map(t=>k`
2780
+ <tr>
2781
+ <td>${this.rateLabel(t.description)}</td>
2782
+ <td>${this.formatPrice(t.priceInHOT)} wHOT</td>
2783
+ </tr>
2784
+ `)}
2785
+ ${this.host.rates.filter(t=>!this.isOperationRate(t)).length>0?k`
2786
+ <tr><td colspan="2" style="text-align:left;padding-top:12px;color:rgba(255,255,255,0.5);font-size:12px;text-transform:uppercase;letter-spacing:0.5px;">AI Models (cost per token)</td></tr>
2787
+ ${this.host.rates.filter(t=>!this.isOperationRate(t)).map(t=>k`
2788
+ <tr>
2789
+ <td>${t.description}</td>
2790
+ <td>${this.formatPrice(t.priceInHOT)} wHOT</td>
2791
+ </tr>
2792
+ `)}
2793
+ `:""}
2794
+ </table>
2795
+ </div>
2796
+ </div>
2797
+ `:""}
2798
+
2799
+ ${this.host.computeSpecs?k`
2800
+ <div class="box">
2801
+ <div class="rates-section">
2802
+ <h3>Compute</h3>
2803
+ <p class="compute-specs">${this.host.computeSpecs}</p>
2804
+ </div>
2805
+ </div>
2806
+ `:""}
2807
+
2808
+ <button class="primary connect-button" @click=${this.proceedToAuth}>
2809
+ Connect to ${this.host.name}
2810
+ </button>
2811
+ </div>
2812
+ `:null}};Vt.styles=[Ge,$e`
2813
+ .profile {
2814
+ display: flex;
2815
+ flex-direction: column;
2816
+ align-items: center;
2817
+ gap: 10px;
2818
+ }
2819
+
2820
+ .profile-pic {
2821
+ width: 100px;
2822
+ height: 100px;
2823
+ border-radius: 50%;
2824
+ object-fit: cover;
2825
+ background: rgba(128, 178, 201, 0.2);
2826
+ }
2827
+
2828
+ .profile-pic.fallback {
2829
+ display: flex;
2830
+ align-items: center;
2831
+ justify-content: center;
2832
+ font-size: 28px;
2833
+ font-weight: 600;
2834
+ color: #fff;
2835
+ }
2836
+
2837
+ .profile-name {
2838
+ font-size: 22px;
2839
+ font-weight: 700;
2840
+ color: #ffffff;
2841
+ margin: 0;
2842
+ }
2843
+
2844
+ .profile-location {
2845
+ display: inline-flex;
2846
+ align-items: center;
2847
+ gap: 6px;
2848
+ font-size: 14px;
2849
+ color: rgba(255, 255, 255, 0.6);
2850
+ margin: 0;
2851
+ }
2852
+
2853
+ .profile-location svg {
2854
+ opacity: 0.7;
2855
+ }
2856
+
2857
+ .profile-description {
2858
+ font-size: 14px;
2859
+ margin: 0;
2860
+ text-align: center;
2861
+ line-height: 1.4;
2862
+ }
2863
+
2864
+ .compute-specs {
2865
+ font-size: 14px;
2866
+ color: rgba(255, 255, 255, 0.8);
2867
+ margin: 0;
2868
+ }
2869
+
2870
+ .models {
2871
+ display: flex;
2872
+ flex-wrap: wrap;
2873
+ justify-content: center;
2874
+ gap: 6px;
2875
+ margin-top: 4px;
2876
+ }
2877
+
2878
+ .model-chip {
2879
+ font-size: 13px;
2880
+ padding: 4px 12px;
2881
+ border-radius: 12px;
2882
+ background: rgba(145, 227, 253, 0.15);
2883
+ color: var(--ac-primary-color);
2884
+ }
2885
+
2886
+ .rates-section {
2887
+ width: 100%;
2888
+ }
2889
+
2890
+ .rates-section h3 {
2891
+ text-align: left;
2892
+ font-size: 14px;
2893
+ font-weight: 600;
2894
+ color: rgba(255, 255, 255, 0.6);
2895
+ text-transform: uppercase;
2896
+ letter-spacing: 0.5px;
2897
+ margin-bottom: 10px;
2898
+ }
2899
+
2900
+ .rates-table {
2901
+ width: 100%;
2902
+ border-collapse: collapse;
2903
+ }
2904
+
2905
+ .rates-table tr {
2906
+ border-bottom: 1px solid var(--ac-border-color-dark);
2907
+ }
2908
+
2909
+ .rates-table tr:last-child {
2910
+ border-bottom: none;
2911
+ }
2912
+
2913
+ .rates-table td {
2914
+ padding: 8px 0;
2915
+ font-size: 14px;
2916
+ }
2917
+
2918
+ .rates-table td:first-child {
2919
+ color: rgba(255, 255, 255, 0.8);
2920
+ }
2921
+
2922
+ .rates-table td:last-child {
2923
+ text-align: right;
2924
+ color: var(--ac-primary-color);
2925
+ font-family: monospace;
2926
+ font-size: 13px;
2927
+ }
2928
+
2929
+ button.connect-button {
2930
+ width: 100%;
2931
+ }
2932
+ `],Vt.OPERATION_RATES=new Set(["link write"]),C([ie({type:Object})],Vt.prototype,"host",2),Vt=C([Ne("host-detail")],Vt);var We=class extends ge{constructor(){super(...arguments);this.connectedHost=null;this.userInfo=null;this.requestingPayment=!1;this.paymentError=null;this.walletInput="";this.editingWallet=!1;this.walletSaveSuccess=!1;this.topUpAmount="";this.awaitingApproval=!1;this.creditsUpdated=!1;this.previousCredits=null}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}setWalletAddress(){let t=this.walletInput.trim();!t||(this.editingWallet=!1,this.walletSaveSuccess=!0,setTimeout(()=>{this.walletSaveSuccess=!1},3e3),this.dispatchEvent(new CustomEvent("set-wallet-address",{detail:{address:t},bubbles:!0,composed:!0})))}requestTopUp(t){this.creditsUpdated=!1,this.dispatchEvent(new CustomEvent("request-top-up",{detail:{amountHOT:t},bubbles:!0,composed:!0}))}truncateMiddle(t,r=8,n=6){return t.length<=r+n+3?t:`${t.slice(0,r)}\u2026${t.slice(-n)}`}get hasWallet(){var t;return!!((t=this.userInfo)!=null&&t.hotWalletAddress)}get isFreeAccess(){var t;return!!((t=this.userInfo)!=null&&t.freeAccess)}get isDepleted(){return this.userInfo!=null&&!this.userInfo.freeAccess&&this.userInfo.remainingCredits<=0}get topUpDisabled(){return!this.hasWallet||this.requestingPayment||this.awaitingApproval}updated(t){var r,n,a,s,o;t.has("requestingPayment")&&!this.requestingPayment&&!this.paymentError&&t.get("requestingPayment")&&(this.awaitingApproval=!0,this.previousCredits=(n=(r=this.userInfo)==null?void 0:r.remainingCredits)!=null?n:null),t.has("userInfo")&&this.awaitingApproval&&this.previousCredits!==null&&((s=(a=this.userInfo)==null?void 0:a.remainingCredits)!=null?s:0)!==this.previousCredits&&(this.awaitingApproval=!1,this.creditsUpdated=!0,this.previousCredits=null,setTimeout(()=>{this.creditsUpdated=!1},4e3)),t.has("paymentError")&&this.paymentError&&(this.awaitingApproval=!1,this.previousCredits=null),t.has("userInfo")&&((o=this.userInfo)==null?void 0:o.hotWalletAddress)&&!this.walletInput&&(this.walletInput=this.userInfo.hotWalletAddress)}render(){var r,n,a;let t=(n=(r=this.userInfo)==null?void 0:r.remainingCredits)!=null?n:0;return k`
2933
+ <div class="container">
2934
+ <div class="close-button" @click=${this.close}>
2935
+ ${Ue()}
2936
+ </div>
2937
+
2938
+ <div class="dashboard-header">
2939
+ <h1>Dashboard</h1>
2940
+ ${this.connectedHost?k`
2941
+ <div class="host-badge">
2942
+ Connected to <strong>${this.connectedHost.name}</strong>
2943
+ </div>
2944
+ <div class="host-badge">
2945
+ ${Qt()} ${this.connectedHost.location}
2946
+ </div>
2947
+ `:""}
2948
+ ${(a=this.userInfo)!=null&&a.email?k`
2949
+ <p class="email-display">${this.userInfo.email}</p>
2950
+ `:""}
2951
+ </div>
2952
+
2953
+ <!-- Credit balance -->
2954
+ ${this.isFreeAccess?k`
2955
+ <div class="credit-display free-access">
2956
+ ${Kt()}
2957
+ <span class="credit-amount">Free Access</span>
2958
+ </div>
2959
+ `:k`
2960
+ <div class="credit-display">
2961
+ ${Kt()}
2962
+ <span class="credit-amount">${t.toFixed(2)}</span>
2963
+ <span class="credit-label">wHOT</span>
2964
+ </div>
2965
+
2966
+ ${this.isDepleted?k`
2967
+ <div class="depleted-banner">Credits depleted — top up to continue using this host</div>
2968
+ `:""}
2969
+
2970
+ ${this.hasWallet?"":k`
2971
+ <p style="font-size:15px;color:rgba(255,255,255,0.5);text-align:center;">
2972
+ Set your wallet address to enable top-ups
2973
+ </p>
2974
+ `}
2975
+
2976
+ <!-- Wallet address -->
2977
+ <div class="wallet-section">
2978
+ <label>${ea()} wHOT Wallet Address</label>
2979
+ ${this.hasWallet&&!this.editingWallet?k`
2980
+ <div class="wallet-row">
2981
+ <div class="wallet-display" title=${this.userInfo.hotWalletAddress}>${this.truncateMiddle(this.userInfo.hotWalletAddress||"")}</div>
2982
+ <button class="secondary" @click=${()=>{this.editingWallet=!0,this.walletInput=this.userInfo.hotWalletAddress||""}}>
2983
+ Change
2984
+ </button>
2985
+ </div>
2986
+ ${this.walletSaveSuccess?k`
2987
+ <div class="success-message" style="display:flex;align-items:center;justify-content:center;gap:6px;">
2988
+ ${Qe()} Wallet saved
2989
+ </div>
2990
+ `:""}
2991
+ `:k`
2992
+ <div class="wallet-row">
2993
+ <input
2994
+ type="text"
2995
+ placeholder="Enter your wHOT wallet address"
2996
+ .value=${this.walletInput}
2997
+ @input=${s=>{this.walletInput=s.target.value}}
2998
+ @keydown=${s=>{s.key==="Enter"&&this.setWalletAddress()}}
2999
+ style="font-size: 14px;"
3000
+ />
3001
+ <button
3002
+ class="primary"
3003
+ ?disabled=${!this.walletInput.trim()}
3004
+ @click=${this.setWalletAddress}
3005
+ >
3006
+ Save
3007
+ </button>
3008
+ </div>
3009
+ `}
3010
+ </div>
3011
+
3012
+ <!-- Top-up -->
3013
+ <div class="topup-section">
3014
+ <label>${Kt()} Top Up Credits</label>
3015
+ <div class="wallet-row">
3016
+ <input
3017
+ type="number"
3018
+ min="1"
3019
+ placeholder="Amount in wHOT"
3020
+ .value=${this.topUpAmount}
3021
+ @input=${s=>{this.topUpAmount=s.target.value}}
3022
+ @keydown=${s=>{s.key==="Enter"&&this.topUpAmount&&Number(this.topUpAmount)>0&&this.requestTopUp(Number(this.topUpAmount))}}
3023
+ style="font-size: 14px;"
3024
+ />
3025
+ <button
3026
+ class="primary"
3027
+ ?disabled=${this.topUpDisabled||!this.topUpAmount||Number(this.topUpAmount)<=0}
3028
+ @click=${()=>this.requestTopUp(Number(this.topUpAmount))}
3029
+ >
3030
+ ${this.requestingPayment?"...":"Top up"}
3031
+ </button>
3032
+ </div>
3033
+ <div class="topup-buttons">
3034
+ ${[100,500,1e3].map(s=>k`
3035
+ <button
3036
+ class="secondary"
3037
+ ?disabled=${this.topUpDisabled}
3038
+ @click=${()=>{this.topUpAmount=String(s),this.requestTopUp(s)}}
3039
+ >
3040
+ ${s} wHOT
3041
+ </button>
3042
+ `)}
3043
+ </div>
3044
+ </div>
3045
+
3046
+ ${this.awaitingApproval?k`
3047
+ <div class="pending-message">
3048
+ <div class="spinner"></div>
3049
+ Open Unyt app and approve the transaction
3050
+ </div>
3051
+ `:""}
3052
+
3053
+ ${this.creditsUpdated?k`
3054
+ <div class="success-message" style="display:flex;align-items:center;justify-content:center;gap:6px;">
3055
+ ${Qe()} Credits updated!
3056
+ </div>
3057
+ `:""}
3058
+
3059
+ ${this.paymentError?k`
3060
+ <div class="error-message">${this.paymentError}</div>
3061
+ `:""}
3062
+ `}
3063
+
3064
+ <div class="footer-actions">
3065
+ <button class="primary" ?disabled=${this.isDepleted&&!this.isFreeAccess} @click=${this.close}>
3066
+ Use app
3067
+ </button>
3068
+ <button class="danger-secondary" @click=${this.disconnect}>
3069
+ Disconnect
3070
+ </button>
3071
+ </div>
3072
+ </div>
3073
+ `}};We.styles=[Ge,$e`
3074
+ .dashboard-header {
3075
+ text-align: center;
3076
+ }
3077
+
3078
+ .host-badge {
3079
+ display: flex;
3080
+ align-items: center;
3081
+ justify-content: center;
3082
+ gap: 5px;
3083
+ font-size: 14px;
3084
+ color: rgba(255, 255, 255, 0.6);
3085
+ margin-bottom: 8px;
3086
+ }
3087
+
3088
+ .host-badge strong {
3089
+ color: #ffffff;
3090
+ }
3091
+
3092
+ .host-badge svg {
3093
+ opacity: 0.7;
3094
+ }
3095
+
3096
+ .credit-display {
3097
+ display: flex;
3098
+ align-items: center;
3099
+ justify-content: center;
3100
+ gap: 10px;
3101
+ padding: 16px;
3102
+ border-radius: 8px;
3103
+ background: rgba(128, 178, 201, 0.14);
3104
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
3105
+ }
3106
+
3107
+ .credit-display svg {
3108
+ width: 24px;
3109
+ height: 24px;
3110
+ color: var(--ac-primary-color);
3111
+ flex-shrink: 0;
3112
+ }
3113
+
3114
+ .credit-amount {
3115
+ font-size: 28px;
3116
+ font-weight: 700;
3117
+ color: #ffffff;
3118
+ }
3119
+
3120
+ .credit-label {
3121
+ font-size: 14px;
3122
+ color: rgba(255, 255, 255, 0.5);
3123
+ }
3124
+
3125
+ .credit-display.depleted {
3126
+ background: rgba(244, 54, 127, 0.12);
3127
+ box-shadow: 0 0 0 1px var(--ac-danger-color);
3128
+ }
3129
+
3130
+ .credit-display.free-access {
3131
+ background: rgba(93, 210, 125, 0.14);
3132
+ box-shadow: 0 0 0 1px var(--ac-success-color);
3133
+ }
3134
+
3135
+ .credit-display.free-access .credit-amount {
3136
+ color: var(--ac-success-color);
3137
+ font-size: 20px;
3138
+ }
3139
+
3140
+ .depleted-banner {
3141
+ text-align: center;
3142
+ padding: 10px;
3143
+ border-radius: 8px;
3144
+ background: rgba(244, 54, 127, 0.15);
3145
+ color: var(--ac-danger-color);
3146
+ font-size: 14px;
3147
+ font-weight: 600;
3148
+ }
3149
+
3150
+ .wallet-section {
3151
+ display: flex;
3152
+ flex-direction: column;
3153
+ gap: 8px;
3154
+ }
3155
+
3156
+ .wallet-section label {
3157
+ display: flex;
3158
+ align-items: center;
3159
+ gap: 6px;
3160
+ font-size: 13px;
3161
+ color: rgba(255, 255, 255, 0.6);
3162
+ text-transform: uppercase;
3163
+ letter-spacing: 0.5px;
3164
+ font-weight: 600;
3165
+ }
3166
+
3167
+ .wallet-section label svg {
3168
+ width: 16px;
3169
+ height: 16px;
3170
+ color: var(--ac-primary-color);
3171
+ }
3172
+
3173
+ .wallet-row {
3174
+ display: flex;
3175
+ gap: 8px;
3176
+ }
3177
+
3178
+ .wallet-row input {
3179
+ flex: 1;
3180
+ }
3181
+
3182
+ .wallet-row button {
3183
+ width: auto;
3184
+ flex-shrink: 0;
3185
+ }
3186
+
3187
+ .wallet-display {
3188
+ display: flex;
3189
+ align-items: center;
3190
+ gap: 8px;
3191
+ padding: 0 16px;
3192
+ height: 48px;
3193
+ border-radius: 8px;
3194
+ background: #00091e5c;
3195
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
3196
+ font-size: 14px;
3197
+ color: var(--ac-primary-color-light);
3198
+ font-family: monospace;
3199
+ overflow: hidden;
3200
+ text-overflow: ellipsis;
3201
+ white-space: nowrap;
3202
+ flex: 1;
3203
+ }
3204
+
3205
+ .topup-section {
3206
+ display: flex;
3207
+ flex-direction: column;
3208
+ gap: 10px;
3209
+ }
3210
+
3211
+ .topup-section label {
3212
+ display: flex;
3213
+ align-items: center;
3214
+ gap: 6px;
3215
+ font-size: 13px;
3216
+ color: rgba(255, 255, 255, 0.6);
3217
+ text-transform: uppercase;
3218
+ letter-spacing: 0.5px;
3219
+ font-weight: 600;
3220
+ }
3221
+
3222
+ .topup-section label svg {
3223
+ width: 16px;
3224
+ height: 16px;
3225
+ color: var(--ac-primary-color);
3226
+ }
3227
+
3228
+ .topup-buttons {
3229
+ display: flex;
3230
+ gap: 8px;
3231
+ }
3232
+
3233
+ .topup-buttons button {
3234
+ flex: 1;
3235
+ font-size: 14px;
3236
+ padding: 0 12px;
3237
+ height: 42px;
3238
+ }
3239
+
3240
+ .pending-message {
3241
+ display: flex;
3242
+ align-items: center;
3243
+ justify-content: center;
3244
+ gap: 8px;
3245
+ text-align: center;
3246
+ padding: 10px;
3247
+ border-radius: 8px;
3248
+ background: rgba(128, 178, 201, 0.14);
3249
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
3250
+ color: rgba(255, 255, 255, 0.8);
3251
+ font-size: 14px;
3252
+ }
3253
+
3254
+ .pending-message .spinner {
3255
+ width: 16px;
3256
+ height: 16px;
3257
+ flex-shrink: 0;
3258
+ }
3259
+
3260
+ .success-message {
3261
+ text-align: center;
3262
+ padding: 10px;
3263
+ border-radius: 8px;
3264
+ background: rgba(93, 210, 125, 0.15);
3265
+ color: var(--ac-success-color);
3266
+ font-size: 14px;
3267
+ font-weight: 600;
3268
+ }
3269
+
3270
+ .success-message svg {
3271
+ width: 16px;
3272
+ height: 16px;
3273
+ flex-shrink: 0;
3274
+ }
3275
+
3276
+ .error-message {
3277
+ text-align: center;
3278
+ padding: 10px;
3279
+ border-radius: 8px;
3280
+ background: rgba(244, 54, 127, 0.15);
3281
+ color: var(--ac-danger-color);
3282
+ font-size: 14px;
3283
+ }
3284
+
3285
+ .email-display {
3286
+ font-size: 14px;
3287
+ color: rgba(255, 255, 255, 0.5);
3288
+ text-align: center;
3289
+ }
3290
+
3291
+ .footer-actions {
3292
+ display: flex;
3293
+ justify-content: center;
3294
+ gap: 8px;
3295
+ }
3296
+
3297
+ button.full {
3298
+ width: 100%;
3299
+ }
3300
+ `],C([ie({type:Object})],We.prototype,"connectedHost",2),C([ie({type:Object})],We.prototype,"userInfo",2),C([ie({type:Boolean})],We.prototype,"requestingPayment",2),C([ie({type:String})],We.prototype,"paymentError",2),C([Z()],We.prototype,"walletInput",2),C([Z()],We.prototype,"editingWallet",2),C([Z()],We.prototype,"walletSaveSuccess",2),C([Z()],We.prototype,"topUpAmount",2),C([Z()],We.prototype,"awaitingApproval",2),C([Z()],We.prototype,"creditsUpdated",2),We=C([Ne("logged-in-dashboard")],We);var Fg=$e`
2400
3301
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
2401
3302
 
2402
3303
  :host {
3304
+ font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
2403
3305
  --ac-primary-color: #91e3fd;
2404
3306
  --ac-primary-color-light: #acebff;
2405
3307
  --ac-success-color: #5dd27d;
@@ -2440,15 +3342,18 @@ input VoiceActivityParamsInput {
2440
3342
  border: 1px solid var(--ac-border-color-dark);
2441
3343
  border-radius: 12px;
2442
3344
  padding: 30px;
2443
- width: calc(100vw - 10px);
3345
+ width: calc(100vw - 30px);
2444
3346
  max-width: 480px;
2445
- max-height: 90vh;
3347
+ max-height: calc(100vh - 30px);
2446
3348
  overflow-y: auto;
2447
3349
  backdrop-filter: blur(10px);
2448
3350
  -webkit-backdrop-filter: blur(10px); /* Safari */
3351
+ display: flex;
3352
+ flex-direction: column;
2449
3353
  }
2450
3354
 
2451
3355
  .modal-header {
3356
+ position: relative;
2452
3357
  display: flex;
2453
3358
  align-items: center;
2454
3359
  justify-content: center;
@@ -2461,10 +3366,71 @@ input VoiceActivityParamsInput {
2461
3366
  height: 70px;
2462
3367
  }
2463
3368
 
3369
+ .modal-header .back-button {
3370
+ all: unset;
3371
+ display: inline-flex;
3372
+ align-items: center;
3373
+ gap: 8px;
3374
+ cursor: pointer;
3375
+ font-size: 16px;
3376
+ color: rgba(255, 255, 255, 0.5);
3377
+ position: absolute;
3378
+ left: 0;
3379
+ top: 0;
3380
+ }
3381
+
3382
+ .modal-header .back-button svg {
3383
+ width: 20px;
3384
+ height: 20px;
3385
+ }
3386
+
3387
+ .modal-header .back-button:hover {
3388
+ color: rgba(255, 255, 255, 0.8);
3389
+ }
3390
+
2464
3391
  .modal-content {
2465
3392
  display: flex;
2466
3393
  flex-direction: column;
2467
3394
  justify-content: center;
3395
+ flex: 1 1 auto;
3396
+ min-height: 0;
3397
+ }
3398
+
3399
+ .settings-bar {
3400
+ position: fixed;
3401
+ bottom: 10px;
3402
+ right: 10px;
3403
+ display: flex;
3404
+ align-items: center;
3405
+ gap: 6px;
3406
+ z-index: 99999;
3407
+ }
3408
+
3409
+ .credit-badge {
3410
+ display: flex;
3411
+ align-items: center;
3412
+ gap: 4px;
3413
+ background: var(--ac-background-color);
3414
+ backdrop-filter: blur(10px);
3415
+ -webkit-backdrop-filter: blur(10px);
3416
+ border: 1px solid var(--ac-border-color-dark);
3417
+ border-radius: 20px;
3418
+ padding: 4px 10px;
3419
+ font-size: 12px;
3420
+ font-weight: 500;
3421
+ color: var(--ac-primary-color);
3422
+ white-space: nowrap;
3423
+ }
3424
+
3425
+ .credit-badge svg {
3426
+ width: 14px;
3427
+ height: 14px;
3428
+ }
3429
+
3430
+ .credit-badge.low-credit {
3431
+ color: var(--ac-danger-color);
3432
+ border-color: var(--ac-danger-color);
3433
+ animation: pulse-danger 2s ease-in-out infinite;
2468
3434
  }
2469
3435
 
2470
3436
  .settings-button {
@@ -2473,27 +3439,29 @@ input VoiceActivityParamsInput {
2473
3439
  background: transparent;
2474
3440
  padding: 0;
2475
3441
  cursor: pointer;
2476
- position: fixed;
2477
- bottom: 10px;
2478
- right: 10px;
2479
3442
  color: var(--ac-primary-color);
2480
3443
  width: 34px;
2481
3444
  height: 34px;
2482
- z-index: 99999;
2483
3445
  }
2484
- `,Pe=class extends Le{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(),vs(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 _e(this,null,function*(){this.core.port=t.detail.port,Bn("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return _e(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Bn("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 _e(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return _e(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,Bn("ad4m-url",this.core.url);try{if(yield qn(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 _e(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return _e(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 _e(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 _e(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 _e(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return N`
3446
+
3447
+ .settings-button.low-credit {
3448
+ color: var(--ac-danger-color);
3449
+ animation: pulse-danger 2s ease-in-out infinite;
3450
+ }
3451
+
3452
+ @keyframes pulse-danger {
3453
+ 0%, 100% { opacity: 1; }
3454
+ 50% { opacity: 0.4; }
3455
+ }
3456
+ `,be=class extends ge{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.hosts=[];this.hostsLoading=!1;this.hostsError=null;this.selectedHost=null;this.userInfo=null;this.lowCredit=!1;this.requestingPayment=!1;this.paymentError=null}connectedCallback(){super.connectedCallback(),ks(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.addEventListener("userinfochange",t=>{var n;let r=t.detail;((n=this.userInfo)==null?void 0:n.hotWalletAddress)&&!r.hotWalletAddress&&(r.hotWalletAddress=this.userInfo.hotWalletAddress),this.userInfo=r,this.lowCredit=this.userInfo.remainingCredits<=this.core.lowCreditThreshold,this.requestUpdate()}),this.core.addEventListener("creditdepleted",()=>{this.lowCredit=!0,this.core.connectedHost&&!this.modalOpen&&(this.currentView="logged-in-dashboard",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().then(()=>{this.core.connectedHost&&(this.selectedHost=this.core.connectedHost,this.core.startCreditSubscription())}).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 pe(this,null,function*(){this.core.port=t.detail.port,Hr("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return pe(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Hr("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 pe(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}browseHosts(){return pe(this,null,function*(){this.hostsLoading=!0,this.hostsError=null,this.currentView="host-browser";try{this.hosts=yield Is(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}retryFetchHosts(){return pe(this,null,function*(){this.hostsLoading=!0,this.hostsError=null;try{this.hosts=yield Is(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}selectHost(t){this.selectedHost=t.detail.host,this.currentView="host-detail"}proceedToAuth(t){return pe(this,null,function*(){let r=t.detail.host;this.selectedHost=r;let n=r.url;try{yield qr(n),console.log("[Ad4m Connect UI] Host connection successful:",r.name);let a=this.core.url;if(this.core.url=n,!(yield this.core.isValidAd4mAPI()))throw this.core.url=a,new Error("Server is reachable but doesn't appear to be an AD4M executor");Hr("ad4m-url",n),this.currentView="remote-authentication"}catch(a){console.error("[Ad4m Connect UI] Host connection failed:",a),this.hostsError=a instanceof Error?a.message:"Connection failed",this.currentView="host-browser"}})}handleAuthSuccess(){return pe(this,null,function*(){this.selectedHost?(this.core.setConnectedHost(this.selectedHost),this.core.startCreditSubscription(),this.currentView="logged-in-dashboard"):this.modalOpen=!1})}handleRequestTopUp(t){return pe(this,null,function*(){this.requestingPayment=!0,this.paymentError=null;try{let r=yield this.core.requestTopUp(t.detail.amountHOT);r.success||(this.paymentError=r.message)}catch(r){this.paymentError=r instanceof Error?r.message:"Payment request failed"}finally{this.requestingPayment=!1}})}handleSetWalletAddress(t){return pe(this,null,function*(){try{yield this.core.ad4mClient.agent.setHotWalletAddress(t.detail.address),this.userInfo&&(this.userInfo=Bo(jo({},this.userInfo),{hotWalletAddress:t.detail.address}))}catch(r){console.error("[Ad4m Connect] Failed to set wallet address:",r)}})}connectRemoteNode(t){return pe(this,null,function*(){this.core.url=t.detail.remoteUrl,Hr("ad4m-url",this.core.url);try{if(yield qr(t.detail.remoteUrl),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r)}})}emailLogin(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return pe(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}get backTarget(){switch(this.currentView){case"local-authentication":return"connection-options";case"host-browser":return"connection-options";case"host-detail":return"host-browser";case"remote-authentication":return this.selectedHost?"host-detail":"connection-options";default:return null}}handleBack(){let t=this.backTarget;t&&(this.currentView==="remote-authentication"&&this.resetRemoteAuthState(),this.currentView=t)}resetRemoteAuthState(){this.remoteAuthState=null,this.remoteAuthLoading=!1,this.emailCodeError=!1,this.passwordError=!1,this.accountCreationError=!1}renderViews(){var t,r,n;if(this.currentView==="connection-options")return k`
2485
3457
  <connection-options
2486
3458
  .port=${this.core.port}
2487
- .remoteUrl=${this.core.options.remoteUrl}
2488
- .connectingToRemoteNode=${this.connectingToRemoteNode}
2489
- .remoteNodeError=${this.remoteNodeError}
2490
- .showMultiUserOption=${this.core.options.multiUser}
3459
+ .showHosting=${!!this.core.options.hosting}
2491
3460
  @change-port=${this.changePort}
2492
3461
  @connect-local-node=${this.connectLocalNode}
2493
- @connect-remote-node=${this.connectRemoteNode}
2494
- @clear-remote-node-error=${()=>{this.remoteNodeError=!1}}
3462
+ @browse-hosts=${this.browseHosts}
2495
3463
  ></connection-options>
2496
- `;if(this.currentView==="local-authentication")return N`
3464
+ `;if(this.currentView==="local-authentication")return k`
2497
3465
  <local-authentication
2498
3466
  .capabilities=${this.core.options.capabilities}
2499
3467
  .appname=${this.core.options.appInfo.name}
@@ -2504,21 +3472,51 @@ input VoiceActivityParamsInput {
2504
3472
  @verify-code=${this.verifyLocalAd4mCode}
2505
3473
  @clear-verification-error=${()=>{this.verificationError=!1}}
2506
3474
  ></local-authentication>
2507
- `;if(this.currentView==="remote-authentication")return N`
3475
+ `;if(this.currentView==="host-browser")return k`
3476
+ <host-browser
3477
+ .hosts=${this.hosts}
3478
+ .loading=${this.hostsLoading}
3479
+ .error=${this.hostsError}
3480
+ .lastHostId=${(r=(t=this.core.connectedHost)==null?void 0:t.id)!=null?r:null}
3481
+ .defaultUrl=${(n=this.core.options.remoteUrl)!=null?n:""}
3482
+ @select-host=${this.selectHost}
3483
+ @back=${()=>{this.currentView="connection-options"}}
3484
+ @retry=${this.retryFetchHosts}
3485
+ ></host-browser>
3486
+ `;if(this.currentView==="host-detail")return k`
3487
+ <host-detail
3488
+ .host=${this.selectedHost}
3489
+ @proceed-to-auth=${this.proceedToAuth}
3490
+ @back=${()=>{this.currentView="host-browser"}}
3491
+ ></host-detail>
3492
+ `;if(this.currentView==="remote-authentication")return k`
2508
3493
  <remote-authentication
3494
+ .host=${this.selectedHost}
2509
3495
  .remoteAuthLoading=${this.remoteAuthLoading}
2510
3496
  .remoteAuthState=${this.remoteAuthState}
2511
3497
  .emailCodeError=${this.emailCodeError}
2512
3498
  .passwordError=${this.passwordError}
2513
3499
  .accountCreationError=${this.accountCreationError}
2514
- @back=${()=>{this.currentView="connection-options"}}
3500
+ @back=${()=>{this.currentView=this.selectedHost?"host-detail":"connection-options"}}
2515
3501
  @email-login=${this.emailLogin}
2516
3502
  @verify-email-code=${this.verifyEmailCode}
2517
3503
  @password-login=${this.passwordLogin}
2518
3504
  @create-account=${this.createAccount}
2519
3505
  @clear-email-code-error=${()=>{this.emailCodeError=!1}}
3506
+ @reset-auth-state=${()=>{this.resetRemoteAuthState()}}
2520
3507
  ></remote-authentication>
2521
- `;if(this.currentView==="current-state")return N`
3508
+ `;if(this.currentView==="logged-in-dashboard")return k`
3509
+ <logged-in-dashboard
3510
+ .connectedHost=${this.core.connectedHost}
3511
+ .userInfo=${this.userInfo}
3512
+ .requestingPayment=${this.requestingPayment}
3513
+ .paymentError=${this.paymentError}
3514
+ @close=${()=>{this.modalOpen=!1}}
3515
+ @disconnect=${this.disconnect}
3516
+ @request-top-up=${this.handleRequestTopUp}
3517
+ @set-wallet-address=${this.handleSetWalletAddress}
3518
+ ></logged-in-dashboard>
3519
+ `;if(this.currentView==="current-state")return k`
2522
3520
  <current-state
2523
3521
  .url=${this.core.url}
2524
3522
  .port=${this.core.port}
@@ -2526,11 +3524,16 @@ input VoiceActivityParamsInput {
2526
3524
  @close=${()=>{this.modalOpen=!1}}
2527
3525
  @disconnect=${this.disconnect}
2528
3526
  ></current-state>
2529
- `}render(){return this.modalOpen?N`
3527
+ `}render(){var t;if(this.modalOpen)return k`
2530
3528
  <div class="wrapper">
2531
3529
  <div class="modal">
2532
3530
  <header class="modal-header">
2533
- ${mi()}
3531
+ ${this.backTarget?k`
3532
+ <button class="back-button" aria-label="Go back" @click=${this.handleBack}>
3533
+ ${Yn()} Back
3534
+ </button>
3535
+ `:""}
3536
+ ${Ei()}
2534
3537
  </header>
2535
3538
  <main class="modal-content">
2536
3539
  ${this.renderViews()}
@@ -2538,16 +3541,23 @@ input VoiceActivityParamsInput {
2538
3541
  </div>
2539
3542
  <div class="backdrop" />
2540
3543
  </div>
2541
- `:this.core.authState==="authenticated"?N`
2542
- <button
2543
- type="button"
2544
- class="settings-button"
2545
- aria-label="Open settings"
2546
- @click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
2547
- >
2548
- ${mi()}
2549
- </button>
2550
- `:null}};Pe.styles=[yg],j([ue()],Pe.prototype,"modalOpen",2),j([ue()],Pe.prototype,"currentView",2),j([ue()],Pe.prototype,"connectingToRemoteNode",2),j([ue()],Pe.prototype,"remoteNodeError",2),j([ue()],Pe.prototype,"verificationError",2),j([ue()],Pe.prototype,"remoteAuthLoading",2),j([ue()],Pe.prototype,"remoteAuthState",2),j([ue()],Pe.prototype,"emailCodeError",2),j([ue()],Pe.prototype,"passwordError",2),j([ue()],Pe.prototype,"accountCreationError",2),Pe=j([gt("ad4m-connect")],Pe);function vg(i){let e=new Pe;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{Pe as Ad4mConnectElement,vg as default};
3544
+ `;if(this.core.authState==="authenticated"){let r=(t=this.userInfo)==null?void 0:t.remainingCredits;return k`
3545
+ <div class="settings-bar">
3546
+ ${r!=null?k`
3547
+ <span class="credit-badge ${this.lowCredit?"low-credit":""}">
3548
+ ${Kt()} ${r.toFixed(2)} wHOT
3549
+ </span>
3550
+ `:""}
3551
+ <button
3552
+ type="button"
3553
+ class="settings-button ${this.lowCredit?"low-credit":""}"
3554
+ aria-label="Open settings"
3555
+ @click=${()=>{this.currentView=this.core.connectedHost?"logged-in-dashboard":"current-state",this.modalOpen=!0}}
3556
+ >
3557
+ ${Ei()}
3558
+ </button>
3559
+ </div>
3560
+ `}return null}};be.styles=[Fg],C([Z()],be.prototype,"modalOpen",2),C([Z()],be.prototype,"currentView",2),C([Z()],be.prototype,"verificationError",2),C([Z()],be.prototype,"remoteAuthLoading",2),C([Z()],be.prototype,"remoteAuthState",2),C([Z()],be.prototype,"emailCodeError",2),C([Z()],be.prototype,"passwordError",2),C([Z()],be.prototype,"accountCreationError",2),C([Z()],be.prototype,"hosts",2),C([Z()],be.prototype,"hostsLoading",2),C([Z()],be.prototype,"hostsError",2),C([Z()],be.prototype,"selectedHost",2),C([Z()],be.prototype,"userInfo",2),C([Z()],be.prototype,"lowCredit",2),C([Z()],be.prototype,"requestingPayment",2),C([Z()],be.prototype,"paymentError",2),be=C([Ne("ad4m-connect")],be);function jg(i){let e=new be;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{be as Ad4mConnectElement,jg as default};
2551
3561
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2552
3562
  /**
2553
3563
  * @license