@coasys/ad4m-connect 0.12.1-dev → 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/components/icons/MapPinIcon.d.ts +1 -0
- package/dist/components/icons/index.d.ts +1 -0
- package/dist/components/views/HostBrowser.d.ts +0 -1
- package/dist/components/views/HostDetail.d.ts +2 -1
- package/dist/components/views/LocalAuthentication.d.ts +2 -1
- package/dist/components/views/LoggedInDashboard.d.ts +7 -1
- package/dist/components/views/RemoteAuthentication.d.ts +3 -1
- package/dist/core.d.ts +6 -0
- package/dist/core.js +180 -166
- package/dist/index.js +699 -462
- package/dist/types.d.ts +1 -0
- package/dist/utils.js +1 -1
- package/dist/web.d.ts +3 -0
- package/dist/web.js +645 -408
- package/package.json +2 -2
package/dist/web.js
CHANGED
|
@@ -1,67 +1,71 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Zo=/"/g,tc=/^(?:script|style|textarea|title)$/i,ic=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),I=ic(1),zg=ic(2),bi=Symbol.for("lit-noChange"),Ae=Symbol.for("lit-nothing"),Jo=new WeakMap,yi=vi.createTreeWalker(vi,129,null,!1);function rc(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wo!==void 0?Wo.createHTML(e):e}var Gu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Ur;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===Ur?u[1]==="!--"?s=Ko:u[1]!==void 0?s=Qo:u[2]!==void 0?(tc.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=mi):u[3]!==void 0&&(s=mi):s===mi?u[0]===">"?(s=n??Ur,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?mi:u[3]==='"'?Zo:Go):s===Zo||s===Go?s=mi:s===Ko||s===Qo?s=Ur:(s=mi,n=void 0);let d=s===mi&&i[o+1].startsWith("/>")?" ":"";a+=s===Ur?l+Ku:m>=0?(r.push(c),l.slice(0,m)+ms+l.slice(m)+Wt+d):l+Wt+(m===-2?(r.push(void 0),o):d)}return[rc(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},wi=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]=Gu(e,t);if(this.el=wi.createElement(c,r),yi.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=yi.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(ms)||y.startsWith(Wt)){let d=u[s++];if(m.push(y),d!==void 0){let f=n.getAttribute(d.toLowerCase()+ms).split(Wt),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:g[2],strings:f,ctor:g[1]==="."?vs:g[1]==="?"?bs:g[1]==="@"?ws:sr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(tc.test(n.tagName)){let m=n.textContent.split(Wt),y=m.length-1;if(y>0){n.textContent=nr?nr.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Mr()),yi.nextNode(),l.push({type:2,index:++a});n.append(m[y],Mr())}}}else if(n.nodeType===8)if(n.data===Xo)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=vi.createElement("template");return r.innerHTML=e,r}};function ar(i,e,t=i,r){var n,a,s,o;if(e===bi)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Fr(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=ar(i,l._$AS(i,e.values),l,r)),e}var ys=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:vi).importNode(r,!0);yi.currentNode=a;let s=yi.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Si(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new Ss(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=yi.nextNode(),o++)}return yi.currentNode=vi,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++}},Si=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=Ae,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=ar(this,e,t),Fr(e)?e===Ae||e==null||e===""?(this._$AH!==Ae&&this._$AR(),this._$AH=Ae):e!==this._$AH&&e!==bi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Qu(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!==Ae&&Fr(this._$AH)?this._$AA.nextSibling.data=e:this.$(vi.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=wi.createElement(rc(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 ys(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Jo.get(e.strings);return t===void 0&&Jo.set(e.strings,t=new wi(e)),t}T(e){ec(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 Si(this.k(Mr()),this.k(Mr()),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))}},sr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=Ae,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=Ae}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=ar(this,e,t,0),s=!Fr(e)||e!==this._$AH&&e!==bi,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=ar(this,o[r+l],t,l),c===bi&&(c=this._$AH[l]),s||(s=!Fr(c)||c!==this._$AH[l]),c===Ae?e=Ae:e!==Ae&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===Ae?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},vs=class extends sr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ae?void 0:e}},Zu=nr?nr.emptyScript:"",bs=class extends sr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ae?this.element.setAttribute(this.name,Zu):this.element.removeAttribute(this.name)}},ws=class extends sr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=ar(this,e,t,0))!==null&&r!==void 0?r:Ae)===bi)return;let n=this._$AH,a=e===Ae&&n!==Ae||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ae&&(n===Ae||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)}},Ss=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){ar(this,e)}};var Yo=Vn.litHtmlPolyfillSupport;Yo?.(wi,Si),((hs=Vn.litHtmlVersions)!==null&&hs!==void 0?hs:Vn.litHtmlVersions=[]).push("2.8.0");var nc=(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 Si(e.insertBefore(Mr(),o),o,void 0,t??{})}return s._$AI(i),s};var _s,xs;var ge=class extends Dt{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=nc(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 bi}};ge.finalized=!0,ge._$litElement$=!0,(_s=globalThis.litElementHydrateSupport)===null||_s===void 0||_s.call(globalThis,{LitElement:ge});var ac=globalThis.litElementPolyfillSupport;ac?.({LitElement:ge});((xs=globalThis.litElementVersions)!==null&&xs!==void 0?xs: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 Ju=(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)}},Yu=(i,e,t)=>{e.constructor.createProperty(t,i)};function ie(i){return(e,t)=>t!==void 0?Yu(i,e,t):Ju(i,e)}function Y(i){return ie({...i,state:!0})}var Es,ym=((Es=window.HTMLSlotElement)===null||Es===void 0?void 0:Es.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Xu=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 $s(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 Xu(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 sc="0.12.1-dev";function td(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Br(i,e){td()&&localStorage.setItem(`${sc}/${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 oc(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 cc(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 _i(){return I`
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 Ue(){return
|
|
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
|
|
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
|
|
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
|
|
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
|
-
`}function
|
|
46
|
+
`}function Xn(){return k`
|
|
47
47
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
48
48
|
<circle cx="12" cy="12" r="10"></circle>
|
|
49
49
|
<path d="M2 12h20"></path>
|
|
50
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
51
|
</svg>
|
|
52
|
-
`}function
|
|
52
|
+
`}function Kt(){return k`
|
|
53
53
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
54
54
|
<circle cx="12" cy="12" r="10"></circle>
|
|
55
55
|
<path d="M12 6v12"></path>
|
|
56
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
57
|
</svg>
|
|
58
|
-
`}function
|
|
58
|
+
`}function ea(){return k`
|
|
59
59
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
60
60
|
<rect x="2" y="6" width="20" height="14" rx="2"></rect>
|
|
61
61
|
<path d="M2 10h20"></path>
|
|
62
62
|
<circle cx="16" cy="14" r="1" fill="currentColor"></circle>
|
|
63
63
|
</svg>
|
|
64
|
-
`}
|
|
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`
|
|
65
69
|
* {
|
|
66
70
|
box-sizing: border-box;
|
|
67
71
|
}
|
|
@@ -169,6 +173,22 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
169
173
|
box-shadow: 0 0 0 4px rgba(244, 54, 127, 0.2);
|
|
170
174
|
}
|
|
171
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
|
+
|
|
172
192
|
button:disabled {
|
|
173
193
|
opacity: 0.5;
|
|
174
194
|
cursor: not-allowed;
|
|
@@ -178,22 +198,13 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
178
198
|
width: 100%;
|
|
179
199
|
}
|
|
180
200
|
|
|
181
|
-
.back-button,
|
|
182
201
|
.close-button {
|
|
183
202
|
position: absolute;
|
|
184
203
|
top: 20px;
|
|
185
|
-
cursor: pointer;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.back-button {
|
|
189
|
-
left: 20px;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.close-button {
|
|
193
204
|
right: 20px;
|
|
205
|
+
cursor: pointer;
|
|
194
206
|
}
|
|
195
207
|
|
|
196
|
-
.back-button svg,
|
|
197
208
|
.close-button svg {
|
|
198
209
|
width: 28px;
|
|
199
210
|
height: 28px;
|
|
@@ -201,6 +212,25 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
201
212
|
opacity: 0.5;
|
|
202
213
|
}
|
|
203
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
|
+
|
|
204
234
|
/* Inputs */
|
|
205
235
|
input {
|
|
206
236
|
width: 100%;
|
|
@@ -324,7 +354,21 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
324
354
|
.state.danger svg {
|
|
325
355
|
color: var(--ac-danger-color);
|
|
326
356
|
}
|
|
327
|
-
|
|
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`
|
|
328
372
|
<div class="container">
|
|
329
373
|
<div class="header">
|
|
330
374
|
<h1>Connect AD4M</h1>
|
|
@@ -332,23 +376,23 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
332
376
|
</div>
|
|
333
377
|
|
|
334
378
|
<div class="options">
|
|
335
|
-
${!this.isMobile||!this.showHosting?
|
|
379
|
+
${!this.isMobile||!this.showHosting?k`
|
|
336
380
|
<div class="box">
|
|
337
381
|
<div class="box-header">
|
|
338
|
-
${
|
|
382
|
+
${lr()}
|
|
339
383
|
<h3>Local Node</h3>
|
|
340
384
|
</div>
|
|
341
385
|
|
|
342
|
-
${this.localNodeDetected?
|
|
386
|
+
${this.localNodeDetected?k`
|
|
343
387
|
<div class="state success">
|
|
344
|
-
${
|
|
388
|
+
${Qe()}
|
|
345
389
|
<p>Local node detected on port ${this.port}</p>
|
|
346
390
|
</div>
|
|
347
391
|
|
|
348
392
|
<button class="primary" @click=${this.connectLocalNode}>
|
|
349
393
|
Connect to Local Node
|
|
350
394
|
</button>
|
|
351
|
-
`:
|
|
395
|
+
`:k`
|
|
352
396
|
<div class="state danger">
|
|
353
397
|
${Ue()}
|
|
354
398
|
<p>No local node detected on port ${this.port}</p>
|
|
@@ -356,7 +400,7 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
356
400
|
|
|
357
401
|
<p style="margin-bottom: -12px">Download and install AD4M</p>
|
|
358
402
|
<button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
|
|
359
|
-
${
|
|
403
|
+
${Gn()} Download AD4M
|
|
360
404
|
</button>
|
|
361
405
|
`}
|
|
362
406
|
|
|
@@ -370,16 +414,16 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
370
414
|
@keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
|
|
371
415
|
/>
|
|
372
416
|
<button class="primary" @click=${this.refreshPort}>
|
|
373
|
-
${
|
|
417
|
+
${Zn()}
|
|
374
418
|
</button>
|
|
375
419
|
</div>
|
|
376
420
|
</div>
|
|
377
421
|
`:""}
|
|
378
422
|
|
|
379
|
-
${this.showHosting?
|
|
423
|
+
${this.showHosting?k`
|
|
380
424
|
<div class="box">
|
|
381
425
|
<div class="box-header">
|
|
382
|
-
${
|
|
426
|
+
${Xn()}
|
|
383
427
|
<h3>Remote Node</h3>
|
|
384
428
|
</div>
|
|
385
429
|
|
|
@@ -392,7 +436,7 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
392
436
|
`:""}
|
|
393
437
|
</div>
|
|
394
438
|
</div>
|
|
395
|
-
`}};
|
|
439
|
+
`}};it.styles=[Ge,$e`
|
|
396
440
|
.options {
|
|
397
441
|
display: flex;
|
|
398
442
|
flex-direction: column;
|
|
@@ -421,38 +465,38 @@ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnProperty
|
|
|
421
465
|
button {
|
|
422
466
|
width: 100%;
|
|
423
467
|
}
|
|
424
|
-
`],
|
|
425
|
-
`),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,
|
|
426
|
-
`)}function
|
|
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+=`
|
|
427
471
|
|
|
428
|
-
`+
|
|
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+=`
|
|
429
473
|
|
|
430
|
-
`+
|
|
431
|
-
`)}function
|
|
432
|
-
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=Fd(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 it(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw it(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw it(i,s,"Unterminated string.")}function Md(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,Td(u));if(c<32&&c!==9&&c!==10&&c!==13)throw it(i,o,"Invalid character within String: ".concat(Mi(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 it(i,o,"Unterminated string.")}function Fd(i,e,t,r){return Yn(i)<<12|Yn(e)<<8|Yn(t)<<4|Yn(r)}function Yn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function jd(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 Bd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function qd(i,e){var t=new Hd(i,e);return t.parseDocument()}var Hd=function(){function i(t,r){var n=kd(t)?t:new Fl(t);this._lexer=new Ld(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(Id[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 Ul(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 it(this._lexer.source,n.start,"Expected ".concat(jl(r),", found ").concat(Ts(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 it(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(Ts(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 it(this._lexer.source,n.start,"Unexpected ".concat(Ts(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 Ts(i){var e=i.value;return jl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function jl(i){return Pd(i)?'"'.concat(i,'"'):i}var ya=new Map,Gs=new Map,Bl=!0,Ta=!1;function ql(i){return i.replace(/[\s,]+/g," ").trim()}function zd(i){return ql(i.source.body.substring(i.start,i.end))}function Vd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=zd(r.loc),s=Gs.get(n);s&&!s.has(a)?Bl&&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.
|
|
433
477
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
434
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Gs.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),Ia(Ia({},i),{definitions:t})}function Wd(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=ql(i);if(!ya.has(e)){var t=qd(i,{experimentalFragmentVariables:Ta,allowLegacyFragmentVariables:Ta});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ya.set(e,Wd(Vd(t)))}return ya.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 Qd(){ya.clear(),Gs.clear()}function Gd(){Bl=!1}function Zd(){Ta=!0}function Jd(){Ta=!1}var zr={gql:v,resetCaches:Qd,disableFragmentWarnings:Gd,enableExperimentalFragmentVariables:Zd,disableExperimentalFragmentVariables:Jd};(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 Yd(){}function fi(){return Yd}var F=fi,h=fi,Te=fi,J=fi,H=fi,Ce=fi,Xd=fi,wo=fi,Hl=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},zl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fi=class{constructor(e){this.code=e}};Hl([h(),zl("design:type",String)],Fi.prototype,"code",void 0);Fi=Hl([H(),zl("design:paramtypes",[String])],Fi);var So=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},_o=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},It=class{constructor(e,t){this.address=e,this.name=t}};So([h(),_o("design:type",String)],It.prototype,"address",void 0);So([h(),_o("design:type",String)],It.prototype,"name",void 0);It=So([H(),_o("design:paramtypes",[String,String])],It);var he=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}};he([h(),xe("design:type",String)],Ht.prototype,"signature",void 0);he([h(),xe("design:type",String)],Ht.prototype,"key",void 0);he([h(),xe("design:type",Boolean)],Ht.prototype,"valid",void 0);he([h(),xe("design:type",Boolean)],Ht.prototype,"invalid",void 0);Ht=he([H(),Te(),xe("design:paramtypes",[String,String])],Ht);var ji=class{};he([h(),xe("design:type",String)],ji.prototype,"signature",void 0);he([h(),xe("design:type",String)],ji.prototype,"key",void 0);he([h(),xe("design:type",Boolean)],ji.prototype,"valid",void 0);he([h(),xe("design:type",Boolean)],ji.prototype,"invalid",void 0);ji=he([Te()],ji);function hi(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return he([h(),xe("design:type",String)],e.prototype,"author",void 0),he([h(),xe("design:type",String)],e.prototype,"timestamp",void 0),he([h(),xe("design:type",Object)],e.prototype,"data",void 0),he([h(),xe("design:type",Ht)],e.prototype,"proof",void 0),e=he([H(),xe("design:paramtypes",[String,String,Object,Ht])],e),e}function ep(i){let e=class{};return he([h(),xe("design:type",String)],e.prototype,"author",void 0),he([h(),xe("design:type",String)],e.prototype,"timestamp",void 0),he([h(),xe("design:type",Object)],e.prototype,"data",void 0),he([h(),xe("design:type",ji)],e.prototype,"proof",void 0),e=he([Te()],e),e}var gc=class extends hi(){};gc=he([H()],gc);var Ca=class extends hi(){};he([h(),xe("design:type",It)],Ca.prototype,"language",void 0);he([h(),xe("design:type",Fi)],Ca.prototype,"icon",void 0);Ca=he([H()],Ca);function Wy(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)},Je=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};we([h(),Re("design:type",String)],Je.prototype,"source",void 0);we([h(),Re("design:type",String)],Je.prototype,"target",void 0);we([h(),Re("design:type",String)],Je.prototype,"predicate",void 0);Je=we([H(),Re("design:paramtypes",[Object])],Je);var La=class{};we([h(),Re("design:type",Array)],La.prototype,"additions",void 0);we([h(),Re("design:type",Array)],La.prototype,"removals",void 0);La=we([Te()],La);var Pa=class{constructor(e,t){this.additions=e,this.removals=t}};we([h(),Re("design:type",Array)],Pa.prototype,"additions",void 0);we([h(),Re("design:type",Array)],Pa.prototype,"removals",void 0);Pa=we([H(),Re("design:paramtypes",[Array,Array])],Pa);var _n=class{};we([h(),Re("design:type",String)],_n.prototype,"source",void 0);we([h(),Re("design:type",String)],_n.prototype,"target",void 0);we([h(),Re("design:type",String)],_n.prototype,"predicate",void 0);_n=we([Te()],_n);var si=class extends hi(){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([h(),Re("design:type",String)],si.prototype,"status",void 0);si=we([H()],si);var Zs=class extends ep(){};we([h(),Re("design:type",String)],Zs.prototype,"status",void 0);Zs=we([Te()],Zs);function Xy(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 e0(i){return i&&i.source&&i.target}var Ra=class{constructor(e,t){this.oldLink=e,this.newLink=t}};we([h(),Re("design:type",si)],Ra.prototype,"oldLink",void 0);we([h(),Re("design:type",si)],Ra.prototype,"newLink",void 0);Ra=we([H(),Re("design:paramtypes",[si,si])],Ra);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},Nn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Js,Pt=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(),Nn("design:type",Array)],Pt.prototype,"links",void 0);Pt=Zi([H(),Nn("design:paramtypes",[Array])],Pt);var Na=class{};Zi([h(),Nn("design:type",Array)],Na.prototype,"links",void 0);Na=Zi([Te()],Na);var Ys=Js=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Js;return t.links.push(e),t}};Zi([h(),Nn("design:type",Array)],Ys.prototype,"links",void 0);Ys=Js=Zi([Te(),Nn("design:paramtypes",[Array])],Ys);var Bi=class extends hi(){};Bi=Zi([H()],Bi);var M=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)},ti=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Pt}};M([h(),B("design:type",String)],ti.prototype,"did",void 0);M([h(),B("design:type",Pt)],ti.prototype,"perspective",void 0);M([h(),B("design:type",String)],ti.prototype,"directMessageLanguage",void 0);ti=M([H(),B("design:paramtypes",[String,Pt])],ti);var mc=class extends hi(){};mc=M([H()],mc);var oi=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}};M([h(),B("design:type",String)],oi.prototype,"did",void 0);M([h(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKey",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);M([h(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=M([H(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var ci=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}};M([h(),B("design:type",String)],ci.prototype,"did",void 0);M([h(),B("design:type",String)],ci.prototype,"didSigningKeyId",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKeyType",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKey",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKeySignedByDid",void 0);M([h(),B("design:type",String)],ci.prototype,"didSignedByDeviceKey",void 0);ci=M([Te(),B("design:paramtypes",[String,String,String,String,String,String])],ci);var Oa=class{constructor(e,t){this.signature=e,this.publicKey=t}};M([h(),B("design:type",String)],Oa.prototype,"signature",void 0);M([h(),B("design:type",String)],Oa.prototype,"publicKey",void 0);Oa=M([H(),B("design:paramtypes",[String,String])],Oa);var vr=class{constructor(e,t){this.domain=e,this.pointers=t}};M([h(),B("design:type",String)],vr.prototype,"domain",void 0);M([h(),B("design:type",Array)],vr.prototype,"pointers",void 0);vr=M([H(),B("design:paramtypes",[String,Array])],vr);var Da=class{constructor(e,t){this.with=e,this.can=t}};M([h(),B("design:type",vr)],Da.prototype,"with",void 0);M([h(),B("design:type",Array)],Da.prototype,"can",void 0);Da=M([H(),B("design:paramtypes",[vr,Array])],Da);var zt=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};M([h(),B("design:type",String)],zt.prototype,"appName",void 0);M([h(),B("design:type",String)],zt.prototype,"appDesc",void 0);M([h(),B("design:type",String)],zt.prototype,"appUrl",void 0);M([h(),B("design:type",String)],zt.prototype,"appIconPath",void 0);M([h(),B("design:type",Array)],zt.prototype,"capabilities",void 0);zt=M([H(),B("design:paramtypes",[String,String,String,Array,String])],zt);var br=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};M([h(),B("design:type",String)],br.prototype,"requestId",void 0);M([h(),B("design:type",String)],br.prototype,"token",void 0);M([h(),B("design:type",Boolean)],br.prototype,"revoked",void 0);M([h(),B("design:type",zt)],br.prototype,"auth",void 0);br=M([H(),B("design:paramtypes",[String,zt,String,Boolean])],br);var wr=class{constructor(e,t){this.domain=e,this.pointers=t}};M([h(),B("design:type",String)],wr.prototype,"domain",void 0);M([h(),B("design:type",Array)],wr.prototype,"pointers",void 0);wr=M([Te(),B("design:paramtypes",[String,Array])],wr);var Ua=class{constructor(e,t){this.with=e,this.can=t}};M([h(),B("design:type",wr)],Ua.prototype,"with",void 0);M([h(),B("design:type",Array)],Ua.prototype,"can",void 0);Ua=M([Te(),B("design:paramtypes",[wr,Array])],Ua);var Rt=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}};M([h(),B("design:type",String)],Rt.prototype,"appName",void 0);M([h(),B("design:type",String)],Rt.prototype,"appDesc",void 0);M([h(),B("design:type",String)],Rt.prototype,"appDomain",void 0);M([h(),B("design:type",String)],Rt.prototype,"appUrl",void 0);M([h(),B("design:type",String)],Rt.prototype,"appIconPath",void 0);M([h(),B("design:type",Array)],Rt.prototype,"capabilities",void 0);Rt=M([Te(),B("design:paramtypes",[String,String,String,String,String,Array])],Rt);var qi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};M([h(),B("design:type",String)],qi.prototype,"did",void 0);M([h(),B("design:type",Boolean)],qi.prototype,"success",void 0);M([h(),B("design:type",String)],qi.prototype,"error",void 0);qi=M([H(),B("design:paramtypes",[String,Boolean,String])],qi);var Ir=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},Tr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},lt=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)}};Ir([h(),Tr("design:type",Boolean)],lt.prototype,"isInitialized",void 0);Ir([h(),Tr("design:type",Boolean)],lt.prototype,"isUnlocked",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"did",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"didDocument",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"error",void 0);lt=Ir([H(),Tr("design:paramtypes",[Object])],lt);var yc=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)},Qe,Ge,Xs=class{constructor(e,t){Qe.set(this,void 0),Ge.set(this,void 0),yc(this,Qe,e,"f"),yc(this,Ge,t,"f")}async otherAgents(){return await me(this,Qe,"f").otherAgents(me(this,Ge,"f"))}async hasTelepresenceAdapter(){return await me(this,Qe,"f").hasTelepresenceAdapter(me(this,Ge,"f"))}async onlineAgents(){return await me(this,Qe,"f").onlineAgents(me(this,Ge,"f"))}async setOnlineStatus(e){return await me(this,Qe,"f").setOnlineStatus(me(this,Ge,"f"),e)}async setOnlineStatusU(e){return await me(this,Qe,"f").setOnlineStatusU(me(this,Ge,"f"),e)}async sendSignal(e,t){return await me(this,Qe,"f").sendSignal(me(this,Ge,"f"),e,t)}async sendSignalU(e,t){return await me(this,Qe,"f").sendSignalU(me(this,Ge,"f"),e,t)}async sendBroadcast(e,t=!1){return await me(this,Qe,"f").sendBroadcast(me(this,Ge,"f"),e,t)}async sendBroadcastU(e,t=!1){return await me(this,Qe,"f").sendBroadcastU(me(this,Ge,"f"),e,t)}async addSignalHandler(e){await me(this,Qe,"f").addSignalHandler(me(this,Ge,"f"),e)}removeSignalHandler(e){me(this,Qe,"f").removeSignalHandler(me(this,Ge,"f"),e)}};Qe=new WeakMap,Ge=new WeakMap;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)},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)}};Ji([h(),Yi("design:type",String)],ae.prototype,"source",void 0);Ji([h(),Yi("design:type",String)],ae.prototype,"target",void 0);Ji([h(),Yi("design:type",String)],ae.prototype,"predicate",void 0);Ji([h(),Yi("design:type",Date)],ae.prototype,"fromDate",void 0);Ji([h(),Yi("design:type",Date)],ae.prototype,"untilDate",void 0);Ji([h(),Yi("design:type",Number)],ae.prototype,"limit",void 0);ae=Ji([H(),Te(),Yi("design:paramtypes",[Object])],ae);var vc=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)},Ze,Mt;function Xn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var le=class{constructor(){Ze.set(this,void 0),Mt.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 vc(t,Mt,e,"f"),t}static from(e){let t=new le;return vc(t,Ze,e,"f"),t}toUrl(){if(Le(this,Mt,"f")&&!Le(this,Ze,"f"))return Le(this,Mt,"f");if(!Le(this,Mt,"f")&&(Le(this,Ze,"f")===void 0||Le(this,Ze,"f")===""||Le(this,Ze,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Le(this,Ze,"f")){case"string":e=`string:${Xn(Le(this,Ze,"f"))}`;break;case"number":e=`number:${Xn(Le(this,Ze,"f"))}`;break;case"boolean":e=`boolean:${Xn(Le(this,Ze,"f"))}`;break;case"object":e=`json:${Xn(JSON.stringify(Le(this,Ze,"f")))}`;break}return`literal://${e}`}get(){if(Le(this,Ze,"f"))return Le(this,Ze,"f");if(!Le(this,Mt,"f"))throw new Error("Can't render empty Literal");if(!Le(this,Mt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Le(this,Mt,"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}`)}};Ze=new WeakMap,Mt=new WeakMap;function He(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Ya(i){return`set${He(i)}`}function Vl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function tp(i){return`add${He(Vl(i))}`}function ip(i){return`remove${He(Vl(i))}`}function rp(i){return`set${He(i)}`}function Wl(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 Ei(i){if(Array.isArray(i))return`[${i.map(Ei).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 Cs=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,gn=class{constructor(i,e,t){Fe.set(this,void 0),je.set(this,void 0),ye.set(this,void 0),Cs(this,Fe,e,"f"),Cs(this,je,t,"f"),Cs(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[Ya(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[tp(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[ip(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[rp(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 np(i,e,t,r){let n="",a=Wl(8);n+=`subject_class("${i}", ${a}).
|
|
435
|
-
`;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
|
|
436
|
-
`,{through:g,initial:_,required:E,resolveLanguage:A,writable:
|
|
437
|
-
`,
|
|
438
|
-
`),
|
|
439
|
-
`:g&&(
|
|
440
|
-
`,E&&(w?l.push(`triple(Base, "${g}", "${_}")`):l.push(`triple(Base, "${g}", _)`))),U)
|
|
441
|
-
`;else if(
|
|
442
|
-
`}c.push(
|
|
443
|
-
`,{predicate:g,local:_}=m[d];if(g){
|
|
444
|
-
`;let E=[{action:"addLink",source:"this",predicate:g,target:"value",..._&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:g,target:"value"}],
|
|
445
|
-
`,
|
|
446
|
-
`,
|
|
447
|
-
`}u.push(
|
|
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}').
|
|
448
492
|
`,l.length>0){let d=l.join(", ");n+=`instance(${a}, Base) :- ${d}.
|
|
449
493
|
`,n+=`
|
|
450
|
-
`}return n+=`destructor(${a}, '${
|
|
494
|
+
`}return n+=`destructor(${a}, '${Ai(s)}').
|
|
451
495
|
`,n+=`
|
|
452
496
|
`,n+=c.join(`
|
|
453
497
|
`),n+=`
|
|
454
498
|
`,n+=u.join(`
|
|
455
|
-
`),{sdna:n,name:i}}function
|
|
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#> .
|
|
456
500
|
`;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
457
501
|
`,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
458
502
|
`,e+=`@prefix ad4m: <ad4m://> .
|
|
@@ -467,27 +511,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
|
|
|
467
511
|
`),r.nodeKind&&(e+=` sh:nodeKind sh:${r.nodeKind} ;
|
|
468
512
|
`),r.minCount!==void 0&&(e+=` sh:minCount ${r.minCount} ;
|
|
469
513
|
`),r.maxCount!==void 0&&(e+=` sh:maxCount ${r.maxCount} ;
|
|
470
|
-
`),r.pattern&&(e+=` sh:pattern "${
|
|
514
|
+
`),r.pattern&&(e+=` sh:pattern "${_c(r.pattern)}" ;
|
|
471
515
|
`),r.minInclusive!==void 0&&(e+=` sh:minInclusive ${r.minInclusive} ;
|
|
472
516
|
`),r.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${r.maxInclusive} ;
|
|
473
|
-
`),r.hasValue&&(e+=` sh:hasValue "${
|
|
517
|
+
`),r.hasValue&&(e+=` sh:hasValue "${_c(r.hasValue)}" ;
|
|
474
518
|
`),r.local!==void 0&&(e+=` ad4m:local ${r.local} ;
|
|
475
519
|
`),r.writable!==void 0&&(e+=` ad4m:writable ${r.writable} ;
|
|
476
520
|
`),e=e.slice(0,-2)+`
|
|
477
521
|
`,e+=n?` ] .
|
|
478
522
|
`:` ] ;
|
|
479
|
-
`}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=bc(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 ii(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 f=e.find(T=>T.source===c&&T.predicate==="sh://nodeKind");f&&(y.nodeKind=f.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 k=e.find(T=>T.source===c&&T.predicate==="sh://maxInclusive");if(k){let T=k.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 C=e.find(T=>T.source===c&&T.predicate==="ad4m://local");if(C){let T=C.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 Q=e.find(T=>T.source===c&&T.predicate==="ad4m://setter");if(Q)try{let T=Q.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 We=e.find(T=>T.source===c&&T.predicate==="ad4m://conformanceConditions");if(We)try{let T=We.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(T)}catch{}let Or=e.find(T=>T.source===c&&T.predicate==="sh://class");Or&&(y.class=Or.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 ii(e.node_shape_uri,e.target_class):new ii(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 _c(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 Kl(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`${_c(e)} your ${t} actions, with access to ${_c(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 ap(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 Ql(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=ap(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function sp(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));if(Object.keys(t).length>0){let f=t[Object.keys(t)[0]];if(f.through){let g=f.through.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}else if(Object.keys(o).length>0){let f=o[Object.keys(o)[0]];if(f.predicate){let g=f.predicate.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new ii(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let f=m.generateSHACL();f?.shape?.nodeShapeUri&&u.addParentShape(f.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let f in t){let g=t[f];if(!g.through)continue;let _={name:f,path:g.through};if(g.resolveLanguage==="literal")_.datatype="xsd://string";else if(g.initial){let A=typeof a[f];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 '${f}' 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[Ya(f)]=="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 f in o){let g=o[f];if(!g.predicate)continue;let _={name:f,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,k=Ql(g.where,A);if(k.length>0){let w=ee(g.predicate);_.getter=`(->link[WHERE predicate = '${w}'].out[WHERE ${k.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 Tt=new WeakMap,De=new WeakMap;function Hi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Tt.get(n);a&&Object.assign(e,a)}return e}function $t(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 op(i,e,t){Tt.has(i)||Tt.set(i,{}),Tt.get(i)[e]=t}function cp(i,e,t){De.has(i)||De.set(i,{}),De.get(i)[e]=t}function Gl(i,e){try{let t=Hi(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 Xa(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(Tt.has(n)||Tt.set(n,{}),Tt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${He(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function S0(i){return Xa({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function _0(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;Tt.has(n)||Tt.set(n,{}),Tt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function lp(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return np(i.name,e.prototype,Hi(e),$t(e))},e.generateSHACL=function(){return sp(i.name,e,Hi(e),$t(e),Gl)},Object.defineProperty(e,"type",{configurable:!0})}}function up(i){let e=i.required??!1;return Xa({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function x0(i){return up({...i,readOnly:!0})}function es(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 E0(i,e){let t=es(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${He(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${He(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${He(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function $0(i,e){let t=es(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?(Xa({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${He(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${He(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${He(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function A0(i,e){let t=es(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?Xa({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function k0(i,e){let t=es(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 Sr=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 Sr(o,s),c=e.find(f=>f.source===t&&f.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let f=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(f))}catch{l.flowable="any"}let u=e.find(f=>f.source===t&&f.predicate==="ad4m://startAction");if(u)try{let f=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(f))}catch{}let m=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasState"),y=new Map;for(let f of m){let g=f.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"),k=A?le.fromUrl(A.target).get():0,w=e.find(U=>U.source===g&&U.predicate==="ad4m://stateCheck"),C={predicate:"",target:""};if(w)try{let U=w.target.replace("literal://string:","");C=JSON.parse(decodeURIComponent(U))}catch{}l.addState({name:E,value:k,stateCheck:C})}let d=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasTransition");for(let f of d){let g=f.target,_=e.find(R=>R.source===g&&R.predicate==="ad4m://actionName"),E=_?le.fromUrl(_.target).get():"",k=e.find(R=>R.source===g&&R.predicate==="ad4m://fromState")?.target||"",w=y.get(k)||"",U=e.find(R=>R.source===g&&R.predicate==="ad4m://toState")?.target||"",P=y.get(U)||"",Q=e.find(R=>R.source===g&&R.predicate==="ad4m://transitionActions"),V=[];if(Q)try{let R=Q.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 Sr(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)},va,Ft,_t,xt,Ri,Zt,Jt,$i,Gr,ba,Ai,ki,ot,hr,eo,re,ne,Ii,Ti,Ci,Zr,Ma=class{constructor(e,t,r){va.add(this),Ft.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),Ri.set(this,void 0),Zt.set(this,void 0),Jt.set(this,void 0),$i.set(this,void 0),Gr.set(this,!1),ba.set(this,void 0),Ai.set(this,void 0),ki.set(this,void 0),ot.set(this,void 0),hr.set(this,void 0),this.isSurrealDB=!1,oe(this,Ft,e,"f"),oe(this,hr,t,"f"),oe(this,xt,r,"f"),oe(this,Ri,new Set,"f"),oe(this,$i,null,"f"),oe(this,ba,new Promise((n,a)=>{oe(this,Ai,n,"f"),oe(this,ki,a,"f")}),"f")}async subscribe(){x(this,Jt,"f")&&(x(this,Jt,"f").call(this),oe(this,Jt,void 0,"f")),x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,Zt,"f")&&(clearTimeout(x(this,Zt,"f")),oe(this,Zt,void 0,"f"));try{let t;this.isSurrealDB?t=await x(this,xt,"f").perspectiveSubscribeSurrealQuery(x(this,Ft,"f"),x(this,hr,"f")):t=await x(this,xt,"f").subscribeQuery(x(this,Ft,"f"),x(this,hr,"f")),oe(this,_t,t.subscriptionId,"f"),t.result?(oe(this,$i,t.result,"f"),x(this,va,"m",eo).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),oe(this,ot,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,Jt,x(this,xt,"f").subscribeToQueryUpdates(x(this,_t,"f"),r=>{x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,Ai,"f")&&(x(this,Ai,"f").call(this,!0),oe(this,Ai,void 0,"f"),oe(this,ki,void 0,"f")),!(r.isInit&&x(this,$i,"f"))&&(oe(this,$i,r,"f"),x(this,va,"m",eo).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),x(this,ki,"f")&&(x(this,ki,"f").call(this,t),oe(this,Ai,void 0,"f"),oe(this,ki,void 0,"f")),t}let e=async()=>{if(!x(this,Gr,"f")){try{this.isSurrealDB?await x(this,xt,"f").perspectiveKeepAliveSurrealQuery(x(this,Ft,"f"),x(this,_t,"f")):await x(this,xt,"f").keepAliveQuery(x(this,Ft,"f"),x(this,_t,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",x(this,hr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}x(this,Gr,"f")||oe(this,Zt,setTimeout(e,3e4),"f")}};oe(this,Zt,setTimeout(e,3e4),"f")}get id(){return x(this,_t,"f")}get initialized(){return x(this,ba,"f")}get result(){return x(this,$i,"f")}onResult(e){return x(this,Ri,"f").add(e),()=>x(this,Ri,"f").delete(e)}dispose(){oe(this,Gr,!0,"f"),clearTimeout(x(this,Zt,"f")),x(this,Jt,"f")&&x(this,Jt,"f").call(this),x(this,Ri,"f").clear(),x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,_t,"f")&&(this.isSurrealDB?x(this,xt,"f").perspectiveDisposeSurrealQuerySubscription(x(this,Ft,"f"),x(this,_t,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):x(this,xt,"f").disposeQuerySubscription(x(this,Ft,"f"),x(this,_t,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Ft=new WeakMap,_t=new WeakMap,xt=new WeakMap,Ri=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$i=new WeakMap,Gr=new WeakMap,ba=new WeakMap,Ai=new WeakMap,ki=new WeakMap,ot=new WeakMap,hr=new WeakMap,va=new WeakSet,eo=function i(e){for(let t of x(this,Ri,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var mr=class{constructor(e,t){re.set(this,void 0),ne.set(this,void 0),Ii.set(this,void 0),Ti.set(this,void 0),Ci.set(this,void 0),Zr.set(this,void 0),oe(this,Ii,[],"f"),oe(this,Ti,[],"f"),oe(this,Ci,[],"f"),oe(this,Zr,[],"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,Ii,"f")),x(this,ne,"f").addPerspectiveLinkRemovedListener(x(this,re,"f").uuid,x(this,Ti,"f")),x(this,ne,"f").addPerspectiveLinkUpdatedListener(x(this,re,"f").uuid,x(this,Ci,"f")),x(this,ne,"f").addPerspectiveSyncStateChangeListener(x(this,re,"f").uuid,x(this,Zr,"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,Ii,"f").push(t):e==="link-removed"?x(this,Ti,"f").push(t):e==="link-updated"&&x(this,Ci,"f").push(t)}async addSyncStateChangeListener(e){x(this,Zr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=x(this,Ii,"f").indexOf(t);x(this,Ii,"f").splice(r,1)}else if(e==="link-removed"){let r=x(this,Ti,"f").indexOf(t);x(this,Ti,"f").splice(r,1)}else if(e==="link-updated"){let r=x(this,Ci,"f").indexOf(t);x(this,Ci,"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 Je({source:s.source,predicate:s.predicate,target:s.target})),new Je({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Je({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 ii.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 Je({source:s.source,predicate:s.predicate,target:s.target})),new Je({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Je({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 Sr.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 gn(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 f=await this.querySurrealDB(`RETURN ${d}`);(f===!0||Array.isArray(f)&&f.length>0&&f[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 gn(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 gn(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?Hi(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($t(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
|
|
480
524
|
in.uri AS shape_source,
|
|
481
525
|
predicate,
|
|
482
526
|
out.uri AS target
|
|
483
527
|
FROM link
|
|
484
|
-
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
|
|
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=`
|
|
485
529
|
author
|
|
486
530
|
timestamp
|
|
487
531
|
status
|
|
488
532
|
data { source, predicate, target }
|
|
489
533
|
proof { valid, invalid, signature, key }
|
|
490
|
-
`,
|
|
534
|
+
`,ur=`
|
|
491
535
|
uuid
|
|
492
536
|
name
|
|
493
537
|
sharedUrl
|
|
@@ -508,73 +552,73 @@ neighbourhood {
|
|
|
508
552
|
}
|
|
509
553
|
author
|
|
510
554
|
}
|
|
511
|
-
`,
|
|
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 {
|
|
512
556
|
perspectives {
|
|
513
|
-
${
|
|
557
|
+
${ur}
|
|
514
558
|
}
|
|
515
|
-
}`}));return e.map(t=>new
|
|
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!) {
|
|
516
560
|
perspective(uuid: $uuid) {
|
|
517
|
-
${
|
|
561
|
+
${ur}
|
|
518
562
|
}
|
|
519
|
-
}`,variables:{uuid:e}}));return t?new
|
|
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!) {
|
|
520
564
|
perspectiveSnapshot(uuid: $uuid) {
|
|
521
565
|
links { ${Me} }
|
|
522
566
|
}
|
|
523
|
-
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=b(await
|
|
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!) {
|
|
524
568
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
525
|
-
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=b(await
|
|
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!) {
|
|
526
570
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
527
571
|
${Me}
|
|
528
572
|
}
|
|
529
|
-
}`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=b(await
|
|
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!) {
|
|
530
574
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
531
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=b(await
|
|
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!) {
|
|
532
576
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
533
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=b(await
|
|
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!) {
|
|
534
578
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
535
579
|
subscriptionId
|
|
536
580
|
result
|
|
537
581
|
}
|
|
538
|
-
}`,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
|
|
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!) {
|
|
539
583
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
540
584
|
subscriptionId
|
|
541
585
|
result
|
|
542
586
|
}
|
|
543
|
-
}`,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
|
|
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!) {
|
|
544
588
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
545
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=b(await
|
|
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!) {
|
|
546
590
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
547
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=
|
|
591
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=H(this,J,"f").subscribe({query:v`
|
|
548
592
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
549
593
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
550
594
|
}
|
|
551
|
-
`,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
|
|
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!) {
|
|
552
596
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
553
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=b(await
|
|
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!) {
|
|
554
598
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
555
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=b(await
|
|
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!) {
|
|
556
600
|
perspectiveAdd(name: $name) {
|
|
557
|
-
${
|
|
601
|
+
${ur}
|
|
558
602
|
}
|
|
559
|
-
}`,variables:{name:e}}));return new
|
|
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!) {
|
|
560
604
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
561
|
-
${
|
|
605
|
+
${ur}
|
|
562
606
|
}
|
|
563
|
-
}`,variables:{uuid:e,name:t}}));return new
|
|
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!) {
|
|
564
608
|
perspectiveRemove(uuid: $uuid)
|
|
565
|
-
}`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=b(await
|
|
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) {
|
|
566
610
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
567
611
|
${Me}
|
|
568
612
|
}
|
|
569
|
-
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=b(await
|
|
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) {
|
|
570
614
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
571
615
|
${Me}
|
|
572
616
|
}
|
|
573
|
-
}`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=b(await
|
|
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) {
|
|
574
618
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
575
619
|
${Me}
|
|
576
620
|
}
|
|
577
|
-
}`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=b(await
|
|
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){
|
|
578
622
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
579
623
|
additions {
|
|
580
624
|
${Me}
|
|
@@ -583,43 +627,43 @@ neighbourhood {
|
|
|
583
627
|
${Me}
|
|
584
628
|
}
|
|
585
629
|
}
|
|
586
|
-
}`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=b(await
|
|
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) {
|
|
587
631
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
588
632
|
${Me}
|
|
589
633
|
}
|
|
590
|
-
}`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=b(await
|
|
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) {
|
|
591
635
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
592
636
|
${Me}
|
|
593
637
|
}
|
|
594
|
-
}`,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
|
|
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) {
|
|
595
639
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
596
|
-
}`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return b(await
|
|
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) {
|
|
597
641
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
598
|
-
}`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return b(await
|
|
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) {
|
|
599
643
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
600
|
-
}`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return b(await
|
|
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) {
|
|
601
645
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
602
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return b(await
|
|
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!) {
|
|
603
647
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
604
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await
|
|
605
|
-
perspectiveAdded { ${
|
|
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} }
|
|
606
650
|
}
|
|
607
|
-
`}).subscribe({next:e=>{
|
|
608
|
-
perspectiveUpdated { ${
|
|
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} }
|
|
609
653
|
}
|
|
610
|
-
`}).subscribe({next:e=>{
|
|
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 {
|
|
611
655
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
612
656
|
}
|
|
613
|
-
`}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){
|
|
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 {
|
|
614
658
|
perspectiveRemoved
|
|
615
659
|
}
|
|
616
|
-
`}).subscribe({next:e=>{
|
|
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 {
|
|
617
661
|
perspectiveLinkAdded(uuid: "${e}") { ${Me} }
|
|
618
662
|
}
|
|
619
|
-
`}).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){
|
|
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 {
|
|
620
664
|
perspectiveLinkRemoved(uuid: "${e}") { ${Me} }
|
|
621
665
|
}
|
|
622
|
-
`}).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){
|
|
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 {
|
|
623
667
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
624
668
|
oldLink {
|
|
625
669
|
${Me}
|
|
@@ -629,9 +673,9 @@ neighbourhood {
|
|
|
629
673
|
}
|
|
630
674
|
}
|
|
631
675
|
}
|
|
632
|
-
`}).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
|
|
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!) {
|
|
633
677
|
perspectiveCreateBatch(uuid: $uuid)
|
|
634
|
-
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=b(await
|
|
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!) {
|
|
635
679
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
636
680
|
additions {
|
|
637
681
|
${Me}
|
|
@@ -640,7 +684,7 @@ neighbourhood {
|
|
|
640
684
|
${Me}
|
|
641
685
|
}
|
|
642
686
|
}
|
|
643
|
-
}`,variables:{uuid:e,batchId:t}}));return r}};
|
|
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=`
|
|
644
688
|
did
|
|
645
689
|
directMessageLanguage
|
|
646
690
|
perspective {
|
|
@@ -654,7 +698,7 @@ neighbourhood {
|
|
|
654
698
|
}
|
|
655
699
|
}
|
|
656
700
|
}
|
|
657
|
-
`,
|
|
701
|
+
`,ra=`
|
|
658
702
|
requestId
|
|
659
703
|
revoked
|
|
660
704
|
auth {
|
|
@@ -670,159 +714,166 @@ neighbourhood {
|
|
|
670
714
|
can
|
|
671
715
|
}
|
|
672
716
|
}
|
|
673
|
-
`,
|
|
717
|
+
`,dr=`
|
|
674
718
|
isInitialized
|
|
675
719
|
isUnlocked
|
|
676
720
|
did
|
|
677
721
|
didDocument
|
|
678
722
|
error
|
|
679
|
-
`,
|
|
723
|
+
`,na=`
|
|
680
724
|
did
|
|
681
725
|
didSigningKeyId
|
|
682
726
|
deviceKeyType
|
|
683
727
|
deviceKey
|
|
684
728
|
deviceKeySignedByDid
|
|
685
729
|
didSignedByDeviceKey
|
|
686
|
-
`,
|
|
730
|
+
`,hp=`
|
|
687
731
|
signature
|
|
688
732
|
publicKey
|
|
689
|
-
|
|
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 {
|
|
690
734
|
agentStatus {
|
|
691
|
-
${
|
|
735
|
+
${dr}
|
|
692
736
|
}
|
|
693
|
-
}`}));return new
|
|
737
|
+
}`}));return new dt(e)}async generate(e){let{agentGenerate:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentGenerate(
|
|
694
738
|
$passphrase: String!
|
|
695
739
|
) {
|
|
696
740
|
agentGenerate(passphrase: $passphrase) {
|
|
697
|
-
${
|
|
741
|
+
${dr}
|
|
698
742
|
}
|
|
699
|
-
}`,variables:{passphrase:e}}));return new
|
|
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(
|
|
700
744
|
$did: String!,
|
|
701
745
|
$didDocument: String!,
|
|
702
746
|
$keystore: String!,
|
|
703
747
|
$passphrase: String!
|
|
704
748
|
) {
|
|
705
749
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
706
|
-
${
|
|
750
|
+
${dr}
|
|
707
751
|
}
|
|
708
|
-
}`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new
|
|
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!) {
|
|
709
753
|
agentLock(passphrase: $passphrase) {
|
|
710
|
-
${
|
|
754
|
+
${dr}
|
|
711
755
|
}
|
|
712
|
-
}`,variables:{passphrase:e}}));return new
|
|
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!) {
|
|
713
757
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
714
|
-
${
|
|
758
|
+
${dr}
|
|
715
759
|
}
|
|
716
|
-
}`,variables:{passphrase:e,holochain:t}}));return new
|
|
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!) {
|
|
717
761
|
agentByDID(did: $did) {
|
|
718
|
-
${
|
|
762
|
+
${Wr}
|
|
719
763
|
}
|
|
720
|
-
}`,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
|
|
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!) {
|
|
721
765
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
722
|
-
${
|
|
766
|
+
${Wr}
|
|
723
767
|
}
|
|
724
|
-
}`,variables:{perspective:t}})),n=r,a=new
|
|
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!) {
|
|
725
769
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
726
|
-
${
|
|
770
|
+
${Wr}
|
|
727
771
|
}
|
|
728
|
-
}`,variables:{directMessageLanguage:e}})),r=t,n=new
|
|
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!]!) {
|
|
729
773
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
730
|
-
${
|
|
774
|
+
${na}
|
|
731
775
|
}
|
|
732
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=b(await
|
|
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!]!) {
|
|
733
777
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
734
|
-
${
|
|
778
|
+
${na}
|
|
735
779
|
}
|
|
736
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=b(await
|
|
780
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=b(await Q(this,X,"f").query({query:v`query agentGetEntanglementProofs {
|
|
737
781
|
agentGetEntanglementProofs {
|
|
738
|
-
${
|
|
782
|
+
${na}
|
|
739
783
|
}
|
|
740
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=b(await
|
|
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!) {
|
|
741
785
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
742
|
-
${
|
|
786
|
+
${na}
|
|
743
787
|
}
|
|
744
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){
|
|
745
|
-
agentUpdated { ${
|
|
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} }
|
|
746
790
|
}
|
|
747
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;
|
|
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 {
|
|
748
792
|
agentAppsChanged {
|
|
749
|
-
${
|
|
793
|
+
${ra}
|
|
750
794
|
}
|
|
751
795
|
}
|
|
752
|
-
`}).subscribe({next:e=>{
|
|
753
|
-
agentStatusChanged { ${
|
|
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} }
|
|
754
798
|
}
|
|
755
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;
|
|
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`
|
|
756
807
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
757
808
|
agentRequestCapability(authInfo: $authInfo)
|
|
758
809
|
}
|
|
759
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=b(await
|
|
810
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=b(await Q(this,X,"f").mutate({mutation:v`
|
|
760
811
|
mutation agentPermitCapability($auth: String!) {
|
|
761
812
|
agentPermitCapability(auth: $auth)
|
|
762
813
|
}
|
|
763
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=b(await
|
|
814
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=b(await Q(this,X,"f").mutate({mutation:v`
|
|
764
815
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
765
816
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
766
817
|
}
|
|
767
|
-
`,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=b(await
|
|
818
|
+
`,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=b(await Q(this,X,"f").mutate({mutation:v`query agentGetApps {
|
|
768
819
|
agentGetApps {
|
|
769
|
-
${
|
|
820
|
+
${ra}
|
|
770
821
|
}
|
|
771
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=b(await
|
|
822
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
|
|
772
823
|
agentRemoveApp(requestId: $requestId) {
|
|
773
|
-
${
|
|
824
|
+
${ra}
|
|
774
825
|
}
|
|
775
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=b(await
|
|
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!) {
|
|
776
827
|
agentRevokeToken(requestId: $requestId) {
|
|
777
|
-
${
|
|
828
|
+
${ra}
|
|
778
829
|
}
|
|
779
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=b(await
|
|
830
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=b(await Q(this,X,"f").mutate({mutation:v`
|
|
780
831
|
query agentIsLocked {
|
|
781
832
|
agentIsLocked
|
|
782
833
|
}
|
|
783
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=b(await
|
|
834
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
|
|
784
835
|
agentSignMessage(message: $message) {
|
|
785
|
-
${
|
|
836
|
+
${hp}
|
|
786
837
|
}
|
|
787
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=b(await
|
|
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) {
|
|
788
839
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
789
840
|
did
|
|
790
841
|
success
|
|
791
842
|
error
|
|
792
843
|
}
|
|
793
|
-
}`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=b(await
|
|
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!) {
|
|
794
845
|
runtimeLoginUser(email: $email, password: $password)
|
|
795
|
-
}`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=b(await
|
|
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) {
|
|
796
847
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
797
848
|
success
|
|
798
849
|
message
|
|
799
850
|
requiresPassword
|
|
800
851
|
isExistingUser
|
|
801
852
|
}
|
|
802
|
-
}`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=b(await
|
|
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!) {
|
|
803
854
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
804
|
-
}`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=b(await
|
|
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 {
|
|
805
856
|
runtimeHostingUserInfo {
|
|
806
857
|
email
|
|
807
858
|
remainingCredits
|
|
808
859
|
hotWalletAddress
|
|
809
860
|
freeAccess
|
|
810
861
|
}
|
|
811
|
-
}`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=b(await
|
|
862
|
+
}`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=b(await Q(this,X,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
|
|
812
863
|
runtimeSetHotWalletAddress(address: $address)
|
|
813
|
-
}`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=b(await
|
|
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!) {
|
|
814
865
|
runtimeRequestPayment(amountHOT: $amountHOT) {
|
|
815
866
|
success
|
|
816
867
|
message
|
|
817
868
|
}
|
|
818
|
-
}`,variables:{amountHOT:e}}));return t}};X=new WeakMap,
|
|
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=`
|
|
819
870
|
name
|
|
820
871
|
address
|
|
821
872
|
settings
|
|
822
873
|
icon { code }
|
|
823
874
|
constructorIcon { code }
|
|
824
875
|
settingsIcon { code }
|
|
825
|
-
`,
|
|
876
|
+
`,Ac=`
|
|
826
877
|
name
|
|
827
878
|
address
|
|
828
879
|
description
|
|
@@ -832,45 +883,45 @@ neighbourhood {
|
|
|
832
883
|
templateAppliedParams
|
|
833
884
|
possibleTemplateParams
|
|
834
885
|
sourceCodeLink
|
|
835
|
-
`,
|
|
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!) {
|
|
836
887
|
language(address: $address) {
|
|
837
|
-
${
|
|
888
|
+
${$c}
|
|
838
889
|
}
|
|
839
|
-
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=b(await
|
|
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!) {
|
|
840
891
|
languages(filter: $filter) {
|
|
841
|
-
${
|
|
892
|
+
${$c}
|
|
842
893
|
}
|
|
843
|
-
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=b(await
|
|
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!) {
|
|
844
895
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
845
|
-
}`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=b(await
|
|
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(
|
|
846
897
|
$sourceLanguageHash: String!,
|
|
847
898
|
$templateData: String!,
|
|
848
899
|
) {
|
|
849
900
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
850
901
|
name, address
|
|
851
902
|
}
|
|
852
|
-
}`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=b(await
|
|
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(
|
|
853
904
|
$languagePath: String!,
|
|
854
905
|
$languageMeta: LanguageMetaInput!,
|
|
855
906
|
) {
|
|
856
907
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
857
|
-
${
|
|
908
|
+
${Ac}
|
|
858
909
|
}
|
|
859
|
-
}`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=b(await
|
|
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(
|
|
860
911
|
$address: String!,
|
|
861
912
|
) {
|
|
862
913
|
languageMeta(address: $address) {
|
|
863
|
-
${
|
|
914
|
+
${Ac}
|
|
864
915
|
}
|
|
865
|
-
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=b(await
|
|
916
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=b(await Zt(this,vt,"f").query({query:v`query languageSource(
|
|
866
917
|
$address: String!,
|
|
867
918
|
) {
|
|
868
919
|
languageSource(address: $address)
|
|
869
|
-
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=b(await
|
|
920
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=b(await Zt(this,vt,"f").mutate({mutation:v`mutation languageRemove(
|
|
870
921
|
$address: String!,
|
|
871
922
|
) {
|
|
872
923
|
languageRemove(address: $address)
|
|
873
|
-
}`,variables:{address:e}}));return t}};
|
|
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(
|
|
874
925
|
$linkLanguage: String!,
|
|
875
926
|
$meta: PerspectiveInput!,
|
|
876
927
|
$perspectiveUUID: String!
|
|
@@ -979,7 +1030,7 @@ neighbourhood {
|
|
|
979
1030
|
payload: $payload,
|
|
980
1031
|
loopback: $loopback
|
|
981
1032
|
)
|
|
982
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Oe(this,
|
|
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!) {
|
|
983
1034
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
984
1035
|
author
|
|
985
1036
|
timestamp
|
|
@@ -994,7 +1045,7 @@ neighbourhood {
|
|
|
994
1045
|
}
|
|
995
1046
|
proof { valid, invalid, signature, key }
|
|
996
1047
|
}
|
|
997
|
-
}`,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,
|
|
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=`
|
|
998
1049
|
author
|
|
999
1050
|
timestamp
|
|
1000
1051
|
data {
|
|
@@ -1006,7 +1057,7 @@ data {
|
|
|
1006
1057
|
}
|
|
1007
1058
|
}
|
|
1008
1059
|
proof { valid, invalid, signature, key }
|
|
1009
|
-
`,
|
|
1060
|
+
`,mp=`
|
|
1010
1061
|
description
|
|
1011
1062
|
appName
|
|
1012
1063
|
appUrl
|
|
@@ -1015,15 +1066,15 @@ trigger
|
|
|
1015
1066
|
perspectiveIds
|
|
1016
1067
|
webhookUrl
|
|
1017
1068
|
webhookAuth
|
|
1018
|
-
`,
|
|
1069
|
+
`,Xl=`
|
|
1019
1070
|
id
|
|
1020
1071
|
granted
|
|
1021
|
-
${
|
|
1022
|
-
`,
|
|
1023
|
-
notification { ${
|
|
1072
|
+
${mp}
|
|
1073
|
+
`,yp=`
|
|
1074
|
+
notification { ${Xl} }
|
|
1024
1075
|
perspectiveId
|
|
1025
1076
|
triggerMatch
|
|
1026
|
-
`,
|
|
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 {
|
|
1027
1078
|
runtimeInfo {
|
|
1028
1079
|
ad4mExecutorVersion,
|
|
1029
1080
|
isInitialized,
|
|
@@ -1064,16 +1115,16 @@ triggerMatch
|
|
|
1064
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!) {
|
|
1065
1116
|
runtimeSetStatus(status: $status)
|
|
1066
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!) {
|
|
1067
|
-
runtimeFriendStatus(did: $did) { ${
|
|
1118
|
+
runtimeFriendStatus(did: $did) { ${sa} }
|
|
1068
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!) {
|
|
1069
1120
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
1070
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) {
|
|
1071
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
1122
|
+
runtimeMessageInbox(filter: $filter) { ${sa} }
|
|
1072
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) {
|
|
1073
1124
|
runtimeMessageOutbox(filter: $filter) {
|
|
1074
1125
|
recipient,
|
|
1075
1126
|
message {
|
|
1076
|
-
${
|
|
1127
|
+
${sa}
|
|
1077
1128
|
}
|
|
1078
1129
|
}
|
|
1079
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!) {
|
|
@@ -1097,7 +1148,7 @@ triggerMatch
|
|
|
1097
1148
|
knownLinkLanguages { total imported failed omitted errors }
|
|
1098
1149
|
}
|
|
1099
1150
|
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=b(await N(this,D,"f").query({query:v`query runtimeNotifications {
|
|
1100
|
-
runtimeNotifications { ${
|
|
1151
|
+
runtimeNotifications { ${Xl} }
|
|
1101
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!) {
|
|
1102
1153
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
1103
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!) {
|
|
@@ -1110,6 +1161,10 @@ triggerMatch
|
|
|
1110
1161
|
runtimeMultiUserEnabled
|
|
1111
1162
|
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
1112
1163
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
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)
|
|
1113
1168
|
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=b(await N(this,D,"f").query({query:v`query runtimeListUsers {
|
|
1114
1169
|
runtimeListUsers {
|
|
1115
1170
|
email
|
|
@@ -1148,20 +1203,20 @@ triggerMatch
|
|
|
1148
1203
|
runtimeSetHostRates(ratesJson: $ratesJson)
|
|
1149
1204
|
}`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=b(await N(this,D,"f").query({query:v`query runtimeHostRates {
|
|
1150
1205
|
runtimeHostRates
|
|
1151
|
-
}`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){N(this,
|
|
1152
|
-
runtimeNotificationTriggered { ${
|
|
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} }
|
|
1153
1208
|
}
|
|
1154
|
-
`}).subscribe({next:e=>{N(this,
|
|
1155
|
-
runtimeMessageReceived { ${
|
|
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} }
|
|
1156
1211
|
}
|
|
1157
|
-
`}).subscribe({next:e=>{N(this,
|
|
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 {
|
|
1158
1213
|
exceptionOccurred {
|
|
1159
1214
|
title
|
|
1160
1215
|
message
|
|
1161
1216
|
type
|
|
1162
1217
|
addon
|
|
1163
1218
|
}
|
|
1164
|
-
}`}).subscribe({next:e=>{N(this,
|
|
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!) {
|
|
1165
1220
|
expression(url: $url) {
|
|
1166
1221
|
author
|
|
1167
1222
|
timestamp
|
|
@@ -1174,7 +1229,7 @@ triggerMatch
|
|
|
1174
1229
|
invalid
|
|
1175
1230
|
}
|
|
1176
1231
|
}
|
|
1177
|
-
}`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=b(await
|
|
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!]!) {
|
|
1178
1233
|
expressionMany(urls: $urls) {
|
|
1179
1234
|
author
|
|
1180
1235
|
timestamp
|
|
@@ -1187,19 +1242,19 @@ triggerMatch
|
|
|
1187
1242
|
invalid
|
|
1188
1243
|
}
|
|
1189
1244
|
}
|
|
1190
|
-
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=b(await
|
|
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!) {
|
|
1191
1246
|
expressionRaw(url: $url)
|
|
1192
|
-
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=b(await
|
|
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!){
|
|
1193
1248
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
1194
|
-
}`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=b(await
|
|
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!) {
|
|
1195
1250
|
expressionInteractions(url: $url) {
|
|
1196
1251
|
label
|
|
1197
1252
|
name
|
|
1198
1253
|
parameters { name, type }
|
|
1199
1254
|
}
|
|
1200
|
-
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=b(await
|
|
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!){
|
|
1201
1256
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
1202
|
-
}`,variables:{url:e,interactionCall:t}}));return r}};jt=new WeakMap;var ts={};ts.byteLength=vp;ts.toByteArray=wp;ts.fromByteArray=xp;var At=[],ct=[],yp=typeof Uint8Array<"u"?Uint8Array:Array,Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(xi=0,$c=Ls.length;xi<$c;++xi)At[xi]=Ls[xi],ct[Ls.charCodeAt(xi)]=xi;var xi,$c;ct["-".charCodeAt(0)]=62;ct["_".charCodeAt(0)]=63;function Yl(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 vp(i){var e=Yl(i),t=e[0],r=e[1];return(t+r)*3/4-r}function bp(i,e,t){return(e+t)*3/4-t}function wp(i){var e,t=Yl(i),r=t[0],n=t[1],a=new yp(bp(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=ct[i.charCodeAt(l)]<<18|ct[i.charCodeAt(l+1)]<<12|ct[i.charCodeAt(l+2)]<<6|ct[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=ct[i.charCodeAt(l)]<<2|ct[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=ct[i.charCodeAt(l)]<<10|ct[i.charCodeAt(l+1)]<<4|ct[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Sp(i){return At[i>>18&63]+At[i>>12&63]+At[i>>6&63]+At[i&63]}function _p(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(Sp(r));return n.join("")}function xp(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(_p(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(At[e>>2]+At[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(At[e>>10]+At[e>>4&63]+At[e<<2&63]+"=")),n.join("")}var Ep=4,Ac=0,kc=1,$p=2;function Cr(i){let e=i.length;for(;--e>=0;)i[e]=0}var Ap=0,Xl=1,kp=2,Ip=3,Tp=258,xo=29,On=256,En=On+1+xo,yr=30,Eo=19,eu=2*En+1,Ni=15,Ps=16,Cp=7,$o=256,tu=16,iu=17,ru=18,ao=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]),xa=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]),Lp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),nu=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pp=512,Bt=new Array((En+2)*2);Cr(Bt);var mn=new Array(yr*2);Cr(mn);var $n=new Array(Pp);Cr($n);var An=new Array(Tp-Ip+1);Cr(An);var Ao=new Array(xo);Cr(Ao);var ja=new Array(yr);Cr(ja);function Rs(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 au,su,ou;function Ns(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var cu=i=>i<256?$n[i]:$n[256+(i>>>7)],kn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Ye=(i,e,t)=>{i.bi_valid>Ps-t?(i.bi_buf|=e<<i.bi_valid&65535,kn(i,i.bi_buf),i.bi_buf=e>>Ps-i.bi_valid,i.bi_valid+=t-Ps):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},kt=(i,e,t)=>{Ye(i,t[e*2],t[e*2+1])},lu=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Rp=i=>{i.bi_valid===16?(kn(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)},Np=(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,f,g=0;for(y=0;y<=Ni;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<eu;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]),f=t[u*2],i.opt_len+=f*(y+d),a&&(i.static_len+=f*(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--)}},uu=(i,e,t)=>{let r=new Array(Ni+1),n=0,a,s;for(a=1;a<=Ni;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]=lu(r[o]++,o))}},Op=()=>{let i,e,t,r,n,a=new Array(Ni+1);for(t=0,r=0;r<xo-1;r++)for(Ao[r]=t,i=0;i<1<<ao[r];i++)An[t++]=r;for(An[t-1]=r,n=0,r=0;r<16;r++)for(ja[r]=n,i=0;i<1<<xa[r];i++)$n[n++]=r;for(n>>=7;r<yr;r++)for(ja[r]=n<<7,i=0;i<1<<xa[r]-7;i++)$n[256+n++]=r;for(e=0;e<=Ni;e++)a[e]=0;for(i=0;i<=143;)Bt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Bt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Bt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Bt[i*2+1]=8,i++,a[8]++;for(uu(Bt,En+1,a),i=0;i<yr;i++)mn[i*2+1]=5,mn[i*2]=lu(i,5);au=new Rs(Bt,ao,On+1,En,Ni),su=new Rs(mn,xa,0,yr,Ni),ou=new Rs(new Array(0),Lp,0,Eo,Cp)},du=i=>{let e;for(e=0;e<En;e++)i.dyn_ltree[e*2]=0;for(e=0;e<yr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<Eo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[$o*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},pu=i=>{i.bi_valid>8?kn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},Ic=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},Os=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&Ic(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!Ic(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},Tc=(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?kt(i,n,e):(s=An[n],kt(i,s+On+1,e),o=ao[s],o!==0&&(n-=Ao[s],Ye(i,n,o)),r--,s=cu(r),kt(i,s,t),o=xa[s],o!==0&&(r-=ja[s],Ye(i,r,o)));while(a<i.sym_next);kt(i,$o,e)},so=(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=eu,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--)Os(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Os(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++,Os(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Np(i,e),uu(t,l,i.bl_count)},Cc=(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[tu*2]++):o<=10?i.bl_tree[iu*2]++:i.bl_tree[ru*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},Lc=(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 kt(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(kt(i,a,i.bl_tree),o--),kt(i,tu,i.bl_tree),Ye(i,o-3,2)):o<=10?(kt(i,iu,i.bl_tree),Ye(i,o-3,3)):(kt(i,ru,i.bl_tree),Ye(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},Dp=i=>{let e;for(Cc(i,i.dyn_ltree,i.l_desc.max_code),Cc(i,i.dyn_dtree,i.d_desc.max_code),so(i,i.bl_desc),e=Eo-1;e>=3&&i.bl_tree[nu[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Up=(i,e,t,r)=>{let n;for(Ye(i,e-257,5),Ye(i,t-1,5),Ye(i,r-4,4),n=0;n<r;n++)Ye(i,i.bl_tree[nu[n]*2+1],3);Lc(i,i.dyn_ltree,e-1),Lc(i,i.dyn_dtree,t-1)},Mp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return Ac;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return kc;for(t=32;t<On;t++)if(i.dyn_ltree[t*2]!==0)return kc;return Ac},Pc=!1,Fp=i=>{Pc||(Op(),Pc=!0),i.l_desc=new Ns(i.dyn_ltree,au),i.d_desc=new Ns(i.dyn_dtree,su),i.bl_desc=new Ns(i.bl_tree,ou),i.bi_buf=0,i.bi_valid=0,du(i)},fu=(i,e,t,r)=>{Ye(i,(Ap<<1)+(r?1:0),3),pu(i),kn(i,t),kn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},jp=i=>{Ye(i,Xl<<1,3),kt(i,$o,Bt),Rp(i)},Bp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===$p&&(i.strm.data_type=Mp(i)),so(i,i.l_desc),so(i,i.d_desc),s=Dp(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?fu(i,e,t,r):i.strategy===Ep||a===n?(Ye(i,(Xl<<1)+(r?1:0),3),Tc(i,Bt,mn)):(Ye(i,(kp<<1)+(r?1:0),3),Up(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),Tc(i,i.dyn_ltree,i.dyn_dtree)),du(i),r&&pu(i)},qp=(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[(An[t]+On+1)*2]++,i.dyn_dtree[cu(e)*2]++),i.sym_next===i.sym_end),Hp=Fp,zp=fu,Vp=Bp,Wp=qp,Kp=jp,Qp={_tr_init:Hp,_tr_stored_block:zp,_tr_flush_block:Vp,_tr_tally:Wp,_tr_align:Kp},Gp=(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},In=Gp,Zp=()=>{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},Jp=new Uint32Array(Zp()),Yp=(i,e,t,r)=>{let n=Jp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},ke=Yp,zi={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Xi={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:Xp,_tr_stored_block:oo,_tr_flush_block:ef,_tr_tally:ri,_tr_align:tf}=Qp,{Z_NO_FLUSH:ni,Z_PARTIAL_FLUSH:rf,Z_FULL_FLUSH:nf,Z_FINISH:ut,Z_BLOCK:Rc,Z_OK:Pe,Z_STREAM_END:Nc,Z_STREAM_ERROR:Ct,Z_DATA_ERROR:af,Z_BUF_ERROR:Ds,Z_DEFAULT_COMPRESSION:sf,Z_FILTERED:of,Z_HUFFMAN_ONLY:aa,Z_RLE:cf,Z_FIXED:lf,Z_DEFAULT_STRATEGY:uf,Z_UNKNOWN:df,Z_DEFLATED:is}=Xi,pf=9,ff=15,hf=8,gf=29,mf=256,co=mf+1+gf,yf=30,vf=19,bf=2*co+1,wf=15,te=3,Xt=258,Lt=Xt+te+1,Sf=32,_r=42,ko=57,lo=69,uo=73,po=91,fo=103,Oi=113,cn=666,qe=1,Lr=2,Vi=3,Pr=4,_f=3,Di=(i,e)=>(i.msg=zi[e],e),Oc=i=>i*2-(i>4?9:0),Yt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},xf=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)},Ef=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ai=Ef,tt=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))},rt=(i,e)=>{ef(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,tt(i.strm)},se=(i,e)=>{i.pending_buf[i.pending++]=e},Wr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},ho=(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=In(i.adler,e,n,t):i.state.wrap===2&&(i.adler=ke(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},hu=(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-Lt?i.strstart-(i.w_size-Lt):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+Xt,d=c[r+s-1],f=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==f||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=Xt-(y-r),r=y-Xt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],f=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},xr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-Lt)&&(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),xf(i),r+=e),i.strm.avail_in===0)break;if(t=ho(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=ai(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ai(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<Lt&&i.strm.avail_in!==0)},gu=(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!==ut||e===ni||r!==n+i.strm.avail_in)))break;s=e===ut&&r===n+i.strm.avail_in?1:0,oo(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,tt(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&&(ho(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?Pr:e!==ni&&e!==ut&&i.strm.avail_in===0&&i.strstart===i.block_start?Lr:(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&&(ho(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===ut)&&e!==ni&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ut&&i.strm.avail_in===0&&r===n?1:0,oo(i,i.block_start,r,s),i.block_start+=r,tt(i.strm)),s?Vi:qe)},Us=(i,e)=>{let t,r;for(;;){if(i.lookahead<Lt){if(xr(i),i.lookahead<Lt&&e===ni)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=ai(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-Lt&&(i.match_length=hu(i,t)),i.match_length>=te)if(r=ri(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=ai(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=ai(i,i.ins_h,i.window[i.strstart+1]);else r=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=i.strstart<te-1?i.strstart:te-1,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},dr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<Lt){if(xr(i),i.lookahead<Lt&&e===ni)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=ai(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-Lt&&(i.match_length=hu(i,t),i.match_length<=5&&(i.strategy===of||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=ri(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=ai(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&&(rt(i,!1),i.strm.avail_out===0))return qe}else if(i.match_available){if(r=ri(i,0,i.window[i.strstart-1]),r&&rt(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return qe}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=ri(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<te-1?i.strstart:te-1,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},$f=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Xt){if(xr(i),i.lookahead<=Xt&&e===ni)return qe;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+Xt;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=Xt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=te?(t=ri(i,1,i.match_length-te),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},Af=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(xr(i),i.lookahead===0)){if(e===ni)return qe;break}if(i.match_length=0,t=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr};function St(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 ln=[new St(0,0,0,0,gu),new St(4,4,8,4,Us),new St(4,5,16,8,Us),new St(4,6,32,32,Us),new St(4,4,16,16,dr),new St(8,16,32,32,dr),new St(8,16,128,128,dr),new St(8,32,128,256,dr),new St(32,128,258,1024,dr),new St(32,258,258,4096,dr)],kf=i=>{i.window_size=2*i.w_size,Yt(i.head),i.max_lazy_match=ln[i.level].max_lazy,i.good_match=ln[i.level].good_length,i.nice_match=ln[i.level].nice_length,i.max_chain_length=ln[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 If(){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=is,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(bf*2),this.dyn_dtree=new Uint16Array((2*yf+1)*2),this.bl_tree=new Uint16Array((2*vf+1)*2),Yt(this.dyn_ltree),Yt(this.dyn_dtree),Yt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(wf+1),this.heap=new Uint16Array(2*co+1),Yt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*co+1),Yt(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 Dn=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==_r&&e.status!==ko&&e.status!==lo&&e.status!==uo&&e.status!==po&&e.status!==fo&&e.status!==Oi&&e.status!==cn?1:0},mu=i=>{if(Dn(i))return Di(i,Ct);i.total_in=i.total_out=0,i.data_type=df;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ko:e.wrap?_r:Oi,i.adler=e.wrap===2?0:1,e.last_flush=-2,Xp(e),Pe},yu=i=>{let e=mu(i);return e===Pe&&kf(i.state),e},Tf=(i,e)=>Dn(i)||i.state.wrap!==2?Ct:(i.state.gzhead=e,Pe),vu=(i,e,t,r,n,a)=>{if(!i)return Ct;let s=1;if(e===sf&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>pf||t!==is||r<8||r>15||e<0||e>9||a<0||a>lf||r===8&&s!==1)return Di(i,Ct);r===8&&(r=9);let o=new If;return i.state=o,o.strm=i,o.status=_r,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,yu(i)},Cf=(i,e)=>vu(i,e,is,ff,hf,uf),Lf=(i,e)=>{if(Dn(i)||e>Rc||e<0)return i?Di(i,Ct):Ct;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===cn&&e!==ut)return Di(i,i.avail_out===0?Ds:Ct);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(tt(i),i.avail_out===0)return t.last_flush=-1,Pe}else if(i.avail_in===0&&Oc(e)<=Oc(r)&&e!==ut)return Di(i,Ds);if(t.status===cn&&i.avail_in!==0)return Di(i,Ds);if(t.status===_r&&t.wrap===0&&(t.status=Oi),t.status===_r){let n=is+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=aa||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Sf),n+=31-n%31,Wr(t,n),t.strstart!==0&&(Wr(t,i.adler>>>16),Wr(t,i.adler&65535)),i.adler=1,t.status=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===ko){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>=aa||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=ke(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=lo;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>=aa||t.level<2?4:0),se(t,_f),t.status=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===lo){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=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,tt(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=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=uo}if(t.status===uo){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=ke(i.adler,t.pending_buf,t.pending-n,n)),tt(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=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=po}if(t.status===po){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=ke(i.adler,t.pending_buf,t.pending-n,n)),tt(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=ke(i.adler,t.pending_buf,t.pending-n,n))}t.status=fo}if(t.status===fo){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(tt(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=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(i.avail_in!==0||t.lookahead!==0||e!==ni&&t.status!==cn){let n=t.level===0?gu(t,e):t.strategy===aa?Af(t,e):t.strategy===cf?$f(t,e):ln[t.level].func(t,e);if((n===Vi||n===Pr)&&(t.status=cn),n===qe||n===Vi)return i.avail_out===0&&(t.last_flush=-1),Pe;if(n===Lr&&(e===rf?tf(t):e!==Rc&&(oo(t,0,0,!1),e===nf&&(Yt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),tt(i),i.avail_out===0))return t.last_flush=-1,Pe}return e!==ut?Pe:t.wrap<=0?Nc:(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)):(Wr(t,i.adler>>>16),Wr(t,i.adler&65535)),tt(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Pe:Nc)},Pf=i=>{if(Dn(i))return Ct;let e=i.state.status;return i.state=null,e===Oi?Di(i,af):Pe},Rf=(i,e)=>{let t=e.length;if(Dn(i))return Ct;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==_r||r.lookahead)return Ct;if(n===1&&(i.adler=In(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Yt(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,xr(r);r.lookahead>=te;){let l=r.strstart,c=r.lookahead-(te-1);do r.ins_h=ai(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,xr(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},Nf=Cf,Of=vu,Df=yu,Uf=mu,Mf=Tf,Ff=Lf,jf=Pf,Bf=Rf,qf="pako deflate (from Nodeca project)",yn={deflateInit:Nf,deflateInit2:Of,deflateReset:Df,deflateResetKeep:Uf,deflateSetHeader:Mf,deflate:Ff,deflateEnd:jf,deflateSetDictionary:Bf,deflateInfo:qf},Hf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),zf=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)Hf(t,r)&&(i[r]=t[r])}}return i},Vf=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},rs={assign:zf,flattenChunks:Vf},bu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){bu=!1}var Tn=new Uint8Array(256);for(let i=0;i<256;i++)Tn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Tn[254]=Tn[254]=1;var Wf=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&&bu)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},Qf=(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=Tn[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)},Gf=(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+Tn[i[t]]>e?t:e},Cn={string2buf:Wf,buf2string:Qf,utf8border:Gf};function Zf(){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 wu=Zf,Su=Object.prototype.toString,{Z_NO_FLUSH:Jf,Z_SYNC_FLUSH:Yf,Z_FULL_FLUSH:Xf,Z_FINISH:eh,Z_OK:Ba,Z_STREAM_END:th,Z_DEFAULT_COMPRESSION:ih,Z_DEFAULT_STRATEGY:rh,Z_DEFLATED:nh}=Xi;function Un(i){this.options=rs.assign({level:ih,method:nh,chunkSize:16384,windowBits:15,memLevel:8,strategy:rh},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 wu,this.strm.avail_out=0;let t=yn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ba)throw new Error(zi[t]);if(e.header&&yn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Cn.string2buf(e.dictionary):Su.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=yn.deflateSetDictionary(this.strm,r),t!==Ba)throw new Error(zi[t]);this._dict_set=!0}}Un.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?eh:Jf,typeof i=="string"?t.input=Cn.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===Yf||a===Xf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=yn.deflate(t,a),n===th)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=yn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ba;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};Un.prototype.onData=function(i){this.chunks.push(i)};Un.prototype.onEnd=function(i){i===Ba&&(this.result=rs.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Io(i,e){let t=new Un(e);if(t.push(i,!0),t.err)throw t.msg||zi[t.err];return t.result}function ah(i,e){return e=e||{},e.raw=!0,Io(i,e)}function sh(i,e){return e=e||{},e.gzip=!0,Io(i,e)}var oh=Un,ch=Io,lh=ah,uh=sh,dh=Xi,ph={Deflate:oh,deflate:ch,deflateRaw:lh,gzip:uh,constants:dh},sa=16209,fh=16191,hh=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,f,g,_,E,A,k,w,C,U,P,Q,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,f=W.bits,g=W.lencode,_=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{f<15&&(d+=V[r++]<<f,f+=8,d+=V[r++]<<f,f+=8),k=g[d&E];t:for(;;){if(w=k>>>24,d>>>=w,f-=w,w=k>>>16&255,w===0)R[a++]=k&65535;else if(w&16){C=k&65535,w&=15,w&&(f<w&&(d+=V[r++]<<f,f+=8),C+=d&(1<<w)-1,d>>>=w,f-=w),f<15&&(d+=V[r++]<<f,f+=8,d+=V[r++]<<f,f+=8),k=_[d&A];i:for(;;){if(w=k>>>24,d>>>=w,f-=w,w=k>>>16&255,w&16){if(U=k&65535,w&=15,f<w&&(d+=V[r++]<<f,f+=8,f<w&&(d+=V[r++]<<f,f+=8)),U+=d&(1<<w)-1,U>l){e.msg="invalid distance too far back",W.mode=sa;break e}if(d>>>=w,f-=w,w=a-s,U>w){if(w=U-w,w>u&&W.sane){e.msg="invalid distance too far back",W.mode=sa;break e}if(P=0,Q=y,m===0){if(P+=c-w,w<C){C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}}else if(m<w){if(P+=c+m-w,w-=m,w<C){C-=w;do R[a++]=y[P++];while(--w);if(P=0,m<C){w=m,C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}}}else if(P+=m-w,w<C){C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}for(;C>2;)R[a++]=Q[P++],R[a++]=Q[P++],R[a++]=Q[P++],C-=3;C&&(R[a++]=Q[P++],C>1&&(R[a++]=Q[P++]))}else{P=a-U;do R[a++]=R[P++],R[a++]=R[P++],R[a++]=R[P++],C-=3;while(C>2);C&&(R[a++]=R[P++],C>1&&(R[a++]=R[P++]))}}else if((w&64)===0){k=_[(k&65535)+(d&(1<<w)-1)];continue i}else{e.msg="invalid distance code",W.mode=sa;break e}break}}else if((w&64)===0){k=g[(k&65535)+(d&(1<<w)-1)];continue t}else if(w&32){W.mode=fh;break e}else{e.msg="invalid literal/length code",W.mode=sa;break e}break}}while(r<n&&a<o);C=f>>3,r-=C,f-=C<<3,d&=(1<<f)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),W.hold=d,W.bits=f},pr=15,Dc=852,Uc=592,Mc=0,Ms=1,Fc=2,gh=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]),mh=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]),yh=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]),vh=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]),bh=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,f=0,g=0,_=0,E=0,A=0,k,w,C,U,P,Q=null,V,R=new Uint16Array(pr+1),W=new Uint16Array(pr+1),We=null,Or,T,jn;for(c=0;c<=pr;c++)R[c]=0;for(u=0;u<r;u++)R[e[t+u]]++;for(d=l,y=pr;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<=pr;c++)if(_<<=1,_-=R[c],_<0)return-1;if(_>0&&(i===Mc||y!==1))return-1;for(W[1]=0,c=1;c<pr;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===Mc?(Q=We=s,V=20):i===Ms?(Q=gh,We=mh,V=257):(Q=yh,We=vh,V=0),A=0,u=0,c=m,P=a,f=d,g=0,C=-1,E=1<<d,U=E-1,i===Ms&&E>Dc||i===Fc&&E>Uc)return 1;for(;;){Or=c-g,s[u]+1<V?(T=0,jn=s[u]):s[u]>=V?(T=We[s[u]-V],jn=Q[s[u]-V]):(T=32+64,jn=0),k=1<<c-g,w=1<<f,m=w;do w-=k,n[P+(A>>g)+w]=Or<<24|T<<16|jn|0;while(w!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,u++,--R[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&U)!==C){for(g===0&&(g=d),P+=m,f=c-g,_=1<<f;f+g<y&&(_-=R[f+g],!(_<=0));)f++,_<<=1;if(E+=1<<f,i===Ms&&E>Dc||i===Fc&&E>Uc)return 1;C=A&U,n[C]=d<<24|f<<16|P-a|0}}return A!==0&&(n[P+A]=c-g<<24|64<<16|0),o.bits=d,0},vn=bh,wh=0,_u=1,xu=2,{Z_FINISH:jc,Z_BLOCK:Sh,Z_TREES:oa,Z_OK:Wi,Z_STREAM_END:_h,Z_NEED_DICT:xh,Z_STREAM_ERROR:pt,Z_DATA_ERROR:Eu,Z_MEM_ERROR:$u,Z_BUF_ERROR:Eh,Z_DEFLATED:Bc}=Xi,ns=16180,qc=16181,Hc=16182,zc=16183,Vc=16184,Wc=16185,Kc=16186,Qc=16187,Gc=16188,Zc=16189,qa=16190,Ut=16191,Fs=16192,Jc=16193,js=16194,Yc=16195,Xc=16196,el=16197,tl=16198,ca=16199,la=16200,il=16201,rl=16202,nl=16203,al=16204,sl=16205,Bs=16206,ol=16207,cl=16208,fe=16209,Au=16210,ku=16211,$h=852,Ah=592,kh=15,Ih=kh,ll=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Th(){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 er=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<ns||e.mode>ku?1:0},Iu=i=>{if(er(i))return pt;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=ns,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($h),e.distcode=e.distdyn=new Int32Array(Ah),e.sane=1,e.back=-1,Wi},Tu=i=>{if(er(i))return pt;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,Iu(i)},Cu=(i,e)=>{let t;if(er(i))return pt;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?pt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,Tu(i))},Lu=(i,e)=>{if(!i)return pt;let t=new Th;i.state=t,t.strm=i,t.window=null,t.mode=ns;let r=Cu(i,e);return r!==Wi&&(i.state=null),r},Ch=i=>Lu(i,Ih),ul=!0,qs,Hs,Lh=i=>{if(ul){qs=new Int32Array(512),Hs=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(vn(_u,i.lens,0,288,qs,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;vn(xu,i.lens,0,32,Hs,0,i.work,{bits:5}),ul=!1}i.lencode=qs,i.lenbits=9,i.distcode=Hs,i.distbits=5},Pu=(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,f,g,_=0,E,A,k,w,C,U,P,Q,V=new Uint8Array(4),R,W,We=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(er(i)||!i.output||!i.input&&i.avail_in!==0)return pt;t=i.state,t.mode===Ut&&(t.mode=Fs),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=Wi;e:for(;;)switch(t.mode){case ns:if(t.wrap===0){t.mode=Fs;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=ke(t.check,V,2,0),c=0,u=0,t.mode=qc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=fe;break}if((c&15)!==Bc){i.msg="unknown compression method",t.mode=fe;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=fe;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Zc:Ut,c=0,u=0;break;case qc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==Bc){i.msg="unknown compression method",t.mode=fe;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=fe;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=ke(t.check,V,2,0)),c=0,u=0,t.mode=Hc;case Hc: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=ke(t.check,V,4,0)),c=0,u=0,t.mode=zc;case zc: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=ke(t.check,V,2,0)),c=0,u=0,t.mode=Vc;case Vc: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=ke(t.check,V,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Wc;case Wc: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=ke(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Kc;case Kc: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=ke(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Qc;case Qc: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=ke(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.comment=null);t.mode=Gc;case Gc: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=fe;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=Ut;break;case Zc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=ll(c),c=0,u=0,t.mode=qa;case qa: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,xh;i.adler=t.check=1,t.mode=Ut;case Ut:if(e===Sh||e===oa)break e;case Fs:if(t.last){c>>>=u&7,u-=u&7,t.mode=Bs;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=Jc;break;case 1:if(Lh(t),t.mode=ca,e===oa){c>>>=2,u-=2;break e}break;case 2:t.mode=Xc;break;case 3:i.msg="invalid block type",t.mode=fe}c>>>=2,u-=2;break;case Jc: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=fe;break}if(t.length=c&65535,c=0,u=0,t.mode=js,e===oa)break e;case js:t.mode=Yc;case Yc: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=Ut;break;case Xc: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=fe;break}t.have=0,t.mode=el;case el:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[We[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[We[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},Q=vn(wh,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,Q){i.msg="invalid code lengths set",t.mode=fe;break}t.have=0,t.mode=tl;case tl:for(;t.have<t.nlen+t.ndist;){for(;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,k=_&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=fe;break}P=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,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=fe;break}for(;d--;)t.lens[t.have++]=P}}if(t.mode===fe)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=fe;break}if(t.lenbits=9,R={bits:t.lenbits},Q=vn(_u,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,Q){i.msg="invalid literal/lengths set",t.mode=fe;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},Q=vn(xu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,Q){i.msg="invalid distances set",t.mode=fe;break}if(t.mode=ca,e===oa)break e;case ca:t.mode=la;case la: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,hh(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===Ut&&(t.back=-1);break}for(t.back=0;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,k=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(w=E,C=A,U=k;_=t.lencode[U+((c&(1<<w+C)-1)>>w)],E=_>>>24,A=_>>>16&255,k=_&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=k,A===0){t.mode=sl;break}if(A&32){t.back=-1,t.mode=Ut;break}if(A&64){i.msg="invalid literal/length code",t.mode=fe;break}t.extra=A&15,t.mode=il;case il: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=rl;case rl:for(;_=t.distcode[c&(1<<t.distbits)-1],E=_>>>24,A=_>>>16&255,k=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(w=E,C=A,U=k;_=t.distcode[U+((c&(1<<w+C)-1)>>w)],E=_>>>24,A=_>>>16&255,k=_&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=fe;break}t.offset=k,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.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=fe;break}t.mode=al;case al: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=fe;break}d>t.wnext?(d-=t.wnext,f=t.wsize-d):f=t.wnext-d,d>t.length&&(d=t.length),g=t.window}else g=n,f=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=g[f++];while(--d);t.length===0&&(t.mode=la);break;case sl:if(l===0)break e;n[s++]=t.length,l--,t.mode=la;break;case Bs: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?ke(t.check,n,y,s-y):In(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:ll(c))!==t.check){i.msg="incorrect data check",t.mode=fe;break}c=0,u=0}t.mode=ol;case ol: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=fe;break}c=0,u=0}t.mode=cl;case cl:Q=_h;break e;case fe:Q=Eu;break e;case Au:return $u;case ku:default:return pt}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<fe&&(t.mode<Bs||e!==jc))&&Pu(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?ke(t.check,n,y,i.next_out-y):In(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Ut?128:0)+(t.mode===ca||t.mode===js?256:0),(m===0&&y===0||e===jc)&&Q===Wi&&(Q=Eh),Q},Rh=i=>{if(er(i))return pt;let e=i.state;return e.window&&(e.window=null),i.state=null,Wi},Nh=(i,e)=>{if(er(i))return pt;let t=i.state;return(t.wrap&2)===0?pt:(t.head=e,e.done=!1,Wi)},Oh=(i,e)=>{let t=e.length,r,n,a;return er(i)||(r=i.state,r.wrap!==0&&r.mode!==qa)?pt:r.mode===qa&&(n=1,n=In(n,e,t,0),n!==r.check)?Eu:(a=Pu(i,e,t,t),a?(r.mode=Au,$u):(r.havedict=1,Wi))},Dh=Tu,Uh=Cu,Mh=Iu,Fh=Ch,jh=Lu,Bh=Ph,qh=Rh,Hh=Nh,zh=Oh,Vh="pako inflate (from Nodeca project)",qt={inflateReset:Dh,inflateReset2:Uh,inflateResetKeep:Mh,inflateInit:Fh,inflateInit2:jh,inflate:Bh,inflateEnd:qh,inflateGetHeader:Hh,inflateSetDictionary:zh,inflateInfo:Vh};function Wh(){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=Wh,Ru=Object.prototype.toString,{Z_NO_FLUSH:Qh,Z_FINISH:Gh,Z_OK:Ln,Z_STREAM_END:zs,Z_NEED_DICT:Vs,Z_STREAM_ERROR:Zh,Z_DATA_ERROR:dl,Z_MEM_ERROR:Jh}=Xi;function Mn(i){this.options=rs.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 wu,this.strm.avail_out=0;let t=qt.inflateInit2(this.strm,e.windowBits);if(t!==Ln)throw new Error(zi[t]);if(this.header=new Kh,qt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Cn.string2buf(e.dictionary):Ru.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=qt.inflateSetDictionary(this.strm,e.dictionary),t!==Ln)))throw new Error(zi[t])}Mn.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?Gh:Qh,Ru.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=qt.inflate(t,s),a===Vs&&n&&(a=qt.inflateSetDictionary(t,n),a===Ln?a=qt.inflate(t,s):a===dl&&(a=Vs));t.avail_in>0&&a===zs&&t.state.wrap>0&&i[t.next_in]!==0;)qt.inflateReset(t),a=qt.inflate(t,s);switch(a){case Zh:case dl:case Vs:case Jh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===zs))if(this.options.to==="string"){let l=Cn.utf8border(t.output,t.next_out),c=t.next_out-l,u=Cn.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===Ln&&o===0)){if(a===zs)return a=qt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Mn.prototype.onData=function(i){this.chunks.push(i)};Mn.prototype.onEnd=function(i){i===Ln&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=rs.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function To(i,e){let t=new Mn(e);if(t.push(i),t.err)throw t.msg||zi[t.err];return t.result}function Yh(i,e){return e=e||{},e.raw=!0,To(i,e)}var Xh=Mn,eg=To,tg=Yh,ig=To,rg=Xi,ng={Inflate:Xh,inflate:eg,inflateRaw:tg,ungzip:ig,constants:rg},{Deflate:ag,deflate:sg,deflateRaw:og,gzip:cg}=ph,{Inflate:lg,inflate:ug,inflateRaw:dg,ungzip:pg}=ng,fg=ag,hg=sg,gg=og,mg=cg,yg=lg,vg=ug,bg=dg,wg=pg,Sg=Xi,_g={Deflate:fg,deflate:hg,deflateRaw:gg,gzip:mg,Inflate:yg,inflate:vg,inflateRaw:bg,ungzip:wg,constants:Sg},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)},Ha=class{constructor(e,t){this.input=e,this.output=t}};ue([h(),de("design:type",String)],Ha.prototype,"input",void 0);ue([h(),de("design:type",String)],Ha.prototype,"output",void 0);Ha=ue([Te(),de("design:paramtypes",[String,String])],Ha);var za=class{constructor(e,t){this.input=e,this.output=t}};ue([h(),de("design:type",String)],za.prototype,"input",void 0);ue([h(),de("design:type",String)],za.prototype,"output",void 0);za=ue([H(),de("design:paramtypes",[String,String])],za);var li=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ue([h(),de("design:type",String)],li.prototype,"name",void 0);ue([h(),de("design:type",String)],li.prototype,"modelId",void 0);ue([h(),de("design:type",String)],li.prototype,"systemPrompt",void 0);ue([h(),de("design:type",Array)],li.prototype,"promptExamples",void 0);ue([h(),de("design:type",String)],li.prototype,"metaData",void 0);li=ue([Te(),de("design:paramtypes",[String,String,String,Array,String])],li);var Nt=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([h(),de("design:type",String)],Nt.prototype,"name",void 0);ue([h(),de("design:type",String)],Nt.prototype,"modelId",void 0);ue([h(),de("design:type",String)],Nt.prototype,"taskId",void 0);ue([h(),de("design:type",String)],Nt.prototype,"systemPrompt",void 0);ue([h(),de("design:type",Array)],Nt.prototype,"promptExamples",void 0);ue([h(),de("design:type",String)],Nt.prototype,"metaData",void 0);ue([h(),de("design:type",String)],Nt.prototype,"createdAt",void 0);ue([h(),de("design:type",String)],Nt.prototype,"updatedAt",void 0);Nt=ue([H(),de("design:paramtypes",[String,String,String,String,Array,String,String,String])],Nt);var Ki=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ue([h(),de("design:type",String)],Ki.prototype,"model",void 0);ue([h(),de("design:type",String)],Ki.prototype,"status",void 0);ue([h(),de("design:type",Number)],Ki.prototype,"progress",void 0);ue([h(),de("design:type",Boolean)],Ki.prototype,"downloaded",void 0);ue([h(),de("design:type",Boolean)],Ki.prototype,"loaded",void 0);Ki=ue([H(),de("design:paramtypes",[String,String,Number,Boolean,Boolean])],Ki);var xg=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},$e=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,Ea,go=class{constructor(e,t=!0){_e.set(this,void 0),Ea.set(this,new Map),xg(this,_e,e,"f")}async getModels(){let e=await $e(this,_e,"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`
|
|
1203
1258
|
query {
|
|
1204
1259
|
aiGetModels {
|
|
1205
1260
|
id
|
|
@@ -1223,23 +1278,23 @@ triggerMatch
|
|
|
1223
1278
|
modelType
|
|
1224
1279
|
}
|
|
1225
1280
|
}
|
|
1226
|
-
`});return b(e).aiGetModels}async addModel(e){let t=await
|
|
1281
|
+
`});return b(e).aiGetModels}async addModel(e){let t=await Ae(this,_e,"f").mutate({mutation:v`
|
|
1227
1282
|
mutation($model: ModelInput!) {
|
|
1228
1283
|
aiAddModel(model: $model)
|
|
1229
1284
|
}
|
|
1230
|
-
`,variables:{model:e}});return b(t).aiAddModel}async updateModel(e,t){let r=await
|
|
1285
|
+
`,variables:{model:e}});return b(t).aiAddModel}async updateModel(e,t){let r=await Ae(this,_e,"f").mutate({mutation:v`
|
|
1231
1286
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
1232
1287
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
1233
1288
|
}
|
|
1234
|
-
`,variables:{modelId:e,model:t}});return b(r).aiUpdateModel}async removeModel(e){let t=await
|
|
1289
|
+
`,variables:{modelId:e,model:t}});return b(r).aiUpdateModel}async removeModel(e){let t=await Ae(this,_e,"f").mutate({mutation:v`
|
|
1235
1290
|
mutation($modelId: String!) {
|
|
1236
1291
|
aiRemoveModel(modelId: $modelId)
|
|
1237
1292
|
}
|
|
1238
|
-
`,variables:{modelId:e}});return b(t).aiRemoveModel}async setDefaultModel(e,t){let r=await
|
|
1293
|
+
`,variables:{modelId:e}});return b(t).aiRemoveModel}async setDefaultModel(e,t){let r=await Ae(this,_e,"f").mutate({mutation:v`
|
|
1239
1294
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
1240
1295
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
1241
1296
|
}
|
|
1242
|
-
`,variables:{modelId:t,modelType:e}});return b(r).aiSetDefaultModel}async getDefaultModel(e){let t=await
|
|
1297
|
+
`,variables:{modelId:t,modelType:e}});return b(r).aiSetDefaultModel}async getDefaultModel(e){let t=await Ae(this,_e,"f").query({query:v`
|
|
1243
1298
|
query($modelType: ModelType!) {
|
|
1244
1299
|
aiGetDefaultModel(modelType: $modelType) {
|
|
1245
1300
|
id
|
|
@@ -1263,7 +1318,7 @@ triggerMatch
|
|
|
1263
1318
|
modelType
|
|
1264
1319
|
}
|
|
1265
1320
|
}
|
|
1266
|
-
`,variables:{modelType:e}});return b(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=b(await
|
|
1321
|
+
`,variables:{modelType:e}});return b(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=b(await Ae(this,_e,"f").query({query:v`
|
|
1267
1322
|
query {
|
|
1268
1323
|
aiTasks {
|
|
1269
1324
|
name
|
|
@@ -1279,7 +1334,7 @@ triggerMatch
|
|
|
1279
1334
|
updatedAt
|
|
1280
1335
|
}
|
|
1281
1336
|
}
|
|
1282
|
-
`}));return e}async addTask(e,t,r,n,a){let s=new
|
|
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`
|
|
1283
1338
|
mutation AiAddTask($task: AITaskInput!) {
|
|
1284
1339
|
aiAddTask(task: $task) {
|
|
1285
1340
|
name
|
|
@@ -1295,7 +1350,7 @@ triggerMatch
|
|
|
1295
1350
|
updatedAt
|
|
1296
1351
|
}
|
|
1297
1352
|
}
|
|
1298
|
-
`,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=b(await
|
|
1353
|
+
`,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=b(await Ae(this,_e,"f").mutate({mutation:v`
|
|
1299
1354
|
mutation AiRemoveTask($taskId: String!) {
|
|
1300
1355
|
aiRemoveTask(taskId: $taskId) {
|
|
1301
1356
|
name
|
|
@@ -1311,7 +1366,7 @@ triggerMatch
|
|
|
1311
1366
|
updatedAt
|
|
1312
1367
|
}
|
|
1313
1368
|
}
|
|
1314
|
-
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=b(await
|
|
1369
|
+
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
|
|
1315
1370
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
1316
1371
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
1317
1372
|
name
|
|
@@ -1327,7 +1382,7 @@ triggerMatch
|
|
|
1327
1382
|
updatedAt
|
|
1328
1383
|
}
|
|
1329
1384
|
}
|
|
1330
|
-
`,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
|
|
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`
|
|
1331
1386
|
query AiModelLoadingStatus($model: String!) {
|
|
1332
1387
|
aiModelLoadingStatus(model: $model) {
|
|
1333
1388
|
model
|
|
@@ -1337,30 +1392,30 @@ triggerMatch
|
|
|
1337
1392
|
downloaded
|
|
1338
1393
|
}
|
|
1339
1394
|
}
|
|
1340
|
-
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=b(await
|
|
1395
|
+
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
|
|
1341
1396
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
1342
1397
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
1343
1398
|
}
|
|
1344
|
-
`,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=b(await
|
|
1399
|
+
`,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=b(await Ae(this,_e,"f").mutate({mutation:v`
|
|
1345
1400
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
1346
1401
|
aiEmbed(modelId: $modelId, text: $text)
|
|
1347
1402
|
}
|
|
1348
|
-
`,variables:{modelId:e,text:t}})),n=
|
|
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`
|
|
1349
1404
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
1350
1405
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
1351
1406
|
}
|
|
1352
|
-
`,variables:{modelId:e,params:r}})),a
|
|
1407
|
+
`,variables:{modelId:e,params:r}})),a=Ae(this,_e,"f").subscribe({query:v` subscription {
|
|
1353
1408
|
aiTranscriptionText(streamId: "${n}")
|
|
1354
|
-
}`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return
|
|
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`
|
|
1355
1410
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
1356
1411
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
1357
1412
|
}
|
|
1358
|
-
`,variables:{streamId:e}})),r
|
|
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`
|
|
1359
1414
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
1360
1415
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
1361
1416
|
}
|
|
1362
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};_e=new WeakMap,
|
|
1363
|
-
${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
|
|
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`
|
|
1364
1419
|
findall(
|
|
1365
1420
|
[T, A],
|
|
1366
1421
|
link(Base, _, _, T, A),
|
|
@@ -1368,18 +1423,18 @@ ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurre
|
|
|
1368
1423
|
),
|
|
1369
1424
|
sort(AllLinks, SortedLinks),
|
|
1370
1425
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1371
|
-
`}function
|
|
1426
|
+
`}function kg(i){return`
|
|
1372
1427
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1373
1428
|
% Constrain to specified properties if provided
|
|
1374
1429
|
${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1375
1430
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1376
1431
|
), Properties)
|
|
1377
|
-
`}function
|
|
1378
|
-
`)}function
|
|
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:
|
|
1379
1434
|
- options.namespace
|
|
1380
1435
|
- schema["x-ad4m"].namespace
|
|
1381
1436
|
- schema.title
|
|
1382
|
-
- valid schema.$id`)}function
|
|
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"),`
|
|
1383
1438
|
SELECT
|
|
1384
1439
|
id AS source,
|
|
1385
1440
|
uri AS source_uri,
|
|
@@ -1387,33 +1442,33 @@ SELECT
|
|
|
1387
1442
|
FROM node
|
|
1388
1443
|
WHERE ${o.join(" AND ")}
|
|
1389
1444
|
FETCH links
|
|
1390
|
-
`.trim()}var bo=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 da(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function Tl(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 Lg(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 Cl(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[f,g]of Object.entries(t.properties))g.getter||l&&!l.has(f)||c.set(g.predicate,[f,g]);let u=new Map,m=[];for(let[f,g]of Object.entries(t.relations))if(!g.getter){if(g.target&&g.filter!==!1){m.push([f,g]);continue}u.set(g.predicate,[f,g])}for(let[f,g]of m)u.has(g.predicate)||u.set(g.predicate,[f,g]);let y=new Map,d=new Map;for(let f=0;f<e.length;f++){let g=e[f],{predicate:_,target:E,author:A,timestamp:k}=g;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 w=c.get(_);if(w){y.get(w[0]),y.set(w[0],{target:E,timestamp:k});continue}let C=u.get(_);if(C){let[U]=C,P=d.get(U);P||(P=[],d.set(U,P)),P.push({target:E,timestamp:k??"",index:f})}}for(let[f,{target:g}]of y){let[,_]=c.get(t.properties[f].predicate),E=typeof i[f];i[f]=await Lg(g,_,r,E!=="undefined"?E:void 0)}for(let[f,g]of d)g.sort((_,E)=>{let A=String(_.timestamp).localeCompare(String(E.timestamp));return A!==0?A:_.index-E.index}),i[f]=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 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,f=>f.codePointAt(0)),y=m.every(f=>f<=255),d=m.some(f=>f>=128);if(y&&d)try{let f=Uint8Array.from(m),g=new TextDecoder("utf-8",{fatal:!0}).decode(f);g!==s&&(l=g)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:f})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Hi(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 Rg(i,e){let t=Gl(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 Ll(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=Ql(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=Rg(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 f=d[0].value;i[o]=Array.isArray(f)?f.filter(g=>g!=null&&g!==""&&g!=="None"):f}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function bn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=$t(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 ae({predicate:o.predicate,target:E.id}))).filter(w=>w.data.target===E.id).map(w=>w.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let w=k[k.length-1];try{let C=new l(t,w);await C.get(),E[a]=C}catch{E[a]=null}}else{let w=[];if(c&&(c.where||c.order||c.properties)){let C={id:k,...c.where??{}};w=await l.findAll(t,{where:C,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(k.map(async C=>{try{let U=new l(t,C);await U.get(c?.properties?{properties:c.properties}:void 0),w.push(U)}catch{}}));if(c?.order&&!(c.where||c.properties)){let C=Object.entries(c.order);w=w.sort((U,P)=>{for(let[Q,V]of C){let R=String(U[Q]??""),W=String(P[Q]??""),We=R.localeCompare(W);if(We!==0)return V==="DESC"?-We:We}return 0})}if(c?.offset!=null||c?.limit!=null){let C=c.offset??0,U=c.limit!=null?C+c.limit:void 0;w=w.slice(C,U)}E[a]=w,u&&w.length>0&&await bn(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 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,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 k=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);k=k.sort((C,U)=>{for(let[P,Q]of w){let V=String(C[P]??""),R=String(U[P]??""),W=V.localeCompare(R);if(W!==0)return Q==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let w=c.offset??0,C=c.limit!=null?w+c.limit:void 0;k=k.slice(w,C)}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 bn(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=Hi(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=$t(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,f]of Object.entries(m.properties)){let g=Du(f),_=Mu(m,d,f,Uu(m,y),y);if(g)a[d]={name:d,predicate:_,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:_,required:E,readOnly:f["x-ad4m"]?.writable===!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||le.from(Wl(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 Hi(t)[e]}getRelationOptions(e){let t=this.constructor;return $t(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]=da(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=da(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]=da(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=da(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=`
|
|
1391
1446
|
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1392
1447
|
FROM link
|
|
1393
1448
|
WHERE in.uri = ${ce(this._baseExpression)}
|
|
1394
1449
|
ORDER BY timestamp ASC
|
|
1395
|
-
`,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await
|
|
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`
|
|
1396
1451
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1397
1452
|
subject_class("${u}", SubjectClass),
|
|
1398
1453
|
instance(SubjectClass, Base),
|
|
1399
1454
|
${y.filter(g=>g).join(", ")}
|
|
1400
1455
|
), UnsortedInstances),
|
|
1401
1456
|
${d.filter(g=>g).join(", ")}
|
|
1402
|
-
`}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n
|
|
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`
|
|
1403
1458
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1404
1459
|
subject_class("${a}", SubjectClass),
|
|
1405
1460
|
instance(SubjectClass, Base),
|
|
1406
1461
|
${o.filter(u=>u).join(", ")}
|
|
1407
1462
|
), UnsortedInstances),
|
|
1408
1463
|
${l.filter(u=>u).join(", ")}
|
|
1409
|
-
`}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=
|
|
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(`,
|
|
1410
1465
|
`);return`${i}(X) :-
|
|
1411
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(`,
|
|
1412
1467
|
`);return`${i}(X) :-
|
|
1413
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(` ;
|
|
1414
1469
|
`);return`${i}(X) :-
|
|
1415
|
-
(${s}).`}return null}function
|
|
1416
|
-
`)}var
|
|
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=`
|
|
1417
1472
|
type AIModelLoadingStatus {
|
|
1418
1473
|
downloaded: Boolean!
|
|
1419
1474
|
loaded: Boolean!
|
|
@@ -1800,6 +1855,7 @@ type Mutation {
|
|
|
1800
1855
|
runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
|
|
1801
1856
|
runtimeRestartHolochain: Boolean!
|
|
1802
1857
|
runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
|
|
1858
|
+
runtimeSetFreeHostingEnabled(enabled: Boolean!): Boolean!
|
|
1803
1859
|
runtimeSetHotWalletAddress(address: String!): Boolean!
|
|
1804
1860
|
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
1805
1861
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
@@ -1914,6 +1970,7 @@ type Query {
|
|
|
1914
1970
|
perspectiveQuerySurrealDB(query: String!, uuid: String!): String!
|
|
1915
1971
|
perspectiveSnapshot(uuid: String!): Perspective
|
|
1916
1972
|
perspectives: [PerspectiveHandle!]!
|
|
1973
|
+
runtimeFreeHostingEnabled: Boolean!
|
|
1917
1974
|
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
1918
1975
|
runtimeFriends: [String!]!
|
|
1919
1976
|
runtimeGetNetworkMetrics: String!
|
|
@@ -1929,6 +1986,7 @@ type Query {
|
|
|
1929
1986
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
1930
1987
|
runtimeMultiUserEnabled: Boolean!
|
|
1931
1988
|
runtimeNotifications: [Notification!]!
|
|
1989
|
+
runtimeUnytAgentKey: String!
|
|
1932
1990
|
runtimeUnytVersionInfo: String!
|
|
1933
1991
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
1934
1992
|
}
|
|
@@ -2026,26 +2084,22 @@ input VoiceActivityParamsInput {
|
|
|
2026
2084
|
startWindow: Float
|
|
2027
2085
|
timeBeforeSpeech: Float
|
|
2028
2086
|
}
|
|
2029
|
-
`,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)},j=function(i,e){return function(t,r){e(t,r,i)}},Fn=new si;Fn.author="did:ad4m:test";Fn.timestamp=Date.now();Fn.data={source:"root",target:"neighbourhood://Qm12345"};Fn.proof={signature:"",key:"",valid:!0};var ei=new Bi;ei.author="did:ad4m:test";ei.timestamp=Date.now().toString();ei.proof=new Ht("","");ei.data=new Pt([Fn]);var Za=class{};S([h(),p("design:type",String)],Za.prototype,"recipient",void 0);S([h(),p("design:type",Bi)],Za.prototype,"message",void 0);Za=S([H()],Za);var Ar=class{};S([h(),p("design:type",String)],Ar.prototype,"ad4mExecutorVersion",void 0);S([h(),p("design:type",Boolean)],Ar.prototype,"isInitialized",void 0);S([h(),p("design:type",Boolean)],Ar.prototype,"isUnlocked",void 0);Ar=S([H()],Ar);var Qi=class{};S([h(),p("design:type",String)],Qi.prototype,"title",void 0);S([h(),p("design:type",String)],Qi.prototype,"message",void 0);S([h(),p("design:type",String)],Qi.prototype,"type",void 0);S([h(),p("design:type",String)],Qi.prototype,"addon",void 0);Qi=S([H()],Qi);var ft=class{};S([h(),p("design:type",String)],ft.prototype,"description",void 0);S([h(),p("design:type",String)],ft.prototype,"appName",void 0);S([h(),p("design:type",String)],ft.prototype,"appUrl",void 0);S([h(),p("design:type",String)],ft.prototype,"appIconPath",void 0);S([h(),p("design:type",String)],ft.prototype,"trigger",void 0);S([h(),p("design:type",Array)],ft.prototype,"perspectiveIds",void 0);S([h(),p("design:type",String)],ft.prototype,"webhookUrl",void 0);S([h(),p("design:type",String)],ft.prototype,"webhookAuth",void 0);ft=S([Te()],ft);var nt=class{};S([h(),p("design:type",String)],nt.prototype,"id",void 0);S([h(),p("design:type",Boolean)],nt.prototype,"granted",void 0);S([h(),p("design:type",String)],nt.prototype,"description",void 0);S([h(),p("design:type",String)],nt.prototype,"appName",void 0);S([h(),p("design:type",String)],nt.prototype,"appUrl",void 0);S([h(),p("design:type",String)],nt.prototype,"appIconPath",void 0);S([h(),p("design:type",String)],nt.prototype,"trigger",void 0);S([h(),p("design:type",Array)],nt.prototype,"perspectiveIds",void 0);S([h(),p("design:type",String)],nt.prototype,"webhookUrl",void 0);S([h(),p("design:type",String)],nt.prototype,"webhookAuth",void 0);nt=S([H()],nt);var kr=class{};S([h(),p("design:type",nt)],kr.prototype,"notification",void 0);S([h(),p("design:type",String)],kr.prototype,"perspectiveId",void 0);S([h(),p("design:type",String)],kr.prototype,"triggerMatch",void 0);kr=S([H()],kr);var Ie=class{};S([h(),p("design:type",Number)],Ie.prototype,"total",void 0);S([h(),p("design:type",Number)],Ie.prototype,"imported",void 0);S([h(),p("design:type",Number)],Ie.prototype,"failed",void 0);S([h(),p("design:type",Number)],Ie.prototype,"omitted",void 0);S([h(),p("design:type",Array)],Ie.prototype,"errors",void 0);Ie=S([H()],Ie);var at=class{};S([h(),p("design:type",Ie)],at.prototype,"perspectives",void 0);S([h(),p("design:type",Ie)],at.prototype,"links",void 0);S([h(),p("design:type",Ie)],at.prototype,"expressions",void 0);S([h(),p("design:type",Ie)],at.prototype,"perspectiveDiffs",void 0);S([h(),p("design:type",Ie)],at.prototype,"notifications",void 0);S([h(),p("design:type",Ie)],at.prototype,"models",void 0);S([h(),p("design:type",Ie)],at.prototype,"defaultModels",void 0);S([h(),p("design:type",Ie)],at.prototype,"tasks",void 0);S([h(),p("design:type",Ie)],at.prototype,"friends",void 0);S([h(),p("design:type",Ie)],at.prototype,"trustedAgents",void 0);S([h(),p("design:type",Ie)],at.prototype,"knownLinkLanguages",void 0);at=S([H()],at);var Vt=class{};S([h(),p("design:type",String)],Vt.prototype,"email",void 0);S([h(),p("design:type",String)],Vt.prototype,"did",void 0);S([h(),p("design:type",String)],Vt.prototype,"lastSeen",void 0);S([h(),p("design:type",Number)],Vt.prototype,"perspectiveCount",void 0);S([h(),p("design:type",String)],Vt.prototype,"remainingCredits",void 0);S([h(),p("design:type",Boolean)],Vt.prototype,"freeAccess",void 0);S([h(),p("design:type",String)],Vt.prototype,"hotWalletAddress",void 0);Vt=S([H()],Vt);var Gi=class{};S([h(),p("design:type",Boolean)],Gi.prototype,"success",void 0);S([h(),p("design:type",String)],Gi.prototype,"message",void 0);S([h(),p("design:type",Boolean)],Gi.prototype,"requiresPassword",void 0);S([h(),p("design:type",Boolean)],Gi.prototype,"isExistingUser",void 0);Gi=S([H()],Gi);var pi=class{constructor(e,t,r,n=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r,this.freeAccess=n}};S([h(),p("design:type",String)],pi.prototype,"email",void 0);S([h(),p("design:type",String)],pi.prototype,"remainingCredits",void 0);S([h(),p("design:type",String)],pi.prototype,"hotWalletAddress",void 0);S([h(),p("design:type",Boolean)],pi.prototype,"freeAccess",void 0);pi=S([H(),p("design:paramtypes",[String,String,String,Boolean])],pi);var dt=class{constructor(e,t){this.success=e,this.message=t}};S([h(),p("design:type",Boolean)],dt.prototype,"success",void 0);S([h(),p("design:type",String)],dt.prototype,"message",void 0);dt=S([H(),p("design:paramtypes",[Boolean,String])],dt);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 ei}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[ei]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:ei}]}runtimeMessageReceived(){return ei}exceptionOccurred(){return{title:"Test title",message:"Test message",type:mo.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,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 qi("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 pi("test@example.com","100000000",null,!1)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new dt(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new dt(!0,"")}runtimeSendHot(e,t){return new dt(!0,"")}runtimeSetUnytMembraneProof(e){return new dt(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytVersionInfo(){return""}};S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeQuit",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeOpenLink",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Ar)],O.prototype,"runtimeInfo",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"addTrustedAgents",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"deleteTrustedAgents",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"getTrustedAgents",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeKnownLinkLanguageTemplates",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddKnownLinkLanguageTemplates",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeFriends",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddFriends",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveFriends",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHcAgentInfos",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeGetNetworkMetrics",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeRestartHolochain",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",Boolean)],O.prototype,"runtimeHcAddAgentInfos",null);S([Ce(),j(0,F()),j(1,F()),j(2,F()),j(3,F()),p("design:type",Function),p("design:paramtypes",[String,String,String,String]),p("design:returntype",void 0)],O.prototype,"runtimeVerifyStringSignedByDid",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Pt]),p("design:returntype",Boolean)],O.prototype,"runtimeSetStatus",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Bi)],O.prototype,"runtimeFriendStatus",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Na]),p("design:returntype",Boolean)],O.prototype,"runtimeFriendSendMessage",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageInbox",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageOutbox",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Bi)],O.prototype,"runtimeMessageReceived",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Qi)],O.prototype,"exceptionOccurred",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[ft]),p("design:returntype",String)],O.prototype,"runtimeRequestInstallNotification",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeNotifications",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,ft]),p("design:returntype",Boolean)],O.prototype,"runtimeUpdateNotification",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeRemoveNotification",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeGrantNotification",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",kr)],O.prototype,"runtimeNotificationTriggered",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportDb",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportDb",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportPerspective",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportPerspective",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeMultiUserEnabled",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetMultiUserEnabled",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeListUsers",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Rt]),p("design:returntype",Gi)],O.prototype,"runtimeRequestLoginVerification",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,String]),p("design:returntype",String)],O.prototype,"runtimeVerifyEmailCode",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeTestEmail",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,Rt]),p("design:returntype",qi)],O.prototype,"runtimeCreateUser",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",String)],O.prototype,"runtimeLoginUser",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeEnable",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeDisable",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",String)],O.prototype,"runtimeEmailTestGetCode",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestClearCodes",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestSetExpiry",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",pi)],O.prototype,"runtimeHostingUserInfo",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeSetHotWalletAddress",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",dt)],O.prototype,"runtimeRequestPayment",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserCredits",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserFreeAccess",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",dt)],O.prototype,"runtimeReinstallUnytDna",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",dt)],O.prototype,"runtimeSendHot",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",dt)],O.prototype,"runtimeSetUnytMembraneProof",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotWalletBalance",null);S([Ce(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[Number,Number]),p("design:returntype",String)],O.prototype,"runtimeHotWalletHistory",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotAgentPubkey",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeUnytVersionInfo",null);O=S([Xd()],O);var bt=class extends ge{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 I`
|
|
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`
|
|
2030
2088
|
<div class="container">
|
|
2031
|
-
<div class="back-button" @click=${this.back}>
|
|
2032
|
-
${wt()}
|
|
2033
|
-
</div>
|
|
2034
|
-
|
|
2035
2089
|
<div class="header">
|
|
2036
2090
|
<h1>${this.appname}</h1>
|
|
2037
2091
|
<h3>wants to access your AD4M data</h3>
|
|
2038
2092
|
</div>
|
|
2039
2093
|
|
|
2040
2094
|
<div class="connection-icons">
|
|
2041
|
-
${this.appiconpath?
|
|
2042
|
-
<div class="arrow-icon">${
|
|
2043
|
-
<div class="ad4m-logo">${
|
|
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>
|
|
2044
2098
|
</div>
|
|
2045
2099
|
|
|
2046
|
-
${this.requestSent?
|
|
2100
|
+
${this.requestSent?k`
|
|
2047
2101
|
<div class="state success" style="margin-bottom: -12px">
|
|
2048
|
-
${
|
|
2102
|
+
${Qe()}
|
|
2049
2103
|
<p>Auth request sent to local AD4M node</p>
|
|
2050
2104
|
</div>
|
|
2051
2105
|
|
|
@@ -2061,19 +2115,20 @@ input VoiceActivityParamsInput {
|
|
|
2061
2115
|
.value=${this.securityCode||""}
|
|
2062
2116
|
@input=${this.onInputChange}
|
|
2063
2117
|
/>
|
|
2118
|
+
${this.verifying?k`<div class="spinner"></div>`:""}
|
|
2064
2119
|
</div>
|
|
2065
2120
|
|
|
2066
|
-
${this.verificationError?
|
|
2121
|
+
${this.verificationError?k`
|
|
2067
2122
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2068
2123
|
${Ue()}
|
|
2069
2124
|
<p>Verification failed. Please try again.</p>
|
|
2070
2125
|
</div>
|
|
2071
2126
|
`:""}
|
|
2072
|
-
`:
|
|
2127
|
+
`:k`
|
|
2073
2128
|
<p>This will allow ${this.appname} to</p>
|
|
2074
2129
|
|
|
2075
2130
|
<ul class="box">
|
|
2076
|
-
${this.capabilities.map(t=>
|
|
2131
|
+
${this.capabilities.map(t=>k`<li>${Qe()}<p>${Gl(t)}</p></li>`)}
|
|
2077
2132
|
</ul>
|
|
2078
2133
|
|
|
2079
2134
|
<div class="row center">
|
|
@@ -2083,7 +2138,7 @@ input VoiceActivityParamsInput {
|
|
|
2083
2138
|
</div>
|
|
2084
2139
|
`}
|
|
2085
2140
|
</div>
|
|
2086
|
-
`}};
|
|
2141
|
+
`}};mt.styles=[Ge,$e`
|
|
2087
2142
|
h1 {
|
|
2088
2143
|
font-size: 34px;
|
|
2089
2144
|
}
|
|
@@ -2148,7 +2203,9 @@ input VoiceActivityParamsInput {
|
|
|
2148
2203
|
.security-code {
|
|
2149
2204
|
width: 100%;
|
|
2150
2205
|
display: flex;
|
|
2206
|
+
align-items: center;
|
|
2151
2207
|
justify-content: center;
|
|
2208
|
+
gap: 12px;
|
|
2152
2209
|
margin-bottom: 20px;
|
|
2153
2210
|
}
|
|
2154
2211
|
|
|
@@ -2165,19 +2222,15 @@ input VoiceActivityParamsInput {
|
|
|
2165
2222
|
.state {
|
|
2166
2223
|
justify-content: center;
|
|
2167
2224
|
}
|
|
2168
|
-
`],
|
|
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`
|
|
2169
2226
|
<div class="container">
|
|
2170
|
-
<div class="back-button" @click=${this.back}>
|
|
2171
|
-
${wt()}
|
|
2172
|
-
</div>
|
|
2173
|
-
|
|
2174
2227
|
<div class="header">
|
|
2175
|
-
<h1
|
|
2176
|
-
${this.host?
|
|
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>`:""}
|
|
2177
2230
|
</div>
|
|
2178
2231
|
|
|
2179
|
-
${t?
|
|
2180
|
-
<h3>Enter your email to login to ${this.host?
|
|
2232
|
+
${t?k`
|
|
2233
|
+
<h3>Enter your email to login to ${this.host?k`<strong>${this.host.name}</strong>`:"the remote node"}</h3>
|
|
2181
2234
|
|
|
2182
2235
|
<div class="input-row">
|
|
2183
2236
|
<input
|
|
@@ -2191,27 +2244,24 @@ input VoiceActivityParamsInput {
|
|
|
2191
2244
|
|
|
2192
2245
|
<div class="login-button" style="margin-top: 10px;">
|
|
2193
2246
|
<button class="primary" @click=${this.emailLogin} .disabled=${this.remoteAuthLoading||!this.isValidEmail()}>
|
|
2194
|
-
${this.remoteAuthLoading?"Loading...":"
|
|
2247
|
+
${this.remoteAuthLoading?"Loading...":"Continue"}
|
|
2195
2248
|
</button>
|
|
2196
2249
|
</div>
|
|
2197
2250
|
`:""}
|
|
2198
2251
|
|
|
2199
|
-
${s?
|
|
2252
|
+
${s?k`
|
|
2200
2253
|
<div class="state danger">
|
|
2201
2254
|
${Ue()}
|
|
2202
2255
|
<p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
|
|
2203
2256
|
</div>
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
<button class="primary" @click=${this.back}>
|
|
2207
|
-
Back
|
|
2208
|
-
</button>
|
|
2257
|
+
<div class="login-button" style="margin-top: 10px;">
|
|
2258
|
+
<button class="primary" @click=${this.tryAgain}>Try again</button>
|
|
2209
2259
|
</div>
|
|
2210
2260
|
`:""}
|
|
2211
2261
|
|
|
2212
|
-
${r?
|
|
2262
|
+
${r?k`
|
|
2213
2263
|
<div class="state success" style="margin-bottom: -12px">
|
|
2214
|
-
${
|
|
2264
|
+
${Qe()}
|
|
2215
2265
|
<p>Email verification code sent</p>
|
|
2216
2266
|
</div>
|
|
2217
2267
|
|
|
@@ -2227,9 +2277,10 @@ input VoiceActivityParamsInput {
|
|
|
2227
2277
|
.value=${this.emailSecurityCode||""}
|
|
2228
2278
|
@input=${this.onEmailSecurityCodeChange}
|
|
2229
2279
|
/>
|
|
2280
|
+
${this.remoteAuthLoading?k`<div class="spinner"></div>`:""}
|
|
2230
2281
|
</div>
|
|
2231
2282
|
|
|
2232
|
-
${this.emailCodeError?
|
|
2283
|
+
${this.emailCodeError?k`
|
|
2233
2284
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2234
2285
|
${Ue()}
|
|
2235
2286
|
<p>Verification failed. Please try again.</p>
|
|
@@ -2237,9 +2288,9 @@ input VoiceActivityParamsInput {
|
|
|
2237
2288
|
`:""}
|
|
2238
2289
|
`:""}
|
|
2239
2290
|
|
|
2240
|
-
${n?
|
|
2291
|
+
${n?k`
|
|
2241
2292
|
<div class="state success" style="margin-bottom: -12px">
|
|
2242
|
-
${
|
|
2293
|
+
${Qe()}
|
|
2243
2294
|
<p>Account found</p>
|
|
2244
2295
|
</div>
|
|
2245
2296
|
|
|
@@ -2261,7 +2312,7 @@ input VoiceActivityParamsInput {
|
|
|
2261
2312
|
</button>
|
|
2262
2313
|
</div>
|
|
2263
2314
|
|
|
2264
|
-
${this.passwordError?
|
|
2315
|
+
${this.passwordError?k`
|
|
2265
2316
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2266
2317
|
${Ue()}
|
|
2267
2318
|
<p>Incorrect password. Please try again.</p>
|
|
@@ -2269,9 +2320,9 @@ input VoiceActivityParamsInput {
|
|
|
2269
2320
|
`:""}
|
|
2270
2321
|
`:""}
|
|
2271
2322
|
|
|
2272
|
-
${a?
|
|
2323
|
+
${a?k`
|
|
2273
2324
|
<div class="state success">
|
|
2274
|
-
${
|
|
2325
|
+
${Qe()}
|
|
2275
2326
|
<p>Creating a new account for <strong>${this.email}</strong></p>
|
|
2276
2327
|
</div>
|
|
2277
2328
|
|
|
@@ -2296,7 +2347,7 @@ input VoiceActivityParamsInput {
|
|
|
2296
2347
|
/>
|
|
2297
2348
|
</div>
|
|
2298
2349
|
|
|
2299
|
-
${this.confirmPassword.length>0&&!this.passwordsMatch?
|
|
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>`:""}
|
|
2300
2351
|
|
|
2301
2352
|
<div class="login-button">
|
|
2302
2353
|
<button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.passwordsMatch}>
|
|
@@ -2304,7 +2355,7 @@ input VoiceActivityParamsInput {
|
|
|
2304
2355
|
</button>
|
|
2305
2356
|
</div>
|
|
2306
2357
|
|
|
2307
|
-
${this.accountCreationError?
|
|
2358
|
+
${this.accountCreationError?k`
|
|
2308
2359
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2309
2360
|
${Ue()}
|
|
2310
2361
|
<p>Failed to create account. Please try again.</p>
|
|
@@ -2313,7 +2364,7 @@ input VoiceActivityParamsInput {
|
|
|
2313
2364
|
`:""}
|
|
2314
2365
|
|
|
2315
2366
|
</div>
|
|
2316
|
-
`}};Ve.styles=[
|
|
2367
|
+
`}};Ve.styles=[Ge,$e`
|
|
2317
2368
|
.header h1 {
|
|
2318
2369
|
font-size: 32px;
|
|
2319
2370
|
margin-bottom: 0;
|
|
@@ -2336,7 +2387,9 @@ input VoiceActivityParamsInput {
|
|
|
2336
2387
|
.security-code {
|
|
2337
2388
|
width: 100%;
|
|
2338
2389
|
display: flex;
|
|
2390
|
+
align-items: center;
|
|
2339
2391
|
justify-content: center;
|
|
2392
|
+
gap: 12px;
|
|
2340
2393
|
margin-bottom: 20px;
|
|
2341
2394
|
}
|
|
2342
2395
|
|
|
@@ -2359,7 +2412,7 @@ input VoiceActivityParamsInput {
|
|
|
2359
2412
|
.state {
|
|
2360
2413
|
justify-content: center;
|
|
2361
2414
|
}
|
|
2362
|
-
`],
|
|
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`
|
|
2363
2416
|
<div class="container">
|
|
2364
2417
|
<div class="close-button" @click=${this.close}>
|
|
2365
2418
|
${Ue()}
|
|
@@ -2372,11 +2425,11 @@ input VoiceActivityParamsInput {
|
|
|
2372
2425
|
|
|
2373
2426
|
<div class="box">
|
|
2374
2427
|
<div class="box-header">
|
|
2375
|
-
${t?
|
|
2428
|
+
${t?lr():Qn()}
|
|
2376
2429
|
<h3>${t?"Local Node":"Remote Node"}</h3>
|
|
2377
2430
|
</div>
|
|
2378
2431
|
|
|
2379
|
-
${t?
|
|
2432
|
+
${t?k`
|
|
2380
2433
|
<div class="row">
|
|
2381
2434
|
<span>Port:</span>
|
|
2382
2435
|
<span class="detail-value">${this.port}</span>
|
|
@@ -2385,7 +2438,7 @@ input VoiceActivityParamsInput {
|
|
|
2385
2438
|
<span>URL:</span>
|
|
2386
2439
|
<span class="detail-value">${this.url}</span>
|
|
2387
2440
|
</div>
|
|
2388
|
-
`:
|
|
2441
|
+
`:k`
|
|
2389
2442
|
<div class="row">
|
|
2390
2443
|
<span>URL:</span>
|
|
2391
2444
|
<span class="detail-value">${this.url}</span>
|
|
@@ -2404,7 +2457,7 @@ input VoiceActivityParamsInput {
|
|
|
2404
2457
|
</button>
|
|
2405
2458
|
</div>
|
|
2406
2459
|
</div>
|
|
2407
|
-
`}};
|
|
2460
|
+
`}};yi.styles=[Ge,$e`
|
|
2408
2461
|
.box {
|
|
2409
2462
|
gap: 15px;
|
|
2410
2463
|
}
|
|
@@ -2439,27 +2492,32 @@ input VoiceActivityParamsInput {
|
|
|
2439
2492
|
background: rgba(244, 54, 127, 0.2);
|
|
2440
2493
|
color: var(--ac-danger-color);
|
|
2441
2494
|
}
|
|
2442
|
-
`],
|
|
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`
|
|
2443
2496
|
<div class="container">
|
|
2444
|
-
<button class="back-button" @click=${this.back} aria-label="Go back">
|
|
2445
|
-
${wt()}
|
|
2446
|
-
</button>
|
|
2447
|
-
|
|
2448
2497
|
<div class="header">
|
|
2449
2498
|
<h1>Remote Node</h1>
|
|
2450
2499
|
<h3>Choose a host or enter a URL</h3>
|
|
2451
2500
|
</div>
|
|
2452
2501
|
|
|
2453
|
-
|
|
2454
|
-
<
|
|
2455
|
-
|
|
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`
|
|
2456
2514
|
<div class="box">
|
|
2457
2515
|
<p style="color: var(--ac-danger-color)">${this.error}</p>
|
|
2458
2516
|
<button class="primary" @click=${this.retry}>Retry</button>
|
|
2459
2517
|
</div>
|
|
2460
|
-
`:
|
|
2518
|
+
`:k`
|
|
2461
2519
|
<div class="host-list">
|
|
2462
|
-
${this.getSortedHosts().map(t=>
|
|
2520
|
+
${this.getSortedHosts().map(t=>k`
|
|
2463
2521
|
<div
|
|
2464
2522
|
class="host-card ${t.id===this.lastHostId?"pinned":""}"
|
|
2465
2523
|
tabindex="0"
|
|
@@ -2472,17 +2530,17 @@ input VoiceActivityParamsInput {
|
|
|
2472
2530
|
<div class="host-info">
|
|
2473
2531
|
<div style="display:flex;align-items:center;gap:8px;">
|
|
2474
2532
|
<p class="host-name">${t.name}</p>
|
|
2475
|
-
${t.id===this.lastHostId?
|
|
2533
|
+
${t.id===this.lastHostId?k`<span class="pinned-label">Last used</span>`:""}
|
|
2476
2534
|
</div>
|
|
2477
|
-
<p class="host-location">${t.location}</p>
|
|
2535
|
+
<p class="host-location">${Qt()}${t.location}</p>
|
|
2478
2536
|
<div class="host-meta">
|
|
2479
|
-
${t.aiModels.map(r=>
|
|
2537
|
+
${t.aiModels.map(r=>k`<span class="model-chip">${r}</span>`)}
|
|
2480
2538
|
</div>
|
|
2481
|
-
${t.rates.length>0?
|
|
2539
|
+
${t.rates.length>0?(()=>{let r=this.getLinkPrice(t.rates),n=this.getAvgTokenPrice(t.rates);return k`
|
|
2482
2540
|
<p class="rates-preview">
|
|
2483
|
-
${
|
|
2541
|
+
${r!=null?k`Link: ${this.formatPrice(r)} wHOT`:""}${r!=null&&n!=null?" \xB7 ":""}${n!=null?k`Token: ~${this.formatPrice(n)} wHOT`:""}
|
|
2484
2542
|
</p>
|
|
2485
|
-
|
|
2543
|
+
`})():""}
|
|
2486
2544
|
</div>
|
|
2487
2545
|
</div>
|
|
2488
2546
|
`)}
|
|
@@ -2508,9 +2566,9 @@ input VoiceActivityParamsInput {
|
|
|
2508
2566
|
Connect
|
|
2509
2567
|
</button>
|
|
2510
2568
|
</div>
|
|
2511
|
-
${this.manualUrlError?
|
|
2569
|
+
${this.manualUrlError?k`<p class="state danger" style="margin-top: 6px; font-size: 13px;">${this.manualUrlError}</p>`:""}
|
|
2512
2570
|
</div>
|
|
2513
|
-
`}};
|
|
2571
|
+
`}};yt.styles=[Ge,$e`
|
|
2514
2572
|
:host {
|
|
2515
2573
|
display: flex;
|
|
2516
2574
|
flex-direction: column;
|
|
@@ -2536,7 +2594,7 @@ input VoiceActivityParamsInput {
|
|
|
2536
2594
|
.host-card {
|
|
2537
2595
|
display: flex;
|
|
2538
2596
|
align-items: center;
|
|
2539
|
-
gap:
|
|
2597
|
+
gap: 16px;
|
|
2540
2598
|
padding: 14px;
|
|
2541
2599
|
border-radius: 8px;
|
|
2542
2600
|
background: rgba(128, 178, 201, 0.10);
|
|
@@ -2558,8 +2616,8 @@ input VoiceActivityParamsInput {
|
|
|
2558
2616
|
}
|
|
2559
2617
|
|
|
2560
2618
|
.host-avatar {
|
|
2561
|
-
width:
|
|
2562
|
-
height:
|
|
2619
|
+
width: 60px;
|
|
2620
|
+
height: 60px;
|
|
2563
2621
|
border-radius: 50%;
|
|
2564
2622
|
flex-shrink: 0;
|
|
2565
2623
|
object-fit: cover;
|
|
@@ -2589,12 +2647,19 @@ input VoiceActivityParamsInput {
|
|
|
2589
2647
|
}
|
|
2590
2648
|
|
|
2591
2649
|
.host-location {
|
|
2650
|
+
display: inline-flex;
|
|
2651
|
+
align-items: center;
|
|
2652
|
+
gap: 4px;
|
|
2592
2653
|
font-size: 13px;
|
|
2593
2654
|
color: rgba(255, 255, 255, 0.6);
|
|
2594
2655
|
margin: 2px 0 0 0;
|
|
2595
2656
|
text-align: left;
|
|
2596
2657
|
}
|
|
2597
2658
|
|
|
2659
|
+
.host-location svg {
|
|
2660
|
+
opacity: 0.7;
|
|
2661
|
+
}
|
|
2662
|
+
|
|
2598
2663
|
.host-meta {
|
|
2599
2664
|
display: flex;
|
|
2600
2665
|
flex-wrap: wrap;
|
|
@@ -2603,8 +2668,8 @@ input VoiceActivityParamsInput {
|
|
|
2603
2668
|
}
|
|
2604
2669
|
|
|
2605
2670
|
.model-chip {
|
|
2606
|
-
font-size:
|
|
2607
|
-
padding:
|
|
2671
|
+
font-size: 12px;
|
|
2672
|
+
padding: 3px 8px;
|
|
2608
2673
|
border-radius: 10px;
|
|
2609
2674
|
background: rgba(145, 227, 253, 0.15);
|
|
2610
2675
|
color: var(--ac-primary-color);
|
|
@@ -2614,28 +2679,19 @@ input VoiceActivityParamsInput {
|
|
|
2614
2679
|
.rates-preview {
|
|
2615
2680
|
font-size: 12px;
|
|
2616
2681
|
color: rgba(255, 255, 255, 0.5);
|
|
2617
|
-
margin-top:
|
|
2682
|
+
margin-top: 6px;
|
|
2618
2683
|
text-align: left;
|
|
2619
2684
|
}
|
|
2620
2685
|
|
|
2621
|
-
.spinner {
|
|
2686
|
+
.spinner-container {
|
|
2622
2687
|
display: flex;
|
|
2623
2688
|
justify-content: center;
|
|
2624
2689
|
padding: 40px 0;
|
|
2625
2690
|
}
|
|
2626
2691
|
|
|
2627
|
-
.spinner
|
|
2628
|
-
content: "";
|
|
2692
|
+
.spinner-container .spinner {
|
|
2629
2693
|
width: 32px;
|
|
2630
2694
|
height: 32px;
|
|
2631
|
-
border: 3px solid var(--ac-border-color-light);
|
|
2632
|
-
border-top-color: var(--ac-primary-color);
|
|
2633
|
-
border-radius: 50%;
|
|
2634
|
-
animation: spin 0.8s linear infinite;
|
|
2635
|
-
}
|
|
2636
|
-
|
|
2637
|
-
@keyframes spin {
|
|
2638
|
-
to { transform: rotate(360deg); }
|
|
2639
2695
|
}
|
|
2640
2696
|
|
|
2641
2697
|
.divider {
|
|
@@ -2675,6 +2731,24 @@ input VoiceActivityParamsInput {
|
|
|
2675
2731
|
flex-shrink: 0;
|
|
2676
2732
|
}
|
|
2677
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
|
+
|
|
2678
2752
|
.pinned-label {
|
|
2679
2753
|
font-size: 11px;
|
|
2680
2754
|
color: var(--ac-primary-color);
|
|
@@ -2682,47 +2756,38 @@ input VoiceActivityParamsInput {
|
|
|
2682
2756
|
letter-spacing: 0.5px;
|
|
2683
2757
|
font-weight: 600;
|
|
2684
2758
|
}
|
|
2685
|
-
|
|
2686
|
-
button.back-button {
|
|
2687
|
-
all: unset;
|
|
2688
|
-
cursor: pointer;
|
|
2689
|
-
}
|
|
2690
|
-
`],L([ie({type:Array})],ht.prototype,"hosts",2),L([ie({type:Boolean})],ht.prototype,"loading",2),L([ie({type:String})],ht.prototype,"error",2),L([ie({type:String})],ht.prototype,"lastHostId",2),L([ie({type:String})],ht.prototype,"defaultUrl",2),L([Y()],ht.prototype,"manualUrl",2),L([Y()],ht.prototype,"manualUrlError",2),ht=L([Ne("host-browser")],ht);var Nr=class extends ge{back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0}))}proceedToAuth(){this.dispatchEvent(new CustomEvent("proceed-to-auth",{detail:{host:this.host},bubbles:!0,composed:!0}))}renderAvatar(){return os(this.host,"profile-pic")}rateLabel(t){return t==="link write"?"Link write":t==="embedding per token"?"Embedding (per token)":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?I`
|
|
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`
|
|
2691
2760
|
<div class="container">
|
|
2692
|
-
<button class="back-button" aria-label="Go back" @click=${this.back}>
|
|
2693
|
-
${wt()}
|
|
2694
|
-
</button>
|
|
2695
|
-
|
|
2696
2761
|
<div class="profile">
|
|
2697
2762
|
${this.renderAvatar()}
|
|
2698
2763
|
<p class="profile-name">${this.host.name}</p>
|
|
2699
|
-
<p class="profile-location">${this.host.location}</p>
|
|
2700
|
-
${this.host.description?
|
|
2764
|
+
<p class="profile-location">${Qt()}${this.host.location}</p>
|
|
2765
|
+
${this.host.description?k`<p class="profile-description">${this.host.description}</p>`:""}
|
|
2701
2766
|
|
|
2702
|
-
${this.host.aiModels.length>0?
|
|
2767
|
+
${this.host.aiModels.length>0?k`
|
|
2703
2768
|
<div class="models">
|
|
2704
|
-
${this.host.aiModels.map(t=>
|
|
2769
|
+
${this.host.aiModels.map(t=>k`<span class="model-chip">${t}</span>`)}
|
|
2705
2770
|
</div>
|
|
2706
2771
|
`:""}
|
|
2707
2772
|
</div>
|
|
2708
2773
|
|
|
2709
|
-
${this.host.rates.length>0?
|
|
2774
|
+
${this.host.rates.length>0?k`
|
|
2710
2775
|
<div class="box">
|
|
2711
2776
|
<div class="rates-section">
|
|
2712
2777
|
<h3>Pricing</h3>
|
|
2713
2778
|
<table class="rates-table">
|
|
2714
|
-
${this.host.rates.filter(t
|
|
2779
|
+
${this.host.rates.filter(t=>this.isOperationRate(t)).map(t=>k`
|
|
2715
2780
|
<tr>
|
|
2716
2781
|
<td>${this.rateLabel(t.description)}</td>
|
|
2717
|
-
<td>${this.formatPrice(t.priceInHOT)}
|
|
2782
|
+
<td>${this.formatPrice(t.priceInHOT)} wHOT</td>
|
|
2718
2783
|
</tr>
|
|
2719
2784
|
`)}
|
|
2720
|
-
${this.host.rates.filter(t
|
|
2721
|
-
<tr><td colspan="2" style="padding-top:12px;color:rgba(255,255,255,0.5);font-size:12px;text-transform:uppercase;letter-spacing:0.5px;">AI Models (per token)</td></tr>
|
|
2722
|
-
${this.host.rates.filter(t
|
|
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`
|
|
2723
2788
|
<tr>
|
|
2724
|
-
<td>${t.description
|
|
2725
|
-
<td>${this.formatPrice(t.priceInHOT)}
|
|
2789
|
+
<td>${t.description}</td>
|
|
2790
|
+
<td>${this.formatPrice(t.priceInHOT)} wHOT</td>
|
|
2726
2791
|
</tr>
|
|
2727
2792
|
`)}
|
|
2728
2793
|
`:""}
|
|
@@ -2731,7 +2796,7 @@ input VoiceActivityParamsInput {
|
|
|
2731
2796
|
</div>
|
|
2732
2797
|
`:""}
|
|
2733
2798
|
|
|
2734
|
-
${this.host.computeSpecs?
|
|
2799
|
+
${this.host.computeSpecs?k`
|
|
2735
2800
|
<div class="box">
|
|
2736
2801
|
<div class="rates-section">
|
|
2737
2802
|
<h3>Compute</h3>
|
|
@@ -2744,7 +2809,7 @@ input VoiceActivityParamsInput {
|
|
|
2744
2809
|
Connect to ${this.host.name}
|
|
2745
2810
|
</button>
|
|
2746
2811
|
</div>
|
|
2747
|
-
`:null}};
|
|
2812
|
+
`:null}};Vt.styles=[Ge,$e`
|
|
2748
2813
|
.profile {
|
|
2749
2814
|
display: flex;
|
|
2750
2815
|
flex-direction: column;
|
|
@@ -2753,8 +2818,8 @@ input VoiceActivityParamsInput {
|
|
|
2753
2818
|
}
|
|
2754
2819
|
|
|
2755
2820
|
.profile-pic {
|
|
2756
|
-
width:
|
|
2757
|
-
height:
|
|
2821
|
+
width: 100px;
|
|
2822
|
+
height: 100px;
|
|
2758
2823
|
border-radius: 50%;
|
|
2759
2824
|
object-fit: cover;
|
|
2760
2825
|
background: rgba(128, 178, 201, 0.2);
|
|
@@ -2777,14 +2842,20 @@ input VoiceActivityParamsInput {
|
|
|
2777
2842
|
}
|
|
2778
2843
|
|
|
2779
2844
|
.profile-location {
|
|
2845
|
+
display: inline-flex;
|
|
2846
|
+
align-items: center;
|
|
2847
|
+
gap: 6px;
|
|
2780
2848
|
font-size: 14px;
|
|
2781
2849
|
color: rgba(255, 255, 255, 0.6);
|
|
2782
2850
|
margin: 0;
|
|
2783
2851
|
}
|
|
2784
2852
|
|
|
2853
|
+
.profile-location svg {
|
|
2854
|
+
opacity: 0.7;
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2785
2857
|
.profile-description {
|
|
2786
2858
|
font-size: 14px;
|
|
2787
|
-
color: rgba(255, 255, 255, 0.5);
|
|
2788
2859
|
margin: 0;
|
|
2789
2860
|
text-align: center;
|
|
2790
2861
|
line-height: 1.4;
|
|
@@ -2858,12 +2929,7 @@ input VoiceActivityParamsInput {
|
|
|
2858
2929
|
button.connect-button {
|
|
2859
2930
|
width: 100%;
|
|
2860
2931
|
}
|
|
2861
|
-
|
|
2862
|
-
button.back-button {
|
|
2863
|
-
all: unset;
|
|
2864
|
-
cursor: pointer;
|
|
2865
|
-
}
|
|
2866
|
-
`],L([ie({type:Object})],Nr.prototype,"host",2),Nr=L([Ne("host-detail")],Nr);var gt=class extends ge{constructor(){super(...arguments);this.connectedHost=null;this.userInfo=null;this.requestingPayment=!1;this.paymentError=null;this.walletInput="";this.editingWallet=!1;this.paymentSuccess=!1}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.dispatchEvent(new CustomEvent("set-wallet-address",{detail:{address:t},bubbles:!0,composed:!0})))}requestTopUp(t){this.paymentSuccess=!1,this.dispatchEvent(new CustomEvent("request-top-up",{detail:{amountHOT:t},bubbles:!0,composed:!0}))}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}updated(t){var r;t.has("requestingPayment")&&!this.requestingPayment&&!this.paymentError&&t.get("requestingPayment")&&(this.paymentSuccess=!0,setTimeout(()=>{this.paymentSuccess=!1},4e3)),t.has("userInfo")&&((r=this.userInfo)==null?void 0:r.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 I`
|
|
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`
|
|
2867
2933
|
<div class="container">
|
|
2868
2934
|
<div class="close-button" @click=${this.close}>
|
|
2869
2935
|
${Ue()}
|
|
@@ -2871,48 +2937,62 @@ input VoiceActivityParamsInput {
|
|
|
2871
2937
|
|
|
2872
2938
|
<div class="dashboard-header">
|
|
2873
2939
|
<h1>Dashboard</h1>
|
|
2874
|
-
${this.connectedHost?
|
|
2940
|
+
${this.connectedHost?k`
|
|
2941
|
+
<div class="host-badge">
|
|
2942
|
+
Connected to <strong>${this.connectedHost.name}</strong>
|
|
2943
|
+
</div>
|
|
2875
2944
|
<div class="host-badge">
|
|
2876
|
-
|
|
2945
|
+
${Qt()} ${this.connectedHost.location}
|
|
2877
2946
|
</div>
|
|
2878
2947
|
`:""}
|
|
2879
|
-
${(a=this.userInfo)!=null&&a.email?
|
|
2948
|
+
${(a=this.userInfo)!=null&&a.email?k`
|
|
2880
2949
|
<p class="email-display">${this.userInfo.email}</p>
|
|
2881
2950
|
`:""}
|
|
2882
2951
|
</div>
|
|
2883
2952
|
|
|
2884
2953
|
<!-- Credit balance -->
|
|
2885
|
-
${this.isFreeAccess?
|
|
2954
|
+
${this.isFreeAccess?k`
|
|
2886
2955
|
<div class="credit-display free-access">
|
|
2887
|
-
${
|
|
2956
|
+
${Kt()}
|
|
2888
2957
|
<span class="credit-amount">Free Access</span>
|
|
2889
2958
|
</div>
|
|
2890
|
-
`:
|
|
2891
|
-
<div class="credit-display
|
|
2892
|
-
${
|
|
2959
|
+
`:k`
|
|
2960
|
+
<div class="credit-display">
|
|
2961
|
+
${Kt()}
|
|
2893
2962
|
<span class="credit-amount">${t.toFixed(2)}</span>
|
|
2894
|
-
<span class="credit-label">
|
|
2963
|
+
<span class="credit-label">wHOT</span>
|
|
2895
2964
|
</div>
|
|
2896
2965
|
|
|
2897
|
-
${this.isDepleted?
|
|
2966
|
+
${this.isDepleted?k`
|
|
2898
2967
|
<div class="depleted-banner">Credits depleted — top up to continue using this host</div>
|
|
2899
2968
|
`:""}
|
|
2900
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
|
+
|
|
2901
2976
|
<!-- Wallet address -->
|
|
2902
2977
|
<div class="wallet-section">
|
|
2903
|
-
<label>${
|
|
2904
|
-
${this.hasWallet&&!this.editingWallet?
|
|
2978
|
+
<label>${ea()} wHOT Wallet Address</label>
|
|
2979
|
+
${this.hasWallet&&!this.editingWallet?k`
|
|
2905
2980
|
<div class="wallet-row">
|
|
2906
|
-
<div class="wallet-display">${this.userInfo.hotWalletAddress}</div>
|
|
2981
|
+
<div class="wallet-display" title=${this.userInfo.hotWalletAddress}>${this.truncateMiddle(this.userInfo.hotWalletAddress||"")}</div>
|
|
2907
2982
|
<button class="secondary" @click=${()=>{this.editingWallet=!0,this.walletInput=this.userInfo.hotWalletAddress||""}}>
|
|
2908
2983
|
Change
|
|
2909
2984
|
</button>
|
|
2910
2985
|
</div>
|
|
2911
|
-
|
|
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`
|
|
2912
2992
|
<div class="wallet-row">
|
|
2913
2993
|
<input
|
|
2914
2994
|
type="text"
|
|
2915
|
-
placeholder="Enter your
|
|
2995
|
+
placeholder="Enter your wHOT wallet address"
|
|
2916
2996
|
.value=${this.walletInput}
|
|
2917
2997
|
@input=${s=>{this.walletInput=s.target.value}}
|
|
2918
2998
|
@keydown=${s=>{s.key==="Enter"&&this.setWalletAddress()}}
|
|
@@ -2929,39 +3009,68 @@ input VoiceActivityParamsInput {
|
|
|
2929
3009
|
`}
|
|
2930
3010
|
</div>
|
|
2931
3011
|
|
|
2932
|
-
<!-- Top-up
|
|
2933
|
-
<div class="topup-
|
|
2934
|
-
|
|
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
|
+
/>
|
|
2935
3025
|
<button
|
|
2936
|
-
class="
|
|
2937
|
-
?disabled=${
|
|
2938
|
-
@click=${()=>this.requestTopUp(
|
|
3026
|
+
class="primary"
|
|
3027
|
+
?disabled=${this.topUpDisabled||!this.topUpAmount||Number(this.topUpAmount)<=0}
|
|
3028
|
+
@click=${()=>this.requestTopUp(Number(this.topUpAmount))}
|
|
2939
3029
|
>
|
|
2940
|
-
${this.requestingPayment?"..."
|
|
3030
|
+
${this.requestingPayment?"...":"Top up"}
|
|
2941
3031
|
</button>
|
|
2942
|
-
|
|
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>
|
|
2943
3044
|
</div>
|
|
2944
3045
|
|
|
2945
|
-
${this.
|
|
2946
|
-
<
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
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
|
+
`:""}
|
|
2950
3052
|
|
|
2951
|
-
${this.
|
|
2952
|
-
<div class="success-message"
|
|
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>
|
|
2953
3057
|
`:""}
|
|
2954
3058
|
|
|
2955
|
-
${this.paymentError?
|
|
3059
|
+
${this.paymentError?k`
|
|
2956
3060
|
<div class="error-message">${this.paymentError}</div>
|
|
2957
3061
|
`:""}
|
|
2958
3062
|
`}
|
|
2959
3063
|
|
|
2960
|
-
<
|
|
2961
|
-
|
|
2962
|
-
|
|
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>
|
|
2963
3072
|
</div>
|
|
2964
|
-
`}};
|
|
3073
|
+
`}};We.styles=[Ge,$e`
|
|
2965
3074
|
.dashboard-header {
|
|
2966
3075
|
text-align: center;
|
|
2967
3076
|
}
|
|
@@ -2970,10 +3079,18 @@ input VoiceActivityParamsInput {
|
|
|
2970
3079
|
display: flex;
|
|
2971
3080
|
align-items: center;
|
|
2972
3081
|
justify-content: center;
|
|
2973
|
-
gap:
|
|
3082
|
+
gap: 5px;
|
|
2974
3083
|
font-size: 14px;
|
|
2975
3084
|
color: rgba(255, 255, 255, 0.6);
|
|
2976
|
-
margin-
|
|
3085
|
+
margin-bottom: 8px;
|
|
3086
|
+
}
|
|
3087
|
+
|
|
3088
|
+
.host-badge strong {
|
|
3089
|
+
color: #ffffff;
|
|
3090
|
+
}
|
|
3091
|
+
|
|
3092
|
+
.host-badge svg {
|
|
3093
|
+
opacity: 0.7;
|
|
2977
3094
|
}
|
|
2978
3095
|
|
|
2979
3096
|
.credit-display {
|
|
@@ -3010,10 +3127,6 @@ input VoiceActivityParamsInput {
|
|
|
3010
3127
|
box-shadow: 0 0 0 1px var(--ac-danger-color);
|
|
3011
3128
|
}
|
|
3012
3129
|
|
|
3013
|
-
.credit-display.depleted .credit-amount {
|
|
3014
|
-
color: var(--ac-danger-color);
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
3130
|
.credit-display.free-access {
|
|
3018
3131
|
background: rgba(93, 210, 125, 0.14);
|
|
3019
3132
|
box-shadow: 0 0 0 1px var(--ac-success-color);
|
|
@@ -3081,7 +3194,7 @@ input VoiceActivityParamsInput {
|
|
|
3081
3194
|
background: #00091e5c;
|
|
3082
3195
|
box-shadow: 0 0 0 1px var(--ac-border-color-light);
|
|
3083
3196
|
font-size: 14px;
|
|
3084
|
-
color: var(--ac-primary-color);
|
|
3197
|
+
color: var(--ac-primary-color-light);
|
|
3085
3198
|
font-family: monospace;
|
|
3086
3199
|
overflow: hidden;
|
|
3087
3200
|
text-overflow: ellipsis;
|
|
@@ -3089,6 +3202,29 @@ input VoiceActivityParamsInput {
|
|
|
3089
3202
|
flex: 1;
|
|
3090
3203
|
}
|
|
3091
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
|
+
|
|
3092
3228
|
.topup-buttons {
|
|
3093
3229
|
display: flex;
|
|
3094
3230
|
gap: 8px;
|
|
@@ -3101,6 +3237,26 @@ input VoiceActivityParamsInput {
|
|
|
3101
3237
|
height: 42px;
|
|
3102
3238
|
}
|
|
3103
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
|
+
|
|
3104
3260
|
.success-message {
|
|
3105
3261
|
text-align: center;
|
|
3106
3262
|
padding: 10px;
|
|
@@ -3111,6 +3267,12 @@ input VoiceActivityParamsInput {
|
|
|
3111
3267
|
font-weight: 600;
|
|
3112
3268
|
}
|
|
3113
3269
|
|
|
3270
|
+
.success-message svg {
|
|
3271
|
+
width: 16px;
|
|
3272
|
+
height: 16px;
|
|
3273
|
+
flex-shrink: 0;
|
|
3274
|
+
}
|
|
3275
|
+
|
|
3114
3276
|
.error-message {
|
|
3115
3277
|
text-align: center;
|
|
3116
3278
|
padding: 10px;
|
|
@@ -3126,10 +3288,16 @@ input VoiceActivityParamsInput {
|
|
|
3126
3288
|
text-align: center;
|
|
3127
3289
|
}
|
|
3128
3290
|
|
|
3291
|
+
.footer-actions {
|
|
3292
|
+
display: flex;
|
|
3293
|
+
justify-content: center;
|
|
3294
|
+
gap: 8px;
|
|
3295
|
+
}
|
|
3296
|
+
|
|
3129
3297
|
button.full {
|
|
3130
3298
|
width: 100%;
|
|
3131
3299
|
}
|
|
3132
|
-
`],
|
|
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`
|
|
3133
3301
|
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
|
|
3134
3302
|
|
|
3135
3303
|
:host {
|
|
@@ -3185,6 +3353,7 @@ input VoiceActivityParamsInput {
|
|
|
3185
3353
|
}
|
|
3186
3354
|
|
|
3187
3355
|
.modal-header {
|
|
3356
|
+
position: relative;
|
|
3188
3357
|
display: flex;
|
|
3189
3358
|
align-items: center;
|
|
3190
3359
|
justify-content: center;
|
|
@@ -3197,6 +3366,28 @@ input VoiceActivityParamsInput {
|
|
|
3197
3366
|
height: 70px;
|
|
3198
3367
|
}
|
|
3199
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
|
+
|
|
3200
3391
|
.modal-content {
|
|
3201
3392
|
display: flex;
|
|
3202
3393
|
flex-direction: column;
|
|
@@ -3205,19 +3396,52 @@ input VoiceActivityParamsInput {
|
|
|
3205
3396
|
min-height: 0;
|
|
3206
3397
|
}
|
|
3207
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;
|
|
3434
|
+
}
|
|
3435
|
+
|
|
3208
3436
|
.settings-button {
|
|
3209
3437
|
appearance: none;
|
|
3210
3438
|
border: none;
|
|
3211
3439
|
background: transparent;
|
|
3212
3440
|
padding: 0;
|
|
3213
3441
|
cursor: pointer;
|
|
3214
|
-
position: fixed;
|
|
3215
|
-
bottom: 10px;
|
|
3216
|
-
right: 10px;
|
|
3217
3442
|
color: var(--ac-primary-color);
|
|
3218
3443
|
width: 34px;
|
|
3219
3444
|
height: 34px;
|
|
3220
|
-
z-index: 99999;
|
|
3221
3445
|
}
|
|
3222
3446
|
|
|
3223
3447
|
.settings-button.low-credit {
|
|
@@ -3229,7 +3453,7 @@ input VoiceActivityParamsInput {
|
|
|
3229
3453
|
0%, 100% { opacity: 1; }
|
|
3230
3454
|
50% { opacity: 0.4; }
|
|
3231
3455
|
}
|
|
3232
|
-
`,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()
|
|
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`
|
|
3233
3457
|
<connection-options
|
|
3234
3458
|
.port=${this.core.port}
|
|
3235
3459
|
.showHosting=${!!this.core.options.hosting}
|
|
@@ -3237,7 +3461,7 @@ input VoiceActivityParamsInput {
|
|
|
3237
3461
|
@connect-local-node=${this.connectLocalNode}
|
|
3238
3462
|
@browse-hosts=${this.browseHosts}
|
|
3239
3463
|
></connection-options>
|
|
3240
|
-
`;if(this.currentView==="local-authentication")return
|
|
3464
|
+
`;if(this.currentView==="local-authentication")return k`
|
|
3241
3465
|
<local-authentication
|
|
3242
3466
|
.capabilities=${this.core.options.capabilities}
|
|
3243
3467
|
.appname=${this.core.options.appInfo.name}
|
|
@@ -3248,7 +3472,7 @@ input VoiceActivityParamsInput {
|
|
|
3248
3472
|
@verify-code=${this.verifyLocalAd4mCode}
|
|
3249
3473
|
@clear-verification-error=${()=>{this.verificationError=!1}}
|
|
3250
3474
|
></local-authentication>
|
|
3251
|
-
`;if(this.currentView==="host-browser")return
|
|
3475
|
+
`;if(this.currentView==="host-browser")return k`
|
|
3252
3476
|
<host-browser
|
|
3253
3477
|
.hosts=${this.hosts}
|
|
3254
3478
|
.loading=${this.hostsLoading}
|
|
@@ -3259,13 +3483,13 @@ input VoiceActivityParamsInput {
|
|
|
3259
3483
|
@back=${()=>{this.currentView="connection-options"}}
|
|
3260
3484
|
@retry=${this.retryFetchHosts}
|
|
3261
3485
|
></host-browser>
|
|
3262
|
-
`;if(this.currentView==="host-detail")return
|
|
3486
|
+
`;if(this.currentView==="host-detail")return k`
|
|
3263
3487
|
<host-detail
|
|
3264
3488
|
.host=${this.selectedHost}
|
|
3265
3489
|
@proceed-to-auth=${this.proceedToAuth}
|
|
3266
3490
|
@back=${()=>{this.currentView="host-browser"}}
|
|
3267
3491
|
></host-detail>
|
|
3268
|
-
`;if(this.currentView==="remote-authentication")return
|
|
3492
|
+
`;if(this.currentView==="remote-authentication")return k`
|
|
3269
3493
|
<remote-authentication
|
|
3270
3494
|
.host=${this.selectedHost}
|
|
3271
3495
|
.remoteAuthLoading=${this.remoteAuthLoading}
|
|
@@ -3279,8 +3503,9 @@ input VoiceActivityParamsInput {
|
|
|
3279
3503
|
@password-login=${this.passwordLogin}
|
|
3280
3504
|
@create-account=${this.createAccount}
|
|
3281
3505
|
@clear-email-code-error=${()=>{this.emailCodeError=!1}}
|
|
3506
|
+
@reset-auth-state=${()=>{this.resetRemoteAuthState()}}
|
|
3282
3507
|
></remote-authentication>
|
|
3283
|
-
`;if(this.currentView==="logged-in-dashboard")return
|
|
3508
|
+
`;if(this.currentView==="logged-in-dashboard")return k`
|
|
3284
3509
|
<logged-in-dashboard
|
|
3285
3510
|
.connectedHost=${this.core.connectedHost}
|
|
3286
3511
|
.userInfo=${this.userInfo}
|
|
@@ -3291,7 +3516,7 @@ input VoiceActivityParamsInput {
|
|
|
3291
3516
|
@request-top-up=${this.handleRequestTopUp}
|
|
3292
3517
|
@set-wallet-address=${this.handleSetWalletAddress}
|
|
3293
3518
|
></logged-in-dashboard>
|
|
3294
|
-
`;if(this.currentView==="current-state")return
|
|
3519
|
+
`;if(this.currentView==="current-state")return k`
|
|
3295
3520
|
<current-state
|
|
3296
3521
|
.url=${this.core.url}
|
|
3297
3522
|
.port=${this.core.port}
|
|
@@ -3299,11 +3524,16 @@ input VoiceActivityParamsInput {
|
|
|
3299
3524
|
@close=${()=>{this.modalOpen=!1}}
|
|
3300
3525
|
@disconnect=${this.disconnect}
|
|
3301
3526
|
></current-state>
|
|
3302
|
-
`}render(){
|
|
3527
|
+
`}render(){var t;if(this.modalOpen)return k`
|
|
3303
3528
|
<div class="wrapper">
|
|
3304
3529
|
<div class="modal">
|
|
3305
3530
|
<header class="modal-header">
|
|
3306
|
-
${
|
|
3531
|
+
${this.backTarget?k`
|
|
3532
|
+
<button class="back-button" aria-label="Go back" @click=${this.handleBack}>
|
|
3533
|
+
${Yn()} Back
|
|
3534
|
+
</button>
|
|
3535
|
+
`:""}
|
|
3536
|
+
${Ei()}
|
|
3307
3537
|
</header>
|
|
3308
3538
|
<main class="modal-content">
|
|
3309
3539
|
${this.renderViews()}
|
|
@@ -3311,16 +3541,23 @@ input VoiceActivityParamsInput {
|
|
|
3311
3541
|
</div>
|
|
3312
3542
|
<div class="backdrop" />
|
|
3313
3543
|
</div>
|
|
3314
|
-
|
|
3315
|
-
<
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
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};
|
|
3324
3561
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
3325
3562
|
/**
|
|
3326
3563
|
* @license
|