@coasys/ad4m-connect 0.12.0-rc1-dev.3 → 0.12.0-rc1-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.js +213 -213
- package/dist/index.js +241 -241
- package/dist/web.js +305 -305
- package/package.json +3 -3
package/dist/core.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
1
|
+
var _e=(r,e,t)=>new Promise((n,i)=>{var a=c=>{try{s(t.next(c))}catch(u){i(u)}},o=c=>{try{s(t.throw(c))}catch(u){i(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var Hs=function(r,e){return Hs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Hs(r,e)};function Ae(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Hs(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var E=function(){return E=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},E.apply(this,arguments)};function Qt(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Ct(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(r,e||[])).next())})}function Pt(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(t=0)),t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,i=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Er(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}var Ks="Invariant Violation",ml=Object.setPrototypeOf,Fh=ml===void 0?function(r,e){return r.__proto__=e,r}:ml,G=function(r){Ae(e,r);function e(t){t===void 0&&(t=Ks);var n=r.call(this,typeof t=="number"?Ks+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Ks,Fh(n,e.prototype),n}return e}(Error);function L(r,e){if(!r)throw new G(e)}var eo=["debug","log","warn","error","silent"],Js=eo.indexOf("log");function Xa(r){return function(){if(eo.indexOf(r)>=Js){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Xa("debug"),r.log=Xa("log"),r.warn=Xa("warn"),r.error=Xa("error")})(L||(L={}));function gl(r){var e=eo[Js];return Js=Math.max(0,eo.indexOf(r)),e}function qe(r){try{return r()}catch{}}var to=qe(function(){return globalThis})||qe(function(){return window})||qe(function(){return self})||qe(function(){return global})||qe(function(){return qe.constructor("return this")()});var yl="__",vl=[yl,yl].join("DEV");function Mh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(to,vl,{value:qe(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),to[vl]}}var tn=Mh();function xr(r){try{return r()}catch{}}var Ys=xr(function(){return globalThis})||xr(function(){return window})||xr(function(){return self})||xr(function(){return global})||xr(function(){return xr.constructor("return this")()}),Zs=!1;function jh(){Ys&&!xr(function(){return"production"})&&!xr(function(){return process})&&(Object.defineProperty(Ys,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Zs=!0)}jh();function Xs(){Zs&&(delete Ys.process,Zs=!1)}var hw=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",mw=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",bl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Pe=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 ec(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Uh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Fi=Uh;function ro(r){var e=r.prototype.toJSON;typeof e=="function"||ec(0),r.prototype.inspect=e,Fi&&(r.prototype[Fi]=e)}var Sl=function(){function r(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();ro(Sl);var wl=function(){function r(t,n,i,a,o,s,c){this.kind=t,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();ro(wl);function tc(r){return r!=null&&typeof r.kind=="string"}function no(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?no=function(t){return typeof t}:no=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},no(r)}var qh=10,_l=2;function Mi(r){return io(r,[])}function io(r,e){switch(no(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Bh(r,e);default:return String(r)}}function Bh(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=zh(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:io(i,t)}else if(Array.isArray(r))return Qh(r,t);return Vh(r,t)}function Vh(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>_l)return"["+Wh(r)+"]";var n=t.map(function(i){var a=io(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Qh(r,e){if(r.length===0)return"[]";if(e.length>_l)return"[Array]";for(var t=Math.min(qh,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(io(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function zh(r){var e=r[String(Fi)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Wh(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ji(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function El(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Gh(r,e,t){return e&&El(r.prototype,e),t&&El(r,t),r}var ao=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ji(0,"Body must be a string. Received: ".concat(Mi(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ji(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ji(0,"column in locationOffset is 1-indexed and must be positive.")}return Gh(r,[{key:bl,get:function(){return"Source"}}]),r}();function xl(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=r.indexOf(`
|
|
2
2
|
`)===-1,i=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!n||a||o||t,c="";return s&&!(n&&i)&&(c+=`
|
|
3
3
|
`+e),c+=e?r.replace(/\n/g,`
|
|
4
4
|
`+e):r,s&&(c+=`
|
|
5
|
-
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var
|
|
5
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Hh={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},rn=Object.freeze({});function Ye(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Hh,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,p=[],d=[],f=r;do{o++;var m=o===a.length,h=m&&s.length!==0;if(m){if(u=d.length===0?void 0:p[p.length-1],c=l,l=d.pop(),h){if(i)c=c.slice();else{for(var g={},b=0,v=Object.keys(c);b<v.length;b++){var S=v[b];g[S]=c[S]}c=g}for(var y=0,k=0;k<s.length;k++){var N=s[k][0],T=s[k][1];i&&(N-=y),i&&T===null?(c.splice(N,1),y++):c[N]=T}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(u=l?i?o:a[o]:void 0,c=l?l[u]:f,c==null)continue;l&&p.push(u)}var C=void 0;if(!Array.isArray(c)){if(!tc(c))throw new Error("Invalid AST Node: ".concat(Mi(c),"."));var $=rc(e,c.kind,m);if($){if(C=$.call(e,c,u,l,p,d),C===rn)break;if(C===!1){if(!m){p.pop();continue}}else if(C!==void 0&&(s.push([u,C]),!m))if(tc(C))c=C;else{p.pop();continue}}}if(C===void 0&&h&&s.push([u,c]),m)p.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&d.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function rc(r,e,t){var n=r[e];if(n){if(!t&&typeof n=="function")return n;var i=t?n.leave:n.enter;if(typeof i=="function")return i}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Hn(r){return Ye(r,{leave:Jh})}var Kh=80,Jh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return F(e.definitions,`
|
|
6
6
|
|
|
7
7
|
`)+`
|
|
8
|
-
`},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Te("(",F(e.variableDefinitions,", "),")"),a=F(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&t==="query"?o:F([t,F([n,i]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return t+": "+n+Te(" = ",i)+Te(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return $t(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Te("",t,": ")+n,c=s+Te("(",F(i,", "),")");return c.length>
|
|
9
|
-
`,
|
|
8
|
+
`},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Te("(",F(e.variableDefinitions,", "),")"),a=F(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&t==="query"?o:F([t,F([n,i]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return t+": "+n+Te(" = ",i)+Te(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return $t(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Te("",t,": ")+n,c=s+Te("(",F(i,", "),")");return c.length>Kh&&(c=s+Te(`(
|
|
9
|
+
`,oo(F(i,`
|
|
10
10
|
`)),`
|
|
11
|
-
)`)),F([c,F(a," "),o]," ")},Argument:function(e){var t=e.name,n=e.value;return t+": "+n},FragmentSpread:function(e){var t=e.name,n=e.directives;return"..."+t+Te(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Te("on ",t),F(n," "),i]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Te("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Te("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var n=e.value,i=e.block;return i?
|
|
12
|
-
`,
|
|
11
|
+
)`)),F([c,F(a," "),o]," ")},Argument:function(e){var t=e.name,n=e.value;return t+": "+n},FragmentSpread:function(e){var t=e.name,n=e.directives;return"..."+t+Te(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Te("on ",t),F(n," "),i]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Te("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Te("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var n=e.value,i=e.block;return i?xl(n,t==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+F(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+F(t,", ")+"}"},ObjectField:function(e){var t=e.name,n=e.value;return t+": "+n},Directive:function(e){var t=e.name,n=e.arguments;return"@"+t+Te("(",F(n,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:Lt(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),$t(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:Lt(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Lt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["type",e,Te("implements ",F(t," & ")),F(n," "),$t(i)]," ")}),FieldDefinition:Lt(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(Il(t)?Te(`(
|
|
12
|
+
`,oo(F(t,`
|
|
13
13
|
`)),`
|
|
14
|
-
)`):Te("(",F(t,", "),")"))+": "+n+Te(" ",F(i," "))}),InputValueDefinition:Lt(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Te("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Lt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Te("implements ",F(t," & ")),F(n," "),$t(i)]," ")}),UnionTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.types;return F(["union",e,F(t," "),n&&n.length!==0?"= "+F(n," | "):""]," ")}),EnumTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),$t(n)]," ")}),EnumValueDefinition:Lt(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),$t(n)]," ")}),DirectiveDefinition:Lt(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(
|
|
15
|
-
`,
|
|
14
|
+
)`):Te("(",F(t,", "),")"))+": "+n+Te(" ",F(i," "))}),InputValueDefinition:Lt(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Te("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Lt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Te("implements ",F(t," & ")),F(n," "),$t(i)]," ")}),UnionTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.types;return F(["union",e,F(t," "),n&&n.length!==0?"= "+F(n," | "):""]," ")}),EnumTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),$t(n)]," ")}),EnumValueDefinition:Lt(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Lt(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),$t(n)]," ")}),DirectiveDefinition:Lt(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(Il(t)?Te(`(
|
|
15
|
+
`,oo(F(t,`
|
|
16
16
|
`)),`
|
|
17
17
|
)`):Te("(",F(t,", "),")"))+(n?" repeatable":"")+" on "+F(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return F(["extend schema",F(t," "),$t(n)]," ")},ScalarTypeExtension:function(e){var t=e.name,n=e.directives;return F(["extend scalar",t,F(n," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend type",t,Te("implements ",F(n," & ")),F(i," "),$t(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend interface",t,Te("implements ",F(n," & ")),F(i," "),$t(a)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return F(["extend union",t,F(n," "),i&&i.length!==0?"= "+F(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return F(["extend enum",t,F(n," "),$t(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return F(["extend input",t,F(n," "),$t(i)]," ")}};function Lt(r){return function(e){return F([e.description,r(e)],`
|
|
18
18
|
`)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(n){return n}).join(t))!==null&&e!==void 0?e:""}function $t(r){return Te(`{
|
|
19
|
-
`,
|
|
19
|
+
`,oo(F(r,`
|
|
20
20
|
`)),`
|
|
21
|
-
}`)}function Te(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function
|
|
22
|
-
`))}function
|
|
23
|
-
`)!==-1}function xl(r){return r!=null&&r.some(Kh)}function ji(r){return r.kind===Ce.FIELD||r.kind===Ce.FRAGMENT_SPREAD||r.kind===Ce.INLINE_FRAGMENT}function Il(){return typeof io=="function"?Zs():Zs()}function im(){__DEV__?L(typeof en=="boolean",en):L(typeof en=="boolean",39)}Il();im();function ur(r,e){var t=r.directives;return!t||!t.length?!0:Tl(t).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?L(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Hn(r,e,t){var n=new Set(r),i=n.size;return Ye(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return tn}}),t?!n.size:n.size<i}function rc(r){return r&&Hn(["client","export"],r,!0)}function am(r){var e=r.name.value;return e==="skip"||e==="include"}function Tl(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!am(t)){var n=t.arguments,i=t.name.value;__DEV__?L(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):L(n&&n.length===1,41);var a=n[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):L(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function nc(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new G("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new G(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(__DEV__?L(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(n.length===1,45),t=n[0].name.value);var i=E(E({},r),{definitions:Er([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function rn(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function nn(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return __DEV__?L(n,"No fragment named ".concat(t)):L(n,46),n||null}default:return null}}function ae(r){return r!==null&&typeof r=="object"}function zt(r){return{__ref:String(r)}}function ee(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function ic(r){return ae(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function om(r){return r.kind==="StringValue"}function sm(r){return r.kind==="BooleanValue"}function cm(r){return r.kind==="IntValue"}function um(r){return r.kind==="FloatValue"}function lm(r){return r.kind==="Variable"}function fm(r){return r.kind==="ObjectValue"}function pm(r){return r.kind==="ListValue"}function dm(r){return r.kind==="EnumValue"}function hm(r){return r.kind==="NullValue"}function Ir(r,e,t,n){if(cm(t)||um(t))r[e.value]=Number(t.value);else if(sm(t)||om(t))r[e.value]=t.value;else if(fm(t)){var i={};t.fields.map(function(o){return Ir(i,o.name,o.value,n)}),r[e.value]=i}else if(lm(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(pm(t))r[e.value]=t.values.map(function(o){var s={};return Ir(s,e,o,n),s[e.value]});else if(dm(t))r[e.value]=t.value;else if(hm(t))r[e.value]=null;else throw __DEV__?new G('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new G(55)}function ac(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Ir(t[i.name.value],o,s,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,o=i.value;return Ir(n,a,o,e)})),qi(r.name.value,n,t)}var mm=["connection","include","skip","client","rest","export"],qi=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(t.connection.key,"(").concat(Ui(i),")")}else return t.connection.key;var a=r;if(e){var o=Ui(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){mm.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Ui(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Ui;return Ui=r,e}}),Ui=function(e){return JSON.stringify(e,gm)};function gm(r,e){return ae(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function lr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Ir(t,i,a,e)}),t}return null}function xt(r){return r.alias?r.alias.value:r.name.value}function Bi(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(mt(a)){if(a.name.value==="__typename")return r[xt(a)]}else{var o=Bi(r,nn(a,t).selectionSet,t);if(typeof o=="string")return o}}}function mt(r){return r.kind==="Field"}function oc(r){return r.kind==="InlineFragment"}function Jn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new G('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new G(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function Wt(r){return Jn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Yn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function an(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Vi(r){var e=Wt(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function sc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function on(r){Jn(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new G("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new G(54)}function sn(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Ir(e,n.variable.name,n.defaultValue)}),e}var me=Array.isArray;function $e(r){return Array.isArray(r)&&r.length>0}var kl={kind:Ce.FIELD,name:{kind:Ce.NAME,value:"__typename"}};function Ol(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Ce.FRAGMENT_SPREAD&&Ol(e[t.name.value],e)})}function ym(r){return Ol(Wt(r)||sc(r),rn(an(r)))?null:r}function vm(r){var e=new Set,t=[];return r.forEach(function(n){n.name?e.add(n.name):n.test&&t.push(n.test)}),function(n){return e.has(n.name.value)||t.some(function(i){return i(n)})}}function Al(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function cc(r,e){for(var t=Al(""),n=Al(""),i=function(b){for(var v=0,y=void 0;v<b.length&&(y=b[v]);++v)if(!me(y)){if(y.kind===Ce.OPERATION_DEFINITION)return t(y.name&&y.name.value);if(y.kind===Ce.FRAGMENT_DEFINITION)return n(y.name.value)}return __DEV__&&L.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Ce.OPERATION_DEFINITION&&++a;var s=vm(r),c=r.some(function(b){return b.remove}),u=function(b){return c&&b&&b.some(s)},l=new Map,d=!1,p={enter:function(b){if(u(b.directives))return d=!0,null}},f=Ye(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,v,y,k,R){var T=i(R);T&&T.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,v,y,k,R){if(u(b.directives))return d=!0,null;var T=i(R);T&&T.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,v,y,k){l.set(JSON.stringify(k),b)},leave:function(b,v,y,k){var R=l.get(JSON.stringify(k));if(b===R)return b;if(a>0&&b.selectionSet.selections.every(function(T){return T.kind===Ce.FIELD&&T.name.value==="__typename"}))return n(b.name.value).removed=!0,d=!0,null}},Directive:{leave:function(b){if(s(b))return d=!0,null}}});if(!d)return e;var h=function(b){return b.transitiveVars||(b.transitiveVars=new Set(b.variables),b.removed||b.fragmentSpreads.forEach(function(v){h(n(v)).transitiveVars.forEach(function(y){b.transitiveVars.add(y)})})),b},m=new Set;f.definitions.forEach(function(b){b.kind===Ce.OPERATION_DEFINITION?h(t(b.name&&b.name.value)).fragmentSpreads.forEach(function(v){m.add(v)}):b.kind===Ce.FRAGMENT_DEFINITION&&a===0&&!n(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(n(b)).fragmentSpreads.forEach(function(v){m.add(v)})});var g=function(b){return!!(!m.has(b)||n(b).removed)},S={enter:function(b){if(g(b.name.value))return null}};return ym(Ye(f,{FragmentSpread:S,FragmentDefinition:S,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var v=h(t(b.name&&b.name.value)).transitiveVars;if(v.size<b.variableDefinitions.length)return E(E({},b),{variableDefinitions:b.variableDefinitions.filter(function(y){return v.has(y.variable.name.value)})})}}}}))}var cn=Object.assign(function(r){return Ye(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Ce.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return mt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(mt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Er(Er([],i,!0),[kl],!1)})}}}}}})},{added:function(r){return r===kl}}),bm={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&L.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function uc(r){return cc([bm],Jn(r))}function lc(r){var e=on(r),t=e.operation;if(t==="query")return r;var n=Ye(r,{OperationDefinition:{enter:function(i){return E(E({},i),{operation:"query"})}}});return n}function fc(r){Jn(r);var e=cc([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Sm=Object.prototype.hasOwnProperty;function pc(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Qi(r)}function Qi(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new st,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var wm=function(r,e,t){return this.merge(r[t],e[t])},st=function(){function r(e){e===void 0&&(e=wm),this.reconciler=e,this.isObject=ae,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ae(t)&&ae(e)?(Object.keys(t).forEach(function(o){if(Sm.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Er([e,t,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return ae(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function _m(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=Em(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Em(r,e){if(!!r){if(typeof r=="string")return Nl(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Nl(r,e)}}function Nl(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Dl(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function gc(r,e,t){return e&&Dl(r.prototype,e),t&&Dl(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var yc=function(){return typeof Symbol=="function"},vc=function(r){return yc()&&Boolean(Symbol[r])},bc=function(r){return vc(r)?Symbol[r]:"@@"+r};yc()&&!vc("observable")&&(Symbol.observable=Symbol("observable"));var xm=bc("iterator"),hc=bc("observable"),Rl=bc("species");function so(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function zi(r){var e=r.constructor;return e!==void 0&&(e=e[Rl],e===null&&(e=void 0)),e!==void 0?e:X}function Im(r){return r instanceof X}function Zn(r){Zn.log?Zn.log(r):setTimeout(function(){throw r})}function oo(r){Promise.resolve().then(function(){try{r()}catch(e){Zn(e)}})}function Cl(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=so(e,"unsubscribe");t&&t.call(e)}}catch(n){Zn(n)}}function mc(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Tm(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Pl(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Pl(r,e,t){r._state="running";var n=r._observer;try{var i=so(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(mc(r),i)i.call(n,t);else throw t;break;case"complete":mc(r),i&&i.call(n);break}}catch(a){Zn(a)}r._state==="closed"?Cl(r):r._state==="running"&&(r._state="ready")}function dc(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],oo(function(){return Tm(r)});return}Pl(r,e,t)}}var km=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new Am(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(mc(this),Cl(this))},gc(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Am=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){dc(this._subscription,"next",n)},e.error=function(n){dc(this._subscription,"error",n)},e.complete=function(){dc(this._subscription,"complete")},gc(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),X=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new km(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=i.subscribe({next:function(u){try{n(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(d){var p=!s;if(s=!0,!p||o)try{u=n(u,d)}catch(f){return l.error(f)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=zi(this);return new s(function(c){var u,l=0;function d(p){u=p.subscribe({next:function(f){c.next(f)},error:function(f){c.error(f)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(p){return o.error(p)}var d=a.from(l).subscribe({next:function(p){o.next(p)},error:function(p){o.error(p)},complete:function(){var p=s.indexOf(d);p>=0&&s.splice(p,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[hc]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=so(n,hc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Im(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(vc("iterator")&&(a=so(n,xm),a))return new i(function(s){oo(function(){if(!s.closed){for(var c=_m(a.call(n)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){oo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){oo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},gc(r,null,[{key:Rl,get:function(){return this}}]),r}();yc()&&Object.defineProperty(X,Symbol("extensions"),{value:{symbol:hc,hostReportError:Zn},configurable:!0});function Sc(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Xn;typeof self<"u"?Xn=self:typeof window<"u"?Xn=window:typeof global<"u"?Xn=global:typeof module<"u"?Xn=module:Xn=Function("return this")();var M_=Sc(Xn);var Ll=X.prototype,$l="@@observable";Ll[$l]||(Ll[$l]=function(){return this});var Om=Object.prototype.toString;function co(r){return wc(r)}function wc(r,e){switch(Om.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=wc(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=wc(r[i],e)}),n}default:return r}}function Nm(r){var e=new Set([r]);return e.forEach(function(t){ae(t)&&Dm(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){ae(t[n])&&e.add(t[n])})}),r}function Dm(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Wi(r){return __DEV__&&Nm(r),r}function un(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function uo(r,e,t){return new X(function(n){var i=n.next,a=n.error,o=n.complete,s=0,c=!1,u={then:function(f){return new Promise(function(h){return h(f())})}};function l(f,h){return f?function(m){++s;var g=function(){return f(m)};u=u.then(g,g).then(function(S){--s,i&&i.call(n,S),c&&d.complete()},function(S){throw--s,S}).catch(function(S){a&&a.call(n,S)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},p=r.subscribe(d);return function(){return p.unsubscribe()}})}var It=typeof WeakMap=="function"&&qe(function(){return navigator.product})!=="ReactNative",Fl=typeof WeakSet=="function",_c=typeof Symbol=="function"&&typeof Symbol.for=="function",Tr=_c&&Symbol.asyncIterator,Y_=typeof qe(function(){return window.document.createElement})=="function",Z_=qe(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function lo(r){function e(t){Object.defineProperty(r,t,{value:X})}return _c&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Ml(r){return r&&typeof r.then=="function"}var ei=function(r){ke(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),un(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),un(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Ml(c)?c.then(function(u){return n.sub=u.subscribe(n.handlers)}):n.sub=c.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),un(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new X(t)]),Ml(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(X);lo(ei);function kr(r){return"incremental"in r}function Rm(r){return"hasNext"in r&&"data"in r}function jl(r){return kr(r)||Rm(r)}function fo(r,e){var t=r,n=new st;return kr(e)&&$e(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=n.merge(t,a)}),t}function ti(r){var e=po(r);return $e(e)}function po(r){var e=$e(r.errors)?r.errors.slice(0):[];return kr(r)&&$e(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Ar(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}var Ul=new Map;function Gi(r){var e=Ul.get(r)||1;return Ul.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function ql(r){var e=Gi("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(r,e){return Ar(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function ho(r){return new X(function(e){e.error(r)})}var Hi=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function Ec(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw __DEV__?new G("illegal argument: ".concat(i)):new G(27)}return r}function xc(r,e){var t=E({},r),n=function(a){typeof a=="function"?t=E(E({},t),a(t)):t=E(E({},t),a)},i=function(){return E({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function Ic(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Yn(e.query)||void 0:""),e}function Bl(r,e){return e?e(r):X.of()}function Ji(r){return typeof r=="function"?new Tt(r):r}function mo(r){return r.request.length<=1}var Cm=function(r){ke(e,r);function e(t,n){var i=r.call(this,t)||this;return i.link=n,i}return e}(Error),Tt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return X.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ji).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Ji(t),a=Ji(n||new r(Bl));return mo(i)&&mo(a)?new r(function(o){return e(o)?i.request(o)||X.of():a.request(o)||X.of()}):new r(function(o,s){return e(o)?i.request(o,s)||X.of():a.request(o,s)||X.of()})},r.execute=function(e,t){return e.request(xc(t.context,Ic(Ec(t))))||X.of()},r.concat=function(e,t){var n=Ji(e);if(mo(n))return __DEV__&&L.warn(new Cm("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ji(t);return mo(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||X.of()})||X.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||X.of()})||X.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Bl)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new G("request is not implemented"):new G(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var ri=Tt.execute;var Vl="3.7.10";function Ql(r){return!!r.body}function zl(r){return!!r.getReader}function Wl(r){return!!(Tr&&r[Symbol.asyncIterator])}function Gl(r){return!!r.stream}function Kl(r){return!!r.arrayBuffer}function Hl(r){return!!r.pipe}function Tc(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function kc(r){var e=null,t=null,n=!1,i=[],a=[];function o(d){if(!t){if(a.length){var p=a.shift();if(Array.isArray(p)&&p[0])return p[0]({value:d,done:!1})}i.push(d)}}function s(d){t=d;var p=a.slice();p.forEach(function(f){f[1](d)}),!e||e()}function c(){n=!0;var d=a.slice();d.forEach(function(p){p[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,p){if(t)return p(t);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,p])})}var l={next:function(){return u()}};return Tr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Ac(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Tr&&(t[Symbol.asyncIterator]=function(){return this}),t}function go(r){var e={next:function(){return r.read()}};return Tr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Jl(r){var e=r;if(Ql(r)&&(e=r.body),Wl(e))return Tc(e);if(zl(e))return go(e.getReader());if(Gl(e))return go(e.stream().getReader());if(Kl(e))return Ac(e.arrayBuffer());if(Hl(e))return kc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Yl=Object.prototype.hasOwnProperty;function Zl(r,e){var t,n,i;return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h,m,g,S,b,v,y,k,R,T,P;return Pt(this,function($){switch($.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=Jl(r),p=!0,$.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=$.sent(),h=f.value,m=f.done,g=typeof h=="string"?h:a.decode(h),p=!m,l+=g,S=l.indexOf(u);S>-1;){if(b=void 0,P=[l.slice(0,S),l.slice(S+u.length)],b=P[0],l=P[1],b.trim()){if(v=b.indexOf(`\r
|
|
21
|
+
}`)}function Te(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function oo(r){return Te(" ",r.replace(/\n/g,`
|
|
22
|
+
`))}function Yh(r){return r.indexOf(`
|
|
23
|
+
`)!==-1}function Il(r){return r!=null&&r.some(Yh)}function Ui(r){return r.kind===Pe.FIELD||r.kind===Pe.FRAGMENT_SPREAD||r.kind===Pe.INLINE_FRAGMENT}function kl(){return typeof ao=="function"?Xs():Xs()}function sm(){__DEV__?L(typeof tn=="boolean",tn):L(typeof tn=="boolean",39)}kl();sm();function ur(r,e){var t=r.directives;return!t||!t.length?!0:Tl(t).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?L(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Kn(r,e,t){var n=new Set(r),i=n.size;return Ye(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return rn}}),t?!n.size:n.size<i}function nc(r){return r&&Kn(["client","export"],r,!0)}function cm(r){var e=r.name.value;return e==="skip"||e==="include"}function Tl(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!cm(t)){var n=t.arguments,i=t.name.value;__DEV__?L(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):L(n&&n.length===1,41);var a=n[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):L(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function ic(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new G("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new G(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(__DEV__?L(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(n.length===1,45),t=n[0].name.value);var i=E(E({},r),{definitions:Er([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function nn(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function an(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return __DEV__?L(n,"No fragment named ".concat(t)):L(n,46),n||null}default:return null}}function oe(r){return r!==null&&typeof r=="object"}function zt(r){return{__ref:String(r)}}function te(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function ac(r){return oe(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function um(r){return r.kind==="StringValue"}function lm(r){return r.kind==="BooleanValue"}function fm(r){return r.kind==="IntValue"}function pm(r){return r.kind==="FloatValue"}function dm(r){return r.kind==="Variable"}function hm(r){return r.kind==="ObjectValue"}function mm(r){return r.kind==="ListValue"}function gm(r){return r.kind==="EnumValue"}function ym(r){return r.kind==="NullValue"}function Ir(r,e,t,n){if(fm(t)||pm(t))r[e.value]=Number(t.value);else if(lm(t)||um(t))r[e.value]=t.value;else if(hm(t)){var i={};t.fields.map(function(o){return Ir(i,o.name,o.value,n)}),r[e.value]=i}else if(dm(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(mm(t))r[e.value]=t.values.map(function(o){var s={};return Ir(s,e,o,n),s[e.value]});else if(gm(t))r[e.value]=t.value;else if(ym(t))r[e.value]=null;else throw __DEV__?new G('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new G(55)}function oc(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Ir(t[i.name.value],o,s,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,o=i.value;return Ir(n,a,o,e)})),Bi(r.name.value,n,t)}var vm=["connection","include","skip","client","rest","export"],Bi=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(t.connection.key,"(").concat(qi(i),")")}else return t.connection.key;var a=r;if(e){var o=qi(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){vm.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(qi(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=qi;return qi=r,e}}),qi=function(e){return JSON.stringify(e,bm)};function bm(r,e){return oe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function lr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Ir(t,i,a,e)}),t}return null}function xt(r){return r.alias?r.alias.value:r.name.value}function Vi(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(mt(a)){if(a.name.value==="__typename")return r[xt(a)]}else{var o=Vi(r,an(a,t).selectionSet,t);if(typeof o=="string")return o}}}function mt(r){return r.kind==="Field"}function sc(r){return r.kind==="InlineFragment"}function Jn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new G('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new G(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function Wt(r){return Jn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Yn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function on(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Qi(r){var e=Wt(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function cc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function sn(r){Jn(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new G("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new G(54)}function cn(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Ir(e,n.variable.name,n.defaultValue)}),e}var me=Array.isArray;function $e(r){return Array.isArray(r)&&r.length>0}var Al={kind:Pe.FIELD,name:{kind:Pe.NAME,value:"__typename"}};function Nl(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Pe.FRAGMENT_SPREAD&&Nl(e[t.name.value],e)})}function Sm(r){return Nl(Wt(r)||cc(r),nn(on(r)))?null:r}function wm(r){var e=new Set,t=[];return r.forEach(function(n){n.name?e.add(n.name):n.test&&t.push(n.test)}),function(n){return e.has(n.name.value)||t.some(function(i){return i(n)})}}function Ol(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function uc(r,e){for(var t=Ol(""),n=Ol(""),i=function(v){for(var S=0,y=void 0;S<v.length&&(y=v[S]);++S)if(!me(y)){if(y.kind===Pe.OPERATION_DEFINITION)return t(y.name&&y.name.value);if(y.kind===Pe.FRAGMENT_DEFINITION)return n(y.name.value)}return __DEV__&&L.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Pe.OPERATION_DEFINITION&&++a;var s=wm(r),c=r.some(function(v){return v.remove}),u=function(v){return c&&v&&v.some(s)},l=new Map,p=!1,d={enter:function(v){if(u(v.directives))return p=!0,null}},f=Ye(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(v,S,y,k,N){var T=i(N);T&&T.variables.add(v.name.value)}},FragmentSpread:{enter:function(v,S,y,k,N){if(u(v.directives))return p=!0,null;var T=i(N);T&&T.fragmentSpreads.add(v.name.value)}},FragmentDefinition:{enter:function(v,S,y,k){l.set(JSON.stringify(k),v)},leave:function(v,S,y,k){var N=l.get(JSON.stringify(k));if(v===N)return v;if(a>0&&v.selectionSet.selections.every(function(T){return T.kind===Pe.FIELD&&T.name.value==="__typename"}))return n(v.name.value).removed=!0,p=!0,null}},Directive:{leave:function(v){if(s(v))return p=!0,null}}});if(!p)return e;var m=function(v){return v.transitiveVars||(v.transitiveVars=new Set(v.variables),v.removed||v.fragmentSpreads.forEach(function(S){m(n(S)).transitiveVars.forEach(function(y){v.transitiveVars.add(y)})})),v},h=new Set;f.definitions.forEach(function(v){v.kind===Pe.OPERATION_DEFINITION?m(t(v.name&&v.name.value)).fragmentSpreads.forEach(function(S){h.add(S)}):v.kind===Pe.FRAGMENT_DEFINITION&&a===0&&!n(v.name.value).removed&&h.add(v.name.value)}),h.forEach(function(v){m(n(v)).fragmentSpreads.forEach(function(S){h.add(S)})});var g=function(v){return!!(!h.has(v)||n(v).removed)},b={enter:function(v){if(g(v.name.value))return null}};return Sm(Ye(f,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(v){if(v.variableDefinitions){var S=m(t(v.name&&v.name.value)).transitiveVars;if(S.size<v.variableDefinitions.length)return E(E({},v),{variableDefinitions:v.variableDefinitions.filter(function(y){return S.has(y.variable.name.value)})})}}}}))}var un=Object.assign(function(r){return Ye(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Pe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return mt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(mt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Er(Er([],i,!0),[Al],!1)})}}}}}})},{added:function(r){return r===Al}}),_m={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&L.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function lc(r){return uc([_m],Jn(r))}function fc(r){var e=sn(r),t=e.operation;if(t==="query")return r;var n=Ye(r,{OperationDefinition:{enter:function(i){return E(E({},i),{operation:"query"})}}});return n}function pc(r){Jn(r);var e=uc([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Em=Object.prototype.hasOwnProperty;function dc(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return zi(r)}function zi(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new st,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var xm=function(r,e,t){return this.merge(r[t],e[t])},st=function(){function r(e){e===void 0&&(e=xm),this.reconciler=e,this.isObject=oe,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return oe(t)&&oe(e)?(Object.keys(t).forEach(function(o){if(Em.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Er([e,t,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return oe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function Im(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=km(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function km(r,e){if(!!r){if(typeof r=="string")return Dl(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Dl(r,e)}}function Dl(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Rl(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function yc(r,e,t){return e&&Rl(r.prototype,e),t&&Rl(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var vc=function(){return typeof Symbol=="function"},bc=function(r){return vc()&&Boolean(Symbol[r])},Sc=function(r){return bc(r)?Symbol[r]:"@@"+r};vc()&&!bc("observable")&&(Symbol.observable=Symbol("observable"));var Tm=Sc("iterator"),mc=Sc("observable"),Cl=Sc("species");function co(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Wi(r){var e=r.constructor;return e!==void 0&&(e=e[Cl],e===null&&(e=void 0)),e!==void 0?e:ee}function Am(r){return r instanceof ee}function Zn(r){Zn.log?Zn.log(r):setTimeout(function(){throw r})}function so(r){Promise.resolve().then(function(){try{r()}catch(e){Zn(e)}})}function Pl(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=co(e,"unsubscribe");t&&t.call(e)}}catch(n){Zn(n)}}function gc(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Om(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Ll(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Ll(r,e,t){r._state="running";var n=r._observer;try{var i=co(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(gc(r),i)i.call(n,t);else throw t;break;case"complete":gc(r),i&&i.call(n);break}}catch(a){Zn(a)}r._state==="closed"?Pl(r):r._state==="running"&&(r._state="ready")}function hc(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],so(function(){return Om(r)});return}Ll(r,e,t)}}var Nm=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new Dm(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(gc(this),Pl(this))},yc(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Dm=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){hc(this._subscription,"next",n)},e.error=function(n){hc(this._subscription,"error",n)},e.complete=function(){hc(this._subscription,"complete")},yc(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ee=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Nm(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=i.subscribe({next:function(u){try{n(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Wi(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Wi(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Wi(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(p){var d=!s;if(s=!0,!d||o)try{u=n(u,p)}catch(f){return l.error(f)}else u=p},error:function(p){l.error(p)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=Wi(this);return new s(function(c){var u,l=0;function p(d){u=d.subscribe({next:function(f){c.next(f)},error:function(f){c.error(f)},complete:function(){l===a.length?(u=void 0,c.complete()):p(s.from(a[l++]))}})}return p(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Wi(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(d){return o.error(d)}var p=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(p);d>=0&&s.splice(d,1),u()}});s.push(p)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[mc]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=co(n,mc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Am(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(bc("iterator")&&(a=co(n,Tm),a))return new i(function(s){so(function(){if(!s.closed){for(var c=Im(a.call(n)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){so(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){so(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},yc(r,null,[{key:Cl,get:function(){return this}}]),r}();vc()&&Object.defineProperty(ee,Symbol("extensions"),{value:{symbol:mc,hostReportError:Zn},configurable:!0});function wc(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Xn;typeof self<"u"?Xn=self:typeof window<"u"?Xn=window:typeof global<"u"?Xn=global:typeof module<"u"?Xn=module:Xn=Function("return this")();var B_=wc(Xn);var $l=ee.prototype,Fl="@@observable";$l[Fl]||($l[Fl]=function(){return this});var Rm=Object.prototype.toString;function uo(r){return _c(r)}function _c(r,e){switch(Rm.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=_c(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=_c(r[i],e)}),n}default:return r}}function Cm(r){var e=new Set([r]);return e.forEach(function(t){oe(t)&&Pm(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){oe(t[n])&&e.add(t[n])})}),r}function Pm(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Gi(r){return __DEV__&&Cm(r),r}function ln(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function lo(r,e,t){return new ee(function(n){var i=n.next,a=n.error,o=n.complete,s=0,c=!1,u={then:function(f){return new Promise(function(m){return m(f())})}};function l(f,m){return f?function(h){++s;var g=function(){return f(h)};u=u.then(g,g).then(function(b){--s,i&&i.call(n,b),c&&p.complete()},function(b){throw--s,b}).catch(function(b){a&&a.call(n,b)})}:function(h){return m&&m.call(n,h)}}var p={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},d=r.subscribe(p);return function(){return d.unsubscribe()}})}var It=typeof WeakMap=="function"&&qe(function(){return navigator.product})!=="ReactNative",Ml=typeof WeakSet=="function",Ec=typeof Symbol=="function"&&typeof Symbol.for=="function",kr=Ec&&Symbol.asyncIterator,t0=typeof qe(function(){return window.document.createElement})=="function",r0=qe(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function fo(r){function e(t){Object.defineProperty(r,t,{value:ee})}return Ec&&Symbol.species&&e(Symbol.species),e("@@species"),r}function jl(r){return r&&typeof r.then=="function"}var ei=function(r){Ae(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),ln(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),ln(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?jl(c)?c.then(function(u){return n.sub=u.subscribe(n.handlers)}):n.sub=c.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),ln(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new ee(t)]),jl(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(ee);fo(ei);function Tr(r){return"incremental"in r}function Lm(r){return"hasNext"in r&&"data"in r}function Ul(r){return Tr(r)||Lm(r)}function po(r,e){var t=r,n=new st;return Tr(e)&&$e(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=n.merge(t,a)}),t}function ti(r){var e=ho(r);return $e(e)}function ho(r){var e=$e(r.errors)?r.errors.slice(0):[];return Tr(r)&&$e(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Ar(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}var ql=new Map;function Hi(r){var e=ql.get(r)||1;return ql.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Bl(r){var e=Hi("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(r,e){return Ar(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function mo(r){return new ee(function(e){e.error(r)})}var Ji=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function xc(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw __DEV__?new G("illegal argument: ".concat(i)):new G(27)}return r}function Ic(r,e){var t=E({},r),n=function(a){typeof a=="function"?t=E(E({},t),a(t)):t=E(E({},t),a)},i=function(){return E({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function kc(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Yn(e.query)||void 0:""),e}function Vl(r,e){return e?e(r):ee.of()}function Yi(r){return typeof r=="function"?new kt(r):r}function go(r){return r.request.length<=1}var $m=function(r){Ae(e,r);function e(t,n){var i=r.call(this,t)||this;return i.link=n,i}return e}(Error),kt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ee.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Yi).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Yi(t),a=Yi(n||new r(Vl));return go(i)&&go(a)?new r(function(o){return e(o)?i.request(o)||ee.of():a.request(o)||ee.of()}):new r(function(o,s){return e(o)?i.request(o,s)||ee.of():a.request(o,s)||ee.of()})},r.execute=function(e,t){return e.request(Ic(t.context,kc(xc(t))))||ee.of()},r.concat=function(e,t){var n=Yi(e);if(go(n))return __DEV__&&L.warn(new $m("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Yi(t);return go(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||ee.of()})||ee.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||ee.of()})||ee.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Vl)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new G("request is not implemented"):new G(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var ri=kt.execute;var Ql="3.7.10";function zl(r){return!!r.body}function Wl(r){return!!r.getReader}function Gl(r){return!!(kr&&r[Symbol.asyncIterator])}function Hl(r){return!!r.stream}function Kl(r){return!!r.arrayBuffer}function Jl(r){return!!r.pipe}function Tc(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Ac(r){var e=null,t=null,n=!1,i=[],a=[];function o(p){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:p,done:!1})}i.push(p)}}function s(p){t=p;var d=a.slice();d.forEach(function(f){f[1](p)}),!e||e()}function c(){n=!0;var p=a.slice();p.forEach(function(d){d[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(p,d){if(t)return d(t);if(i.length)return p({value:i.shift(),done:!1});if(n)return p({value:void 0,done:!0});a.push([p,d])})}var l={next:function(){return u()}};return kr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Oc(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return kr&&(t[Symbol.asyncIterator]=function(){return this}),t}function yo(r){var e={next:function(){return r.read()}};return kr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Yl(r){var e=r;if(zl(r)&&(e=r.body),Gl(e))return Tc(e);if(Wl(e))return yo(e.getReader());if(Hl(e))return yo(e.stream().getReader());if(Kl(e))return Oc(e.arrayBuffer());if(Jl(e))return Ac(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Zl=Object.prototype.hasOwnProperty;function Xl(r,e){var t,n,i;return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,m,h,g,b,v,S,y,k,N,T,C;return Pt(this,function($){switch($.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",p=Yl(r),d=!0,$.label=1;case 1:return d?[4,p.next()]:[3,3];case 2:for(f=$.sent(),m=f.value,h=f.done,g=typeof m=="string"?m:a.decode(m),d=!h,l+=g,b=l.indexOf(u);b>-1;){if(v=void 0,C=[l.slice(0,b),l.slice(b+u.length)],v=C[0],l=C[1],v.trim()){if(S=v.indexOf(`\r
|
|
25
25
|
\r
|
|
26
|
-
`),y=
|
|
27
|
-
`,"")),(Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T)&&((n=e.next)===null||n===void 0||n.call(e,T))}catch(
|
|
28
|
-
`).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function
|
|
26
|
+
`),y=Fm(v.slice(0,S)),k=y["content-type"],k&&k.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=v.slice(S);try{T=ef(r,N.replace(`\r
|
|
27
|
+
`,"")),(Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T)&&((n=e.next)===null||n===void 0||n.call(e,T))}catch(P){vo(P,e)}}b=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Fm(r){var e={};return r.split(`
|
|
28
|
+
`).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function ef(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ji(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function vo(r,e){var t,n;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(n=e.error)===null||n===void 0||n.call(e,r))}function tf(r,e,t){Mm(e)(r).then(function(n){var i,a;(i=t.next)===null||i===void 0||i.call(t,n),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(n){return vo(n,t)})}function Mm(r){return function(e){return e.text().then(function(t){return ef(e,t)}).then(function(t){return e.status>=300&&Ji(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Zl.call(t,"data")&&!Zl.call(t,"errors")&&Ji(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Zi=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=__DEV__?new G("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new G(24);throw n.parseError=i,n}return t};var jm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Um={accept:"*/*","content-type":"application/json"},qm={method:"POST"},rf={http:jm,headers:Um,options:qm},nf=function(r,e){return e(r)};function af(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(p){i=E(E(E({},i),p.options),{headers:E(E({},i.headers),p.headers)}),p.credentials&&(i.credentials=p.credentials),a=E(E({},a),p.http)}),i.headers&&(i.headers=Bm(i.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,u=r.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,Hn)),{options:i,body:l}}function Bm(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n=Object.create(null);Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var of=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new G(`
|
|
29
29
|
"fetch" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:
|
|
30
30
|
|
|
31
31
|
import fetch from 'cross-fetch';
|
|
@@ -33,7 +33,7 @@ import { ApolloClient, HttpLink } from '@apollo/client';
|
|
|
33
33
|
const client = new ApolloClient({
|
|
34
34
|
link: new HttpLink({ uri: '/graphql', fetch })
|
|
35
35
|
});
|
|
36
|
-
`):new G(23)};var of=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var sf=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function cf(r,e){var t=[],n=function(d,p){t.push("".concat(d,"=").concat(encodeURIComponent(p)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Yi(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Yi(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var uf=qe(function(){return fetch}),lf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?rf:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=Qt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&af(n||uf);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Tt(function(f){var h=sf(f,t),m=f.getContext(),g={};if(m.clientAwareness){var S=m.clientAwareness,b=S.name,v=S.version;b&&(g["apollographql-client-name"]=b),v&&(g["apollographql-client-version"]=v)}var y=E(E({},g),m.headers),k={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:y},R=nf(f,a,tf,p,k),T=R.options,P=R.body;if(P.variables&&!l){var $=new Set(Object.keys(P.variables));Ye(f.query,{Variable:function(ie,Bt,Z){Z&&Z.kind!=="VariableDefinition"&&$.delete(ie.name.value)}}),$.size&&(P.variables=E({},P.variables),$.forEach(function(ie){delete P.variables[ie]}))}var C;if(!T.signal){var I=of(),Ie=I.controller,Le=I.signal;C=Ie,C&&(T.signal=Le)}var Q=function(ie){return ie.kind==="OperationDefinition"&&ie.operation==="mutation"};if(c&&!f.query.definitions.some(Q)&&(T.method="GET"),Hn(["defer"],f.query)&&(T.headers=T.headers||{},T.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),T.method==="GET"){var ge=cf(h,P),ye=ge.newURI,ne=ge.parseError;if(ne)return ho(ne);h=ye}else try{T.body=Yi(P,"Payload")}catch(ie){return ho(ie)}return new X(function(ie){var Bt=n||qe(function(){return fetch})||uf;return Bt(h,T).then(function(Z){var Vt;f.setContext({response:Z});var _r=(Vt=Z.headers)===null||Vt===void 0?void 0:Vt.get("content-type");return _r!==null&&/^multipart\/mixed/i.test(_r)?Zl(Z,ie):ef(Z,f,ie)}).catch(function(Z){return yo(Z,ie)}),function(){C&&C.abort()}})})};var Oc=function(r){ke(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,lf(t).request)||this;return n.options=t,n}return e}(Tt);var{toString:ff,hasOwnProperty:Um}=Object.prototype,pf=Function.prototype.toString,Nc=new Map;function _e(r,e){try{return Dc(r,e)}finally{Nc.clear()}}function Dc(r,e){if(r===e)return!0;let t=ff.call(r),n=ff.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(hf(r,e))return!0;let i=df(r),a=df(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Um.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Dc(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(hf(r,e))return!0;let i=r.entries(),a=t==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Dc(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=pf.call(r);return i!==pf.call(e)?!1:!Vm(i,Bm)}}return!1}function df(r){return Object.keys(r).filter(qm,r)}function qm(r){return this[r]!==void 0}var Bm="{ [native code] }";function Vm(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function hf(r,e){let t=Nc.get(r);if(t){if(t.has(e))return!0}else Nc.set(r,t=new Set);return t.add(e),!1}var Qm=function(){return Object.create(null)},mf=Array.prototype,zm=mf.forEach,Wm=mf.slice,Gt=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Qm),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return zm.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(Wm.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Gm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=t.get(e);return n||t.set(e,n=new r(this.weakness,this.makeData)),n},r}();function Gm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Ge=null,gf={},Km=1,Hm=()=>class{constructor(){this.id=["slot",Km++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ge;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===gf)break;return e!==Ge&&(Ge.slots[this.id]=t),!0}return Ge&&(Ge.slots[this.id]=gf),!1}getValue(){if(this.hasValue())return Ge.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=Ge;Ge={parent:o,slots:a};try{return t.apply(i,n)}finally{Ge=o}}static bind(e){let t=Ge;return function(){let n=Ge;try{return Ge=t,e.apply(this,arguments)}finally{Ge=n}}}static noContext(e,t,n){if(Ge){let i=Ge;try{return Ge=null,e.apply(n,t)}finally{Ge=i}}else return e.apply(n,t)}};function yf(r){try{return r()}catch{}}var Rc="@wry/context:Slot",Jm=yf(()=>globalThis)||yf(()=>global)||Object.create(null),vf=Jm,ni=vf[Rc]||Array[Rc]||function(r){try{Object.defineProperty(vf,Rc,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Hm());var{bind:Ym,noContext:Zm}=ni;function Xm(){}var eg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Xm),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var n=t.older,i=t.newer;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t},r.prototype.set=function(e,t){var n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),bo=new ni,Cc,tg=Object.prototype.hasOwnProperty,Lc=(Cc=Array.from,Cc===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Cc);function vo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Zi=[],rg=100;function ii(r,e){if(!r)throw new Error(e||"assertion failure")}function ng(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Sf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function ig(r){return r.slice(0)}var ag=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Or(this))return bf(this),this.value[0]},r.prototype.recompute=function(e){return ii(!this.recomputing,"already recomputing"),bf(this),Or(this)?og(this,e):Sf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,wf(this),vo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Tf(this),$c(this,function(t,n){t.setDirty(),kf(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Zi.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Lc(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Zi.push(this.deps),this.deps=null)},r.count=0,r}();function bf(r){var e=bo.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Or(r)?Ef(e,r):xf(e,r),e}function og(r,e){return Tf(r),bo.withValue(r,sg,[r,e]),ug(r,e)&&cg(r),Sf(r.value)}function sg(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Or(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function cg(r){r.dirty=!1,!Or(r)&&_f(r)}function wf(r){$c(r,Ef)}function _f(r){$c(r,xf)}function $c(r,e){var t=r.parents.size;if(t)for(var n=Lc(r.parents),i=0;i<t;++i)e(n[i],r)}function Ef(r,e){ii(r.childValues.has(e)),ii(Or(e));var t=!Or(r);if(!r.dirtyChildren)r.dirtyChildren=Zi.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&wf(r)}function xf(r,e){ii(r.childValues.has(e)),ii(!Or(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,ig(e.value)):ng(t,e.value)||r.setDirty(),If(r,e),!Or(r)&&_f(r)}function If(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Zi.length<rg&&Zi.push(t),r.dirtyChildren=null))}function Tf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){kf(r,t)}),r.forgetDeps(),ii(r.dirtyChildren===null)}function kf(r,e){e.parents.delete(r),r.childValues.delete(e),If(r,e)}function ug(r,e){if(typeof r.subscribe=="function")try{vo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var lg={setDirty:!0,dispose:!0,forget:!0};function So(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=bo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(vo(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&tg.call(lg,o)?o:"setDirty";Lc(s).forEach(function(u){return u[c]()}),e.delete(a),vo(s)}},n}function Af(){var r=new Gt(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var CE=Af(),Pc=new Set;function ln(r,e){e===void 0&&(e=Object.create(null));var t=new eg(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Af(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new ag(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Pc.add(t),bo.hasValue()||(Pc.forEach(function(p){return p.clean()}),Pc.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Fc=function(){function r(){this.getFragmentDoc=ln(nc)}return r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Qt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(E(E({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(E(E({},e),{data:a})),a)}})},r}();var Xi=function(r){ke(e,r);function e(t,n,i,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=n,s.query=i,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Ae=Object.prototype.hasOwnProperty;function ea(r){return r==null}function _o(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ea(n)?ea(i)?void 0:{_id:i}:{id:n}),ea(n)&&!ea(i)&&(n=i),!ea(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Of={dataIdFromObject:_o,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Nf(r){return Ar(Of,r)}function Eo(r){var e=r.canonizeResults;return e===void 0?Of.canonizeResults:e}function Df(r,e){return ee(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Mc=/^[_a-z][_0-9a-z]*/i;function Ft(r){var e=r.match(Mc);return e?e[0]:r}function wo(r,e,t){return ae(e)?me(e)?e.every(function(n){return wo(r,n,t)}):r.selections.every(function(n){if(mt(n)&&ur(n,t)){var i=xt(n);return Ae.call(e,i)&&(!n.selectionSet||wo(n.selectionSet,e[i],t))}return!0}):!1}function Nr(r){return ae(r)&&!ee(r)&&!me(r)}function Rf(){return new st}function xo(r,e){var t=rn(an(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Io=Object.create(null),jc=function(){return Io},Cf=Object.create(null),ai=function(){function r(e,t){var n=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Wi(ee(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ee(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zt(i);if(ee(i))return i;var o=n.policies.identify(i)[0];if(o){var s=zt(o);return a&&n.merge(o,i),s}}}return r.prototype.toObject=function(){return E({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Ae.call(this.data,e)){var n=this.data[e];if(n&&Ae.call(n,t))return n[t]}if(t==="__typename"&&Ae.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Dr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Ae.call(this.data,e))return this.data[e];if(this instanceof Dr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;ee(e)&&(e=e.__ref),ee(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof t=="string"?this.lookup(i=t):t;if(!!o){__DEV__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new st(pg).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Ft(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Dr)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return n.group.dirty(i,u)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:Io,INVALIDATE:Cf,isReference:ee,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||zt(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=Ft(u),d=i[u];if(d!==void 0){var p=typeof t=="function"?t:t[u]||t[l];if(p){var f=p===jc?Io:p(Wi(d),E(E({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Cf?n.group.dirty(e,u):(f===Io&&(f=void 0),f!==d&&(a[u]=f,o=!0,d=f))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Dr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&n?this.policies.getStoreFieldName({typename:o,fieldName:t,args:n}):t;return this.modify(e,s?(i={},i[s]=jc,i):jc)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Ae.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Dr&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Ae.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Ae.call(e,a)||t.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Dr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(o){Ae.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Dr;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},r.prototype.findChildRefIds=function(e){if(!Ae.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){ee(a)&&(t[a.__ref]=!0),ae(a)&&Object.keys(a).forEach(function(o){var s=a[o];ae(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Pf=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?So():null,this.keyMaker=new Gt(It)},r.prototype.depend=function(e,t){if(this.d){this.d(Uc(e,t));var n=Ft(t);n!==t&&this.d(Uc(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Uc(e,t),t==="__exists"?"forget":"setDirty")},r}();function Uc(r,e){return e+"#"+r}function qc(r,e){fn(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){ke(n,t);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=t.call(this,a,new Pf(s))||this;return u.stump=new fg(u),u.storageTrie=new Gt(It),c&&u.replace(c),u}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(ai||(ai={}));var Dr=function(r){ke(e,r);function e(t,n,i,a){var o=r.call(this,n.policies,a)||this;return o.id=t,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){_e(o[c],s[c])||n.group.dirty(a,c)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){n.group.dirty(a,c)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Ae.call(this.data,t)?E(E({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(ai),fg=function(r){ke(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Pf(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Dr);function pg(r,e,t){var n=r[t],i=e[t];return _e(n,i)?n:i}function fn(r){return!!(r instanceof ai&&r.group.caching)}function dg(r){return ae(r)?me(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var To=function(){function r(){this.known=new(Fl?WeakSet:Set),this.pool=new Gt(It),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return ae(e)&&this.known.has(e)},r.prototype.pass=function(e){if(ae(e)){var t=dg(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(ae(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(f){c.push(t.admit(e[f]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(f,h){d[f]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();var gt=Object.assign(function(r){if(ae(r)){Bc===void 0&&Lf();var e=Bc.admit(r),t=Vc.get(e);return t===void 0&&Vc.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Lf}),Bc,Vc;function Lf(){Bc=new To,Vc=new(It?WeakMap:Map)}function $f(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Ff=function(){function r(e){var t=this;this.knownResults=new(It?WeakMap:Map),this.config=Ar(e,{addTypename:e.addTypename!==!1,canonizeResults:Eo(e)}),this.canon=e.canon||new To,this.executeSelectionSet=ln(function(n){var i,a=n.context.canonizeResults,o=$f(n);o[3]=!a;var s=(i=t.executeSelectionSet).peek.apply(i,o);return s?a?E(E({},s),{result:t.canon.admit(s.result)}):s:(qc(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:$f,makeCacheKey:function(n,i,a,o){if(fn(a.store))return a.store.makeCacheKey(n,ee(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=ln(function(n){return qc(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(fn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new To},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=E(E({},sn(Vi(n))),o);var p=zt(a),f=this.executeSelectionSet({selectionSet:on(n).selectionSet,objectOrReference:p,enclosingRef:p,context:E({store:t,query:n,policies:d,variables:o,varString:gt(o),canonizeResults:l},xo(n,this.config.fragments))}),h;if(f.missing&&(h=[new Xi(hg(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,n,i){if(fn(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ee(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),d=[],p,f=new st;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(v,y){var k;return v.missing&&(p=f.merge(p,(k={},k[y]=v.missing,k))),v.result}var m=new Set(n.selections);m.forEach(function(v){var y,k;if(!!ur(v,s))if(mt(v)){var R=c.readField({fieldName:v.name.value,field:v,variables:o.variables,from:i},o),T=xt(v);R===void 0?cn.added(v)||(p=f.merge(p,(y={},y[T]="Can't find field '".concat(v.name.value,"' on ").concat(ee(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):me(R)?R=h(t.executeSubSelectedArray({field:v,array:R,enclosingRef:a,context:o}),T):v.selectionSet?R!=null&&(R=h(t.executeSelectionSet({selectionSet:v.selectionSet,objectOrReference:R,enclosingRef:ee(R)?R:a,context:o}),T)):o.canonizeResults&&(R=t.canon.pass(R)),R!==void 0&&d.push((k={},k[T]=R,k))}else{var P=nn(v,o.lookupFragment);if(!P&&v.kind===Ce.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(v.name.value)):new G(5);P&&c.fragmentMatches(P,l)&&P.selectionSet.selections.forEach(m.add,m)}});var g=Qi(d),S={result:g,missing:p},b=o.canonizeResults?this.canon.admit(S):Wi(S);return b.result&&this.knownResults.set(b.result,n),b},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new st;function u(l,d){var p;return l.missing&&(s=c.merge(s,(p={},p[d]=l.missing,p))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:me(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ee(l)?l:a,context:o}),d):(__DEV__&&mg(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function hg(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function mg(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){ae(i)&&(__DEV__?L(!ee(i),"Missing selection set for object of type ".concat(Df(r,i)," returned for query field ").concat(e.name.value)):L(!ee(i),6),Object.values(i).forEach(n.add,n))})}}var oi=new ni,Mf=new WeakMap;function ta(r){var e=Mf.get(r);return e||Mf.set(r,e={vars:new Set,dep:So()}),e}function Qc(r){ta(r).vars.forEach(function(e){return e.forgetCache(r)})}function jf(r){ta(r).vars.forEach(function(e){return e.attachCache(r)})}function ko(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ta(c).dep.dirty(n),gg(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=oi.getValue();s&&(i(s),ta(s).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),ta(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function gg(r){r.broadcastWatches&&r.broadcastWatches()}var Uf=Object.create(null);function zc(r){var e=JSON.stringify(r);return Uf[e]||(Uf[e]=Object.create(null))}function Wc(r){var e=zc(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Kc(r,function(o){var s=si(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&Ae.call(t,o[0])&&(s=si(t,o,Bf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Gc(r){var e=zc(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Kc(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&$e(i.directives)){var p=l.slice(1),f=i.directives.find(function(S){return S.name.value===p}),h=f&&lr(f,a);return h&&si(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Ae.call(a,m)){var g=u.slice(0);return g[0]=m,si(a,g)}return}if(t)return si(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Kc(r,e){var t=new st;return qf(r).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=t.merge(n,o)}return n},Object.create(null))}function qf(r){var e=zc(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){me(i)?(qf(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),me(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Bf(r,e){return r[e]}function si(r,e,t){return t=t||Bf,Vf(e.reduce(function n(i,a){return me(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function Vf(r){return ae(r)?me(r)?r.map(Vf):Kc(Object.keys(r).sort(),function(e){return si(r,e)}):r}qi.setStringify(gt);function Hc(r){return r.args!==void 0?r.args:r.field?lr(r.field,r.variables):null}var yg=function(){},Qf=function(r,e){return e.fieldName},zf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Wf=function(r,e){return e},Kf=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=E({dataIdFromObject:_o},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=E(E({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var p=Ao(arguments,o);return i.readField(p,{store:i.cache.data,variables:p.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(me(d))l=Wc(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=Qt(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),o&&t.setRootTypename("Mutation",n),s&&t.setRootTypename("Subscription",n),Ae.call(t.toBeAdded,n)?t.toBeAdded[n].push(c):t.toBeAdded[n]=[c]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?zf:u===!1?Wf:c.merge}s(i,t.merge),i.keyFn=a===!1?yg:me(a)?Wc(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,p=l.read,f=l.merge;u.keyFn=d===!1?Qf:me(d)?Gc(d):typeof d=="function"?d:u.keyFn,typeof p=="function"&&(u.read=p),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Qf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(__DEV__?L(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):L(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match(Mc);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Ae.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=Qt(s,["fields"]);Object.assign(n,u),Object.assign(n.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(n&&this.fuzzySubtypes.size),d=!1,p=0;p<c.length;++p){var f=c[p];if(f.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&p===c.length-1&&wo(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var g=t.match(h);g&&g[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,o=i&&i.keyFn;if(o&&t)for(var s={typename:t,fieldName:n,field:e.field||null,variables:e.variables},c=Hc(e);o;){var u=o(c,s);if(me(u))o=Gc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?ac(e.field,e.variables):qi(n,Hc(e))),a===!1?n:n===Ft(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Ft(o),c=t.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=Gf(this,n,e,t,t.store.getStorage(ee(n)?n.__ref:n,o));return oi.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===zf?Hf(i.store)(e,t):c===Wf?t:(i.overwrite&&(e=void 0),c(e,t,Gf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function Gf(r,e,t,n,i){var a=r.getStoreFieldName(t),o=Ft(a),s=t.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Hc(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ee,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(Ao(arguments,e,s),n)},mergeObjects:Hf(n.store)}}function Ao(r,e,t){var n=r[0],i=r[1],a=r.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=E({},n),Ae.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(ql(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Hf(r){return function(t,n){if(me(t)||me(n))throw __DEV__?new G("Cannot automatically merge arrays"):new G(4);if(ae(t)&&ae(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ee(t)&&Nr(n))return r.merge(t.__ref,n),t;if(Nr(t)&&ee(n))return r.merge(t,n.__ref),n;if(Nr(t)&&Nr(n))return E(E({},t),n)}return n}}function Jc(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:E(E({},r),{clientOnly:e,deferred:t})),i}var Xf=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=Wt(i),l=Rf();s=E(E({},sn(u)),s);var d=E(E({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:gt(s)},xo(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),p=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!ee(p))throw __DEV__?new G("Could not identify object ".concat(JSON.stringify(a))):new G(7);return d.incomingById.forEach(function(f,h){var m=f.storeObject,g=f.mergeTree,S=f.fieldNodeSet,b=zt(h);if(g&&g.map.size){var v=n.applyMerges(g,b,m,d);if(ee(v))return;m=v}if(__DEV__&&!d.overwrite){var y=Object.create(null);S.forEach(function(T){T.selectionSet&&(y[T.name.value]=!0)});var k=function(T){return y[Ft(T)]===!0},R=function(T){var P=g&&g.map.get(T);return Boolean(P&&P.info&&P.info.merge)};Object.keys(m).forEach(function(T){k(T)&&!R(T)&&vg(b,m,T,d.store)})}e.merge(h,m)}),e.retain(p.__ref),p},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Bi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var v=Ao(arguments,u,o.variables);if(ee(v.from)){var y=o.incomingById.get(v.from.__ref);if(y){var k=c.readField(E(E({},v),{from:y.storeObject}),o);if(k!==void 0)return k}}return c.readField(v,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(v,y){var k,R=xt(y),T=i[R];if(p.add(y),T!==void 0){var P=c.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:v.variables}),$=Jf(s,P),C=t.processFieldValue(T,y,y.selectionSet?Jc(v,!1,!1):v,$),I=void 0;y.selectionSet&&(ee(C)||Nr(C))&&(I=d("__typename",C));var Ie=c.getMergeFunction(l,y.name.value,I);Ie?$.info={field:y,typename:l,merge:Ie}:Yf(s,P),u=v.merge(u,(k={},k[P]=C,k))}else __DEV__&&!v.clientOnly&&!v.deferred&&!cn.added(y)&&!c.getReadFunction(l,y.name.value)&&__DEV__&&L.error("Missing field '".concat(xt(y),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=f[0],m=f[1];n=n||h,m&&(u=o.merge(u,m))}catch(v){if(!n)throw v}if(typeof n=="string"){var g=zt(n),S=o.written[n]||(o.written[n]=[]);if(S.indexOf(a)>=0||(S.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var b=o.incomingById.get(n);return b?(b.storeObject=o.merge(b.storeObject,u),b.mergeTree=Yc(b.mergeTree,s),p.forEach(function(v){return b.fieldNodeSet.add(v)})):o.incomingById.set(n,{storeObject:u,mergeTree:Oo(s)?void 0:s,fieldNodeSet:p}),g}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?co(e):e:me(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,Jf(i,s));return Yf(i,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=Bi(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(p){if(!!ur(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&$e(p.directives)&&p.directives.forEach(function(S){var b=S.name.value;if(b==="client"&&(f=!0),b==="defer"){var v=lr(S,n.variables);(!v||v.if!==!1)&&(h=!0)}}),mt(p)){var m=a.get(p);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(p,Jc(n,f,h))}else{var g=nn(p,n.lookupFragment);if(!g&&p.kind===Ce.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(p.name.value)):new G(8);g&&o.fragmentMatches(g,i,t,n.variables)&&c(g.selectionSet,Jc(n,f,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!ee(n)){var c=!me(n)&&(ee(t)||Nr(t))?t:void 0,u=n;c&&!a&&(a=[ee(c)?c.__ref:c]);var l,d=function(p,f){return me(p)?typeof f=="number"?p[f]:void 0:i.store.getFieldValue(p,String(f))};e.map.forEach(function(p,f){var h=d(c,f),m=d(u,f);if(m!==void 0){a&&a.push(f);var g=s.applyMerges(p,h,m,i,a);g!==m&&(l=l||new Map,l.set(f,g)),a&&L(a.pop()===f)}}),l&&(n=me(u)?u.slice(0):E({},u),l.forEach(function(p,f){n[f]=p}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var ep=[];function Jf(r,e){var t=r.map;return t.has(e)||t.set(e,ep.pop()||{map:new Map}),t.get(e)}function Yc(r,e){if(r===e||!e||Oo(e))return r;if(!r||Oo(r))return e;var t=r.info&&e.info?E(E({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Yc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Yc(e.map.get(s),r.map.get(s)))})}return a}function Oo(r){return!r||!(r.info||r.map.size)}function Yf(r,e){var t=r.map,n=t.get(e);n&&Oo(n)&&(ep.push(n),t.delete(e))}var Zf=new Set;function vg(r,e,t,n){var i=function(d){var p=n.getFieldValue(d,t);return typeof p=="object"&&p},a=i(r);if(!!a){var o=i(e);if(!!o&&!ee(a)&&!_e(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=Ft(t),u="".concat(s,".").concat(c);if(!Zf.has(u)){Zf.add(u);var l=[];!me(a)&&!me(o)&&[a,o].forEach(function(d){var p=n.getFieldValue(d,"__typename");typeof p=="string"&&!l.includes(p)&&l.push(p)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
36
|
+
`):new G(23)};var sf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var cf=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function uf(r,e){var t=[],n=function(p,d){t.push("".concat(p,"=").concat(encodeURIComponent(d)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Zi(e.variables,"Variables map")}catch(p){return{parseError:p}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Zi(e.extensions,"Extensions map")}catch(p){return{parseError:p}}n("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var lf=qe(function(){return fetch}),ff=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?nf:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,p=Qt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&of(n||lf);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new kt(function(f){var m=cf(f,t),h=f.getContext(),g={};if(h.clientAwareness){var b=h.clientAwareness,v=b.name,S=b.version;v&&(g["apollographql-client-name"]=v),S&&(g["apollographql-client-version"]=S)}var y=E(E({},g),h.headers),k={http:h.http,options:h.fetchOptions,credentials:h.credentials,headers:y},N=af(f,a,rf,d,k),T=N.options,C=N.body;if(C.variables&&!l){var $=new Set(Object.keys(C.variables));Ye(f.query,{Variable:function(ae,Bt,X){X&&X.kind!=="VariableDefinition"&&$.delete(ae.name.value)}}),$.size&&(C.variables=E({},C.variables),$.forEach(function(ae){delete C.variables[ae]}))}var P;if(!T.signal){var M=sf(),we=M.controller,ke=M.signal;P=we,P&&(T.signal=ke)}var I=function(ae){return ae.kind==="OperationDefinition"&&ae.operation==="mutation"};if(c&&!f.query.definitions.some(I)&&(T.method="GET"),Kn(["defer"],f.query)&&(T.headers=T.headers||{},T.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),T.method==="GET"){var ge=uf(m,C),ye=ge.newURI,ie=ge.parseError;if(ie)return mo(ie);m=ye}else try{T.body=Zi(C,"Payload")}catch(ae){return mo(ae)}return new ee(function(ae){var Bt=n||qe(function(){return fetch})||lf;return Bt(m,T).then(function(X){var Vt;f.setContext({response:X});var _r=(Vt=X.headers)===null||Vt===void 0?void 0:Vt.get("content-type");return _r!==null&&/^multipart\/mixed/i.test(_r)?Xl(X,ae):tf(X,f,ae)}).catch(function(X){return vo(X,ae)}),function(){P&&P.abort()}})})};var Nc=function(r){Ae(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,ff(t).request)||this;return n.options=t,n}return e}(kt);var{toString:pf,hasOwnProperty:Vm}=Object.prototype,df=Function.prototype.toString,Dc=new Map;function Ee(r,e){try{return Rc(r,e)}finally{Dc.clear()}}function Rc(r,e){if(r===e)return!0;let t=pf.call(r),n=pf.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(mf(r,e))return!0;let i=hf(r),a=hf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Vm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Rc(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(mf(r,e))return!0;let i=r.entries(),a=t==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Rc(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=df.call(r);return i!==df.call(e)?!1:!Wm(i,zm)}}return!1}function hf(r){return Object.keys(r).filter(Qm,r)}function Qm(r){return this[r]!==void 0}var zm="{ [native code] }";function Wm(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function mf(r,e){let t=Dc.get(r);if(t){if(t.has(e))return!0}else Dc.set(r,t=new Set);return t.add(e),!1}var Gm=function(){return Object.create(null)},gf=Array.prototype,Hm=gf.forEach,Km=gf.slice,Gt=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Gm),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return Hm.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(Km.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Jm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=t.get(e);return n||t.set(e,n=new r(this.weakness,this.makeData)),n},r}();function Jm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Ge=null,yf={},Ym=1,Zm=()=>class{constructor(){this.id=["slot",Ym++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ge;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===yf)break;return e!==Ge&&(Ge.slots[this.id]=t),!0}return Ge&&(Ge.slots[this.id]=yf),!1}getValue(){if(this.hasValue())return Ge.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=Ge;Ge={parent:o,slots:a};try{return t.apply(i,n)}finally{Ge=o}}static bind(e){let t=Ge;return function(){let n=Ge;try{return Ge=t,e.apply(this,arguments)}finally{Ge=n}}}static noContext(e,t,n){if(Ge){let i=Ge;try{return Ge=null,e.apply(n,t)}finally{Ge=i}}else return e.apply(n,t)}};function vf(r){try{return r()}catch{}}var Cc="@wry/context:Slot",Xm=vf(()=>globalThis)||vf(()=>global)||Object.create(null),bf=Xm,ni=bf[Cc]||Array[Cc]||function(r){try{Object.defineProperty(bf,Cc,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Zm());var{bind:eg,noContext:tg}=ni;function rg(){}var ng=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=rg),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var n=t.older,i=t.newer;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t},r.prototype.set=function(e,t){var n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),So=new ni,Pc,ig=Object.prototype.hasOwnProperty,$c=(Pc=Array.from,Pc===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Pc);function bo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Xi=[],ag=100;function ii(r,e){if(!r)throw new Error(e||"assertion failure")}function og(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function wf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function sg(r){return r.slice(0)}var cg=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Or(this))return Sf(this),this.value[0]},r.prototype.recompute=function(e){return ii(!this.recomputing,"already recomputing"),Sf(this),Or(this)?ug(this,e):wf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,_f(this),bo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Tf(this),Fc(this,function(t,n){t.setDirty(),Af(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Xi.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&($c(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Xi.push(this.deps),this.deps=null)},r.count=0,r}();function Sf(r){var e=So.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Or(r)?xf(e,r):If(e,r),e}function ug(r,e){return Tf(r),So.withValue(r,lg,[r,e]),pg(r,e)&&fg(r),wf(r.value)}function lg(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Or(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function fg(r){r.dirty=!1,!Or(r)&&Ef(r)}function _f(r){Fc(r,xf)}function Ef(r){Fc(r,If)}function Fc(r,e){var t=r.parents.size;if(t)for(var n=$c(r.parents),i=0;i<t;++i)e(n[i],r)}function xf(r,e){ii(r.childValues.has(e)),ii(Or(e));var t=!Or(r);if(!r.dirtyChildren)r.dirtyChildren=Xi.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&_f(r)}function If(r,e){ii(r.childValues.has(e)),ii(!Or(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,sg(e.value)):og(t,e.value)||r.setDirty(),kf(r,e),!Or(r)&&Ef(r)}function kf(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Xi.length<ag&&Xi.push(t),r.dirtyChildren=null))}function Tf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Af(r,t)}),r.forgetDeps(),ii(r.dirtyChildren===null)}function Af(r,e){e.parents.delete(r),r.childValues.delete(e),kf(r,e)}function pg(r,e){if(typeof r.subscribe=="function")try{bo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var dg={setDirty:!0,dispose:!0,forget:!0};function wo(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=So.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(bo(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&ig.call(dg,o)?o:"setDirty";$c(s).forEach(function(u){return u[c]()}),e.delete(a),bo(s)}},n}function Of(){var r=new Gt(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var FE=Of(),Lc=new Set;function fn(r,e){e===void 0&&(e=Object.create(null));var t=new ng(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Of(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new cg(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var p=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Lc.add(t),So.hasValue()||(Lc.forEach(function(d){return d.clean()}),Lc.clear()),p};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Mc=function(){function r(){this.getFragmentDoc=fn(ic)}return r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Qt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(E(E({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(E(E({},e),{data:a})),a)}})},r}();var ea=function(r){Ae(e,r);function e(t,n,i,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=n,s.query=i,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Oe=Object.prototype.hasOwnProperty;function ta(r){return r==null}function Eo(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ta(n)?ta(i)?void 0:{_id:i}:{id:n}),ta(n)&&!ta(i)&&(n=i),!ta(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Nf={dataIdFromObject:Eo,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Df(r){return Ar(Nf,r)}function xo(r){var e=r.canonizeResults;return e===void 0?Nf.canonizeResults:e}function Rf(r,e){return te(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var jc=/^[_a-z][_0-9a-z]*/i;function Ft(r){var e=r.match(jc);return e?e[0]:r}function _o(r,e,t){return oe(e)?me(e)?e.every(function(n){return _o(r,n,t)}):r.selections.every(function(n){if(mt(n)&&ur(n,t)){var i=xt(n);return Oe.call(e,i)&&(!n.selectionSet||_o(n.selectionSet,e[i],t))}return!0}):!1}function Nr(r){return oe(r)&&!te(r)&&!me(r)}function Cf(){return new st}function Io(r,e){var t=nn(on(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var ko=Object.create(null),Uc=function(){return ko},Pf=Object.create(null),ai=function(){function r(e,t){var n=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Gi(te(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return te(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zt(i);if(te(i))return i;var o=n.policies.identify(i)[0];if(o){var s=zt(o);return a&&n.merge(o,i),s}}}return r.prototype.toObject=function(){return E({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Oe.call(this.data,e)){var n=this.data[e];if(n&&Oe.call(n,t))return n[t]}if(t==="__typename"&&Oe.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Dr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Oe.call(this.data,e))return this.data[e];if(this instanceof Dr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;te(e)&&(e=e.__ref),te(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof t=="string"?this.lookup(i=t):t;if(!!o){__DEV__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new st(mg).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Ft(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Dr)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return n.group.dirty(i,u)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:ko,INVALIDATE:Pf,isReference:te,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||zt(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=Ft(u),p=i[u];if(p!==void 0){var d=typeof t=="function"?t:t[u]||t[l];if(d){var f=d===Uc?ko:d(Gi(p),E(E({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Pf?n.group.dirty(e,u):(f===ko&&(f=void 0),f!==p&&(a[u]=f,o=!0,p=f))}p!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Dr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&n?this.policies.getStoreFieldName({typename:o,fieldName:t,args:n}):t;return this.modify(e,s?(i={},i[s]=Uc,i):Uc)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Oe.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Dr&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Oe.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Oe.call(e,a)||t.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Dr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(o){Oe.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Dr;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},r.prototype.findChildRefIds=function(e){if(!Oe.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){te(a)&&(t[a.__ref]=!0),oe(a)&&Object.keys(a).forEach(function(o){var s=a[o];oe(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Lf=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?wo():null,this.keyMaker=new Gt(It)},r.prototype.depend=function(e,t){if(this.d){this.d(qc(e,t));var n=Ft(t);n!==t&&this.d(qc(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(qc(e,t),t==="__exists"?"forget":"setDirty")},r}();function qc(r,e){return e+"#"+r}function Bc(r,e){pn(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Ae(n,t);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=t.call(this,a,new Lf(s))||this;return u.stump=new hg(u),u.storageTrie=new Gt(It),c&&u.replace(c),u}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(ai||(ai={}));var Dr=function(r){Ae(e,r);function e(t,n,i,a){var o=r.call(this,n.policies,a)||this;return o.id=t,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ee(o[c],s[c])||n.group.dirty(a,c)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){n.group.dirty(a,c)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return Oe.call(this.data,t)?E(E({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(ai),hg=function(r){Ae(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Lf(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Dr);function mg(r,e,t){var n=r[t],i=e[t];return Ee(n,i)?n:i}function pn(r){return!!(r instanceof ai&&r.group.caching)}function gg(r){return oe(r)?me(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var To=function(){function r(){this.known=new(Ml?WeakSet:Set),this.pool=new Gt(It),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return oe(e)&&this.known.has(e)},r.prototype.pass=function(e){if(oe(e)){var t=gg(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(oe(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(f){c.push(t.admit(e[f]))});var o=this.pool.lookupArray(c);if(!o.object){var p=o.object=Object.create(s);this.known.add(p),u.sorted.forEach(function(f,m){p[f]=c[l+m]}),__DEV__&&Object.freeze(p)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();var gt=Object.assign(function(r){if(oe(r)){Vc===void 0&&$f();var e=Vc.admit(r),t=Qc.get(e);return t===void 0&&Qc.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:$f}),Vc,Qc;function $f(){Vc=new To,Qc=new(It?WeakMap:Map)}function Ff(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Mf=function(){function r(e){var t=this;this.knownResults=new(It?WeakMap:Map),this.config=Ar(e,{addTypename:e.addTypename!==!1,canonizeResults:xo(e)}),this.canon=e.canon||new To,this.executeSelectionSet=fn(function(n){var i,a=n.context.canonizeResults,o=Ff(n);o[3]=!a;var s=(i=t.executeSelectionSet).peek.apply(i,o);return s?a?E(E({},s),{result:t.canon.admit(s.result)}):s:(Bc(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Ff,makeCacheKey:function(n,i,a,o){if(pn(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=fn(function(n){return Bc(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(pn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new To},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,p=this.config.cache.policies;o=E(E({},cn(Qi(n))),o);var d=zt(a),f=this.executeSelectionSet({selectionSet:sn(n).selectionSet,objectOrReference:d,enclosingRef:d,context:E({store:t,query:n,policies:p,variables:o,varString:gt(o),canonizeResults:l},Io(n,this.config.fragments))}),m;if(f.missing&&(m=[new ea(yg(f.missing),f.missing,n,o)],!c))throw m[0];return{result:f.result,complete:!m,missing:m}},r.prototype.isFresh=function(e,t,n,i){if(pn(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(te(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),p=[],d,f=new st;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&p.push({__typename:l});function m(S,y){var k;return S.missing&&(d=f.merge(d,(k={},k[y]=S.missing,k))),S.result}var h=new Set(n.selections);h.forEach(function(S){var y,k;if(!!ur(S,s))if(mt(S)){var N=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),T=xt(S);N===void 0?un.added(S)||(d=f.merge(d,(y={},y[T]="Can't find field '".concat(S.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):me(N)?N=m(t.executeSubSelectedArray({field:S,array:N,enclosingRef:a,context:o}),T):S.selectionSet?N!=null&&(N=m(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:N,enclosingRef:te(N)?N:a,context:o}),T)):o.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&p.push((k={},k[T]=N,k))}else{var C=an(S,o.lookupFragment);if(!C&&S.kind===Pe.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(S.name.value)):new G(5);C&&c.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(h.add,h)}});var g=zi(p),b={result:g,missing:d},v=o.canonizeResults?this.canon.admit(b):Gi(b);return v.result&&this.knownResults.set(v.result,n),v},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new st;function u(l,p){var d;return l.missing&&(s=c.merge(s,(d={},d[p]=l.missing,d))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,p){return l===null?null:me(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),p):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),p):(__DEV__&&vg(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function yg(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function vg(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){oe(i)&&(__DEV__?L(!te(i),"Missing selection set for object of type ".concat(Rf(r,i)," returned for query field ").concat(e.name.value)):L(!te(i),6),Object.values(i).forEach(n.add,n))})}}var oi=new ni,jf=new WeakMap;function ra(r){var e=jf.get(r);return e||jf.set(r,e={vars:new Set,dep:wo()}),e}function zc(r){ra(r).vars.forEach(function(e){return e.forgetCache(r)})}function Uf(r){ra(r).vars.forEach(function(e){return e.attachCache(r)})}function Ao(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ra(c).dep.dirty(n),bg(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=oi.getValue();s&&(i(s),ra(s).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),ra(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function bg(r){r.broadcastWatches&&r.broadcastWatches()}var qf=Object.create(null);function Wc(r){var e=JSON.stringify(r);return qf[e]||(qf[e]=Object.create(null))}function Gc(r){var e=Wc(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Kc(r,function(o){var s=si(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&Oe.call(t,o[0])&&(s=si(t,o,Vf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Hc(r){var e=Wc(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Kc(r,function(u){var l=u[0],p=l.charAt(0);if(p==="@"){if(i&&$e(i.directives)){var d=l.slice(1),f=i.directives.find(function(b){return b.name.value===d}),m=f&&lr(f,a);return m&&si(m,u.slice(1))}return}if(p==="$"){var h=l.slice(1);if(a&&Oe.call(a,h)){var g=u.slice(0);return g[0]=h,si(a,g)}return}if(t)return si(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Kc(r,e){var t=new st;return Bf(r).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=t.merge(n,o)}return n},Object.create(null))}function Bf(r){var e=Wc(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){me(i)?(Bf(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),me(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Vf(r,e){return r[e]}function si(r,e,t){return t=t||Vf,Qf(e.reduce(function n(i,a){return me(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function Qf(r){return oe(r)?me(r)?r.map(Qf):Kc(Object.keys(r).sort(),function(e){return si(r,e)}):r}Bi.setStringify(gt);function Jc(r){return r.args!==void 0?r.args:r.field?lr(r.field,r.variables):null}var Sg=function(){},zf=function(r,e){return e.fieldName},Wf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Gf=function(r,e){return e},Kf=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=E({dataIdFromObject:Eo},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=E(E({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var d=Oo(arguments,o);return i.readField(d,{store:i.cache.data,variables:d.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var p=l(e,s);if(me(p))l=Gc(p);else{c=p;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=Qt(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),o&&t.setRootTypename("Mutation",n),s&&t.setRootTypename("Subscription",n),Oe.call(t.toBeAdded,n)?t.toBeAdded[n].push(c):t.toBeAdded[n]=[c]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Wf:u===!1?Gf:c.merge}s(i,t.merge),i.keyFn=a===!1?Sg:me(a)?Gc(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var p=l.keyArgs,d=l.read,f=l.merge;u.keyFn=p===!1?zf:me(p)?Hc(p):typeof p=="function"?p:u.keyFn,typeof d=="function"&&(u.read=d),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||zf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(__DEV__?L(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):L(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match(jc);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Oe.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=Qt(s,["fields"]);Object.assign(n,u),Object.assign(n.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(m){var h=a.getSupertypeSet(m,!1);h&&h.size&&c.indexOf(h)<0&&c.push(h)},l=!!(n&&this.fuzzySubtypes.size),p=!1,d=0;d<c.length;++d){var f=c[d];if(f.has(o))return s.has(o)||(p&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&d===c.length-1&&_o(e.selectionSet,n,i)&&(l=!1,p=!0,this.fuzzySubtypes.forEach(function(m,h){var g=t.match(m);g&&g[0]===t&&u(h)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,o=i&&i.keyFn;if(o&&t)for(var s={typename:t,fieldName:n,field:e.field||null,variables:e.variables},c=Jc(e);o;){var u=o(c,s);if(me(u))o=Hc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?oc(e.field,e.variables):Bi(n,Jc(e))),a===!1?n:n===Ft(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Ft(o),c=t.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var p=Hf(this,n,e,t,t.store.getStorage(te(n)?n.__ref:n,o));return oi.withValue(this.cache,l,[c,p])}return c}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===Wf?Jf(i.store)(e,t):c===Gf?t:(i.overwrite&&(e=void 0),c(e,t,Hf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function Hf(r,e,t,n,i){var a=r.getStoreFieldName(t),o=Ft(a),s=t.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Jc(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(Oo(arguments,e,s),n)},mergeObjects:Jf(n.store)}}function Oo(r,e,t){var n=r[0],i=r[1],a=r.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=E({},n),Oe.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Bl(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Jf(r){return function(t,n){if(me(t)||me(n))throw __DEV__?new G("Cannot automatically merge arrays"):new G(4);if(oe(t)&&oe(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(te(t)&&Nr(n))return r.merge(t.__ref,n),t;if(Nr(t)&&te(n))return r.merge(t,n.__ref),n;if(Nr(t)&&Nr(n))return E(E({},t),n)}return n}}function Yc(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:E(E({},r),{clientOnly:e,deferred:t})),i}var ep=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=Wt(i),l=Cf();s=E(E({},cn(u)),s);var p=E(E({store:e,written:Object.create(null),merge:function(f,m){return l.merge(f,m)},variables:s,varString:gt(s)},Io(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:p});if(!te(d))throw __DEV__?new G("Could not identify object ".concat(JSON.stringify(a))):new G(7);return p.incomingById.forEach(function(f,m){var h=f.storeObject,g=f.mergeTree,b=f.fieldNodeSet,v=zt(m);if(g&&g.map.size){var S=n.applyMerges(g,v,h,p);if(te(S))return;h=S}if(__DEV__&&!p.overwrite){var y=Object.create(null);b.forEach(function(T){T.selectionSet&&(y[T.name.value]=!0)});var k=function(T){return y[Ft(T)]===!0},N=function(T){var C=g&&g.map.get(T);return Boolean(C&&C.info&&C.info.merge)};Object.keys(h).forEach(function(T){k(T)&&!N(T)&&wg(v,h,T,p.store)})}e.merge(m,h)}),e.retain(d.__ref),d},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Vi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var p=function(){var S=Oo(arguments,u,o.variables);if(te(S.from)){var y=o.incomingById.get(S.from.__ref);if(y){var k=c.readField(E(E({},S),{from:y.storeObject}),o);if(k!==void 0)return k}}return c.readField(S,o)},d=new Set;this.flattenFields(a,i,o,l).forEach(function(S,y){var k,N=xt(y),T=i[N];if(d.add(y),T!==void 0){var C=c.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:S.variables}),$=Yf(s,C),P=t.processFieldValue(T,y,y.selectionSet?Yc(S,!1,!1):S,$),M=void 0;y.selectionSet&&(te(P)||Nr(P))&&(M=p("__typename",P));var we=c.getMergeFunction(l,y.name.value,M);we?$.info={field:y,typename:l,merge:we}:Zf(s,C),u=S.merge(u,(k={},k[C]=P,k))}else __DEV__&&!S.clientOnly&&!S.deferred&&!un.added(y)&&!c.getReadFunction(l,y.name.value)&&__DEV__&&L.error("Missing field '".concat(xt(y),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:p}),m=f[0],h=f[1];n=n||m,h&&(u=o.merge(u,h))}catch(S){if(!n)throw S}if(typeof n=="string"){var g=zt(n),b=o.written[n]||(o.written[n]=[]);if(b.indexOf(a)>=0||(b.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var v=o.incomingById.get(n);return v?(v.storeObject=o.merge(v.storeObject,u),v.mergeTree=Zc(v.mergeTree,s),d.forEach(function(S){return v.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:u,mergeTree:No(s)?void 0:s,fieldNodeSet:d}),g}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?uo(e):e:me(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,Yf(i,s));return Zf(i,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=Vi(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!1);return function c(u,l){var p=s.lookup(u,l.clientOnly,l.deferred);p.visited||(p.visited=!0,u.selections.forEach(function(d){if(!!ur(d,n.variables)){var f=l.clientOnly,m=l.deferred;if(!(f&&m)&&$e(d.directives)&&d.directives.forEach(function(b){var v=b.name.value;if(v==="client"&&(f=!0),v==="defer"){var S=lr(b,n.variables);(!S||S.if!==!1)&&(m=!0)}}),mt(d)){var h=a.get(d);h&&(f=f&&h.clientOnly,m=m&&h.deferred),a.set(d,Yc(n,f,m))}else{var g=an(d,n.lookupFragment);if(!g&&d.kind===Pe.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(d.name.value)):new G(8);g&&o.fragmentMatches(g,i,t,n.variables)&&c(g.selectionSet,Yc(n,f,m))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var c=!me(n)&&(te(t)||Nr(t))?t:void 0,u=n;c&&!a&&(a=[te(c)?c.__ref:c]);var l,p=function(d,f){return me(d)?typeof f=="number"?d[f]:void 0:i.store.getFieldValue(d,String(f))};e.map.forEach(function(d,f){var m=p(c,f),h=p(u,f);if(h!==void 0){a&&a.push(f);var g=s.applyMerges(d,m,h,i,a);g!==h&&(l=l||new Map,l.set(f,g)),a&&L(a.pop()===f)}}),l&&(n=me(u)?u.slice(0):E({},u),l.forEach(function(d,f){n[f]=d}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var tp=[];function Yf(r,e){var t=r.map;return t.has(e)||t.set(e,tp.pop()||{map:new Map}),t.get(e)}function Zc(r,e){if(r===e||!e||No(e))return r;if(!r||No(r))return e;var t=r.info&&e.info?E(E({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Zc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Zc(e.map.get(s),r.map.get(s)))})}return a}function No(r){return!r||!(r.info||r.map.size)}function Zf(r,e){var t=r.map,n=t.get(e);n&&No(n)&&(tp.push(n),t.delete(e))}var Xf=new Set;function wg(r,e,t,n){var i=function(p){var d=n.getFieldValue(p,t);return typeof d=="object"&&d},a=i(r);if(!!a){var o=i(e);if(!!o&&!te(a)&&!Ee(a,o)&&!Object.keys(a).every(function(p){return n.getFieldValue(o,p)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=Ft(t),u="".concat(s,".").concat(c);if(!Xf.has(u)){Xf.add(u);var l=[];!me(a)&&!me(o)&&[a,o].forEach(function(p){var d=n.getFieldValue(p,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
37
37
|
|
|
38
38
|
To address this problem (which is not a bug in Apollo Client), `).concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u,` field, so InMemoryCache can safely merge these objects:
|
|
39
39
|
|
|
@@ -44,21 +44,21 @@ For more information about these options, please refer to the documentation:
|
|
|
44
44
|
|
|
45
45
|
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
46
46
|
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
47
|
-
`))}}}}var
|
|
47
|
+
`))}}}}var Do=function(r){Ae(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=Ao,n.txCount=0,n.config=Df(t),n.addTypename=!!n.config.addTypename,n.policies=new Kf({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var t=this.data=new ai.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new ep(this,this.storeReader=new Mf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:xo(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=fn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(pn(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,gt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var n=t.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(E(E({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof ea)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(Oe.call(t,"id")&&!t.id)return!1;var n=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(E(E({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var n=this;return this.watches.size||Uf(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&zc(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){gt.reset();var n=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(t,n){return(n?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,n){return(n?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(te(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){__DEV__&&L.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Oe.call(t,"id"))return!1;t=E(E({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var n=this;return this.init(),gt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),zc(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(d){var f=n,m=f.data,h=f.optimisticData;++n.txCount,d&&(n.data=n.optimisticData=d);try{return u=i(n)}finally{--n.txCount,n.data=m,n.optimisticData=h}},p=new Set;return c&&!this.txCount&&this.broadcastWatches(E(E({},t),{onWatchUpdated:function(d){return p.add(d),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&p.size?(this.broadcastWatches(E(E({},t),{onWatchUpdated:function(d,f){var m=c.call(this,d,f);return m!==!1&&p.delete(d),m}})),p.size&&p.forEach(function(d){return n.maybeBroadcastWatch.dirty(d)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var n=this.typenameDocumentCache.get(t);return n||(n=un(t),this.typenameDocumentCache.set(t,n),this.typenameDocumentCache.set(n,n)),n}return t},e.prototype.transformForLink=function(t){var n=this.config.fragments;return n?n.transform(t):t},e.prototype.broadcastWatches=function(t){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,t)})},e.prototype.broadcastWatch=function(t,n){var i=t.lastDiff,a=this.diff(t);n&&(t.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,t,a,i)===!1)||(!i||!Ee(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Mc);function rp(r){return r.hasOwnProperty("graphQLErrors")}var _g=function(r){var e="";if($e(r.graphQLErrors)||$e(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
|
|
48
48
|
`)})}return r.networkError&&(e+="".concat(r.networkError.message,`
|
|
49
|
-
`)),e=e.replace(/\n$/,""),e},fr=function(r){
|
|
50
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!_e(this.options.variables,t)&&(i.variables=this.options.variables=E(E({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,fe.refetch)},e.prototype.fetchMore=function(t){var n=this,i=E(E({},t.query?t:E(E(E(E({},this.options),{query:this.query}),t),{variables:E(E({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=fe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,fe.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===fe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(p){return d(p,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Zc(n)})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&L.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return _e(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},fe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:s}):t==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,n)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Rr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},fe.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,n){return n===void 0&&(n=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?t:co(t),variables:n}),$e(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===fe.refetch||n===fe.fetchMore||n===fe.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Ar(this.options,t||{}),u=a?c:Sg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!_e(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=fe.setVariables)));var l=u.variables&&E({},u.variables),d=this.fetch(u,n),p={next:function(f){i.reportResult(f,l)},error:function(f){i.reportError(f,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=p),d.addObserver(p),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),un(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:fe.error,loading:!1});this.updateLastResult(i,n),un(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(X);lo(Do);function Zc(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):t}}):r.reobserve()}function _g(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function Xc(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Ro=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=pc(t.resolvers,n)}):this.resolvers=pc(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ct(this,void 0,void 0,function(){return Pt(this,function(c){return t?[2,this.resolveDocument(t,n.data,i,a,this.fragmentMatcher,s).then(function(u){return E(E({},n),{data:u.result})})]:[2,n]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Hn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return fc(e)},r.prototype.prepareContext=function(e){var t=this.cache;return E(E({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),Ct(this,void 0,void 0,function(){return Pt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then(function(a){return E(E({},t),a.exportedVariables)})]:[2,E({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Ye(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return tn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:lc(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ct(this,void 0,void 0,function(){var s,c,u,l,d,p,f,h,m,g,S;return Pt(this,function(b){return s=on(e),c=an(e),u=rn(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,p=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",f=this,h=f.cache,m=f.client,g={fragmentMap:u,context:E(E({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:p,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},S=!1,[2,this.resolveSelectionSet(s.selectionSet,S,t,g).then(function(v){return{result:v,exportedVariables:g.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Pt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(p){return Ct(l,void 0,void 0,function(){var f,h;return Pt(this,function(m){return!t&&!i.selectionsToResolve.has(p)?[2]:ur(p,s)?mt(p)?[2,this.resolveField(p,t,n,i).then(function(g){var S;typeof g<"u"&&c.push((S={},S[xt(p)]=g,S))})]:(oc(p)?f=p:(f=a[p.name.value],__DEV__?L(f,"No fragment named ".concat(p.name.value)):L(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,t,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h=this;return Pt(this,function(m){return n?(a=i.variables,o=e.name.value,s=xt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,p=this.resolvers&&this.resolvers[d],p&&(f=p[c?o:s],f&&(l=Promise.resolve(oi.withValue(this.cache,f,[n,lr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var S,b;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(k){k.name.value==="as"&&k.value.kind==="StringValue"&&(i.exportedVariables[k.value.value]=g)})}),!e.selectionSet||g==null)return g;var v=(b=(S=e.directives)===null||S===void 0?void 0:S.some(function(y){return y.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,t||v,g,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||v,g,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),Ye(o,{Directive:function(c,u,l,d,p){c.name.value==="client"&&p.forEach(function(f){n(f)&&ji(f)&&s.add(f)})},FragmentSpread:function(c,u,l,d,p){var f=t[c.name.value];__DEV__?L(f,"No fragment named ".concat(c.name.value)):L(f,12);var h=a(f);h.size>0&&(p.forEach(function(m){n(m)&&ji(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var ci=new(It?WeakMap:Map);function eu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return ci.set(r,(ci.get(r)+1)%1e15),t.apply(this,arguments)})}function rp(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Co=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;ci.has(n)||(ci.set(n,0),eu(n,"evict"),eu(n,"modify"),eu(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||fe.loading;return this.variables&&this.networkStatus!==fe.loading&&!_e(this.variables,e.variables)&&(t=fe.setVariables),_e(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){rp(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&_e(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(t);return this.updateLastDiff(i,t),i},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!_e(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=t.getDiff();n.fromOptimisticTransaction?e.observe():Zc(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;rp(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Rr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!_e(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===ci.get(this.cache)&&_e(t,n.variables)&&_e(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new st,s=$e(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&$e(e.incremental)){var c=fo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Po(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:ci.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),p=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(p,d),p.complete&&(e.data=p.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=fe.ready},r.prototype.markError=function(e){return this.networkStatus=fe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Po(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ti(r);return!n&&t&&r.data&&(n=!0),n}var Eg=Object.prototype.hasOwnProperty,np=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,p=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(It?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=p||new Ro({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new G("QueryManager stopped while query was in flight"):new G(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,p=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,g=e.errorPolicy,S=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,b=e.keepRootFields,v=e.context;return Ct(this,void 0,void 0,function(){var y,k,R,T,P,$;return Pt(this,function(C){switch(C.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):L(m==="network-only"||m==="no-cache",16),y=this.generateMutationId(),k=this.transform(i),R=k.document,T=k.hasClientExports,i=this.cache.transformForLink(R),a=this.getVariables(i,a),T?[4,this.localState.addExportedVariables(i,a,v)]:[3,2];case 1:a=C.sent(),C.label=2;case 2:return P=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:m,errorPolicy:S,context:v,updateQueries:s,update:p,keepRootFields:b}),this.broadcastQueries(),$=this,[2,new Promise(function(I,Ie){return uo($.getObservableFromLink(i,E(E({},v),{optimisticResponse:o}),a,!1),function(Le){if(ti(Le)&&S==="none")throw new fr({graphQLErrors:po(Le)});P&&(P.loading=!1,P.error=null);var Q=E({},Le);return typeof u=="function"&&(u=u(Q)),S==="ignore"&&ti(Q)&&delete Q.errors,$.markMutationResult({mutationId:y,result:Q,document:i,variables:a,fetchPolicy:m,errorPolicy:S,context:v,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?y:void 0,onQueryUpdated:f,keepRootFields:b})}).subscribe({next:function(Le){$.broadcastQueries(),(!("hasNext"in Le)||Le.hasNext===!1)&&I(Le)},error:function(Le){P&&(P.loading=!1,P.error=Le),o&&$.cache.removeOptimistic(y),$.broadcastQueries(),Ie(Le instanceof fr?Le:new fr({networkError:Le}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Po(i,e.errorPolicy)){if(kr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),kr(i)&&$e(i.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=fo(s.result,i)),typeof c<"u"&&(i.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,p){var f=d.observableQuery,h=f&&f.queryName;if(!(!h||!Eg.call(u,h))){var m=u[h],g=n.queries.get(p),S=g.document,b=g.variables,v=t.diff({query:S,variables:b,returnPartialData:!0,optimistic:!1}),y=v.result,k=v.complete;if(k&&y){var R=m(y,{mutationResult:i,queryName:S&&Yn(S)||void 0,queryVariables:b});R&&a.push({result:R,dataId:"ROOT_QUERY",query:S,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var p=e.update,f=!jl(i)||kr(i)&&!i.hasNext;if(p){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=E(E({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}f&&p(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&d.modify({id:"ROOT_MUTATION",fields:function(m,g){var S=g.fieldName,b=g.DELETE;return S==="__typename"?m:b}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(E(E({},t),{result:{data:i}}),a)}catch(o){__DEV__&&L.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,n){return this.fetchQueryObservable(e,t,n).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var n=this.cache.transformDocument(e),i=uc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:rc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:sn(Wt(n)),asQuery:E(E({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?E(E({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(n),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return E(E({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Co(this),n=new Do({queryManager:this,queryInfo:t,options:e});return this.queries.set(n.queryId,t),t.init({document:n.query,observableQuery:n,variables:n.variables}),n},r.prototype.query=function(e,t){var n=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new G("Store reset while query was in flight (not completed in link chain)"):new G(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=fe.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):ic(o)?i.set(t.transform(o).document,!1):ae(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Gi("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new Do({queryManager:t,queryInfo:c,options:E(E({},o),{fetchPolicy:"network-only"})});L(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&L.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(d){return t.getObservableFromLink(n,c,d).map(function(p){if(i!=="no-cache"&&(Po(p,a)&&t.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),ti(p))throw new fr({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new X(function(d){var p=null;return l.then(function(f){return p=f.subscribe(d)},d.error),function(){return p&&p.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,p={query:c,variables:n,operationName:Yn(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!i}))};if(t=p.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=gt(n);if(s=f.get(h),!s){var m=new ei([ri(d,p)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new ei([ri(d,p)])}else s=new ei([X.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=uo(s,function(S){return a.localState.runResolvers({document:g,remoteResult:S,context:t,variables:n})})),s},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return uo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=po(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new fr({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:fe.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=fe.error),u},function(o){var s=tp(o)?o:new fr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=fe.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,p=d===void 0?c&&c.errorPolicy||"none":d,f=t.returnPartialData,h=f===void 0?!1:f,m=t.notifyOnNetworkStatusChange,g=m===void 0?!1:m,S=t.context,b=S===void 0?{}:S,v=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:g,context:b}),y=function(T){v.variables=T;var P=i.fetchQueryByPolicy(s,v,n);return v.fetchPolicy!=="standby"&&P.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),P},k=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(T){k(),setTimeout(function(){return R.cancel(T)})});var R=new ei(this.transform(v.query).hasClientExports?this.localState.addExportedVariables(v.query,v.variables,v.context).then(y):y(v.variables));return R.promise.then(k,k),R},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Gi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(p,f){l.set(f,{oq:p,lastDiff:t.getQuery(f).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(p,f,h){var m=p.watcher instanceof Co&&p.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var g=u(m,f,h);return g===!0&&(g=m.refetch()),g!==!1&&d.set(m,g),g}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:f})}}}),l.size&&l.forEach(function(p,f){var h=p.oq,m=p.lastDiff,g=p.diff,S;if(u){if(!g){var b=h.queryInfo;b.reset(),g=b.getDiff()}S=u(h,g,m)}(!u||S===!0)&&(S=h.refetch()),S!==!1&&d.set(h,S),f.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,p=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(y,k){k===void 0&&(k=e.networkStatus||fe.loading);var R=y.result;__DEV__&&!l&&!_e(R,{})&&Xc(y.missing);var T=function(P){return X.of(E({data:P,loading:Rr(k),networkStatus:k},y.complete?null:{partial:!0}))};return R&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(P){return T(P.data||void 0)}):u==="none"&&k===fe.refetch&&Array.isArray(y.missing)?T(void 0):T(R)},g=s==="no-cache"?0:n===fe.refetch&&c!=="merge"?1:2,S=function(){return i.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},b=p&&typeof f=="number"&&f!==n&&Rr(n);switch(s){default:case"cache-first":{var v=h();return v.complete?[m(v,e.markReady())]:l||b?[m(v),S()]:[S()]}case"cache-and-network":{var v=h();return v.complete||l||b?[m(v),S()]:[S()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),S()]:[S()];case"no-cache":return b?[m(e.getDiff()),S()]:[S()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Co(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return E(E({},t),{clientAwareness:this.clientAwareness})},r}();var ip=!1;var tu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,p=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,f=e.queryDeduplication,h=f===void 0?!0:f,m=e.defaultOptions,g=e.assumeImmutableResults,S=g===void 0?!1:g,b=e.resolvers,v=e.typeDefs,y=e.fragmentMatcher,k=e.name,R=e.version,T=e.link;if(T||(T=n?new Oc({uri:n,credentials:i,headers:a}):Tt.empty()),!o)throw __DEV__?new G(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
51
|
-
For more information, please visit: https://go.apollo.dev/c/docs`):new G(9);if(this.link=T,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=v,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!ip&&p&&__DEV__&&(ip=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var P=window.navigator,$=P&&P.userAgent,C=void 0;typeof $=="string"&&($.indexOf("Chrome/")>-1?C="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":$.indexOf("Firefox/")>-1&&(C="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),C&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+C)}this.version=Vl,this.localState=new Ro({cache:o,client:this,resolvers:b,fragmentMatcher:y}),this.queryManager=new np({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:k,version:R},localState:this.localState,assumeImmutableResults:S,onBroadcast:p?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?L(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):L(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return ri(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();ml(en?"log":"silent");function et(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function pr(r){return et(r)==="object"}function ap(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function ru(r,e){return r.length<124?r:e}var op="graphql-transport-ws";var ct;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ct||(ct={}));var Oe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Oe||(Oe={}));function sp(r){if(!pr(r))throw new Error(`Message is expected to be an object, but got ${et(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${et(r.type)}`);switch(r.type){case Oe.ConnectionInit:case Oe.ConnectionAck:case Oe.Ping:case Oe.Pong:{if(r.payload!=null&&!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Oe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${et(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${et(r.payload.query)}`);if(r.payload.variables!=null&&!pr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${et(r.payload.variables)}`);if(r.payload.operationName!=null&&et(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${et(r.payload.operationName)}`);if(r.payload.extensions!=null&&!pr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${et(r.payload.extensions)}`);break}case Oe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${et(r.payload)}`);break}case Oe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!ap(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Oe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function cp(r,e){return sp(typeof r=="string"?JSON.parse(r,e):r)}function ui(r,e){return sp(r),JSON.stringify(r,e)}function nu(r){let{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ge){let ye=1e3;for(let ne=0;ne<ge;ne++)ye*=2;await new Promise(ne=>setTimeout(ne,ye+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Lo,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ge=>{let ye=Math.random()*16|0;return(ge=="x"?ye:ye&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:S}=r,b;if(h){if(!Ig(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let v=b,y=(()=>{let Q=(()=>{let ye={};return{on(ne,ie){return ye[ne]=ie,()=>{delete ye[ne]}},emit(ne){var ie;"id"in ne&&((ie=ye[ne.id])===null||ie===void 0||ie.call(ye,ne))}}})(),ge={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[Q.emit,f.message]:[Q.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:Q.on,on(ye,ne){let ie=ge[ye];return ie.push(ne),()=>{ie.splice(ie.indexOf(ne),1)}},emit(ye,...ne){for(let ie of[...ge[ye]])ie(...ne)}}})();function k(Q){let ge=[y.on("error",ye=>{ge.forEach(ne=>ne()),Q(ye)}),y.on("closed",ye=>{ge.forEach(ne=>ne()),Q(ye)})]}let R,T=0,P,$=!1,C=0,I=!1;async function Ie(){clearTimeout(P);let[Q,ge]=await(R??(R=new Promise((ie,Bt)=>(async()=>{if($){if(await l(C),!T)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});C++}y.emit("connecting");let Z=new v(typeof e=="function"?await e():e,op),Vt,_r;function Ya(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{Z.readyState===v.OPEN&&(Z.send(ui({type:Oe.Ping})),y.emit("ping",!1,void 0))},o))}k(ze=>{R=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(ze),Lo(ze)&&ze.code===4499&&(Z.close(4499,"Terminated"),Z.onerror=null,Z.onclose=null)}),Z.onerror=ze=>y.emit("error",ze),Z.onclose=ze=>y.emit("closed",ze),Z.onopen=async()=>{try{y.emit("opened",Z);let ze=typeof t=="function"?await t():t;if(Z.readyState!==v.OPEN)return;Z.send(ui(ze?{type:Oe.ConnectionInit,payload:ze}:{type:Oe.ConnectionInit},g)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{Z.close(ct.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ya()}catch(ze){y.emit("error",ze),Z.close(ct.InternalClientError,ru(ze instanceof Error?ze.message:new Error(ze).message,"Internal client error"))}};let Gn=!1;Z.onmessage=({data:ze})=>{try{let We=cp(ze,S);if(y.emit("message",We),We.type==="ping"||We.type==="pong"){y.emit(We.type,!0,We.payload),We.type==="pong"?Ya():s||(Z.send(ui(We.payload?{type:Oe.Pong,payload:We.payload}:{type:Oe.Pong})),y.emit("pong",!1,We.payload));return}if(Gn)return;if(We.type!==Oe.ConnectionAck)throw new Error(`First message cannot be of type ${We.type}`);clearTimeout(Vt),Gn=!0,y.emit("connected",Z,We.payload),$=!1,C=0,ie([Z,new Promise((ZS,Ch)=>k(Ch))])}catch(We){Z.onmessage=null,y.emit("error",We),Z.close(ct.BadResponse,ru(We instanceof Error?We.message:new Error(We).message,"Bad response"))}}})())));Q.readyState===v.CLOSING&&await ge;let ye=()=>{},ne=new Promise(ie=>ye=ie);return[Q,ye,Promise.race([ne.then(()=>{if(!T){let ie=()=>Q.close(1e3,"Normal Closure");isFinite(a)&&a>0?P=setTimeout(()=>{Q.readyState===v.OPEN&&ie()},a):ie()}}),ge])]}function Le(Q){if(Lo(Q)&&(xg(Q.code)||[ct.InternalServerError,ct.InternalClientError,ct.BadRequest,ct.BadResponse,ct.Unauthorized,ct.SubprotocolNotAcceptable,ct.SubscriberAlreadyExists,ct.TooManyInitialisationRequests].includes(Q.code)))throw Q;if(I)return!1;if(Lo(Q)&&Q.code===1e3)return T>0;if(!u||C>=u||!d(Q)||p?.(Q))throw Q;return $=!0}return n||(async()=>{for(T++;;)try{let[,,Q]=await Ie();await Q}catch(Q){try{if(!Le(Q))return}catch(ge){return i?.(ge)}}})(),{on:y.on,subscribe(Q,ge){let ye=m(Q),ne=!1,ie=!1,Bt=()=>{T--,ne=!0};return(async()=>{for(T++;;)try{let[Z,Vt,_r]=await Ie();if(ne)return Vt();let Ya=y.onMessage(ye,Gn=>{switch(Gn.type){case Oe.Next:{ge.next(Gn.payload);return}case Oe.Error:{ie=!0,ne=!0,ge.error(Gn.payload),Bt();return}case Oe.Complete:{ne=!0,Bt();return}}});Z.send(ui({id:ye,type:Oe.Subscribe,payload:Q},g)),Bt=()=>{!ne&&Z.readyState===v.OPEN&&Z.send(ui({id:ye,type:Oe.Complete},g)),T--,ne=!0,Vt()},await _r.finally(Ya);return}catch(Z){if(!Le(Z))return}})().then(()=>{ie||ge.complete()}).catch(Z=>{ge.error(Z)}),()=>{ne||Bt()}},async dispose(){if(I=!0,R){let[Q]=await R;Q.close(1e3,"Normal Closure")}},terminate(){R&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Lo(r){return pr(r)&&"code"in r&&"reason"in r}function xg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function Ig(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Tg(r){return ae(r)&&"code"in r&&"reason"in r}var up=function(r){ke(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new X(function(i){return n.client.subscribe(E(E({},t),{query:Kn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Tg(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new fr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Tt);var $o="0.12.0-rc1-dev.2";function lp(){return typeof window!="undefined"&&window.self!==window.top}function iu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function dr(r,e){iu()&&localStorage.setItem(`${$o}/${r}`,e)}function Fo(r){return iu()?localStorage.getItem(`${$o}/${r}`):null}function ra(r){iu()&&localStorage.removeItem(`${$o}/${r}`)}function fp(r,e=1e4){return we(this,null,function*(){return Promise.race([new Promise((t,n)=>{let i;try{i=new WebSocket(r,"graphql-transport-ws"),i.onopen=()=>{i.close(),t(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((t,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var hs=function(){return hs=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},hs.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Yo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yo=function(t){return typeof t}:Yo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yo(r)}function Ag(r){return Yo(r)=="object"&&r!==null}var Rd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function xu(r,e){for(var t=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=t.exec(r.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Og(r){return Cd(r.source,xu(r.source,r.start))}function Cd(r,e){var t=r.locationOffset.column-1,n=Zo(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
-
`),l=n.split(/\r\n|[\n\r]/g),
|
|
53
|
-
`)}function
|
|
49
|
+
`)),e=e.replace(/\n$/,""),e},fr=function(r){Ae(e,r);function e(t){var n=t.graphQLErrors,i=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||_g(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var fe;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(fe||(fe={}));function Rr(r){return r?r<7:!1}var Eg=Object.assign,xg=Object.hasOwnProperty,Ro=function(r){Ae(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(g){try{var b=g._subscription._observer;b&&!b.error&&(b.error=Ig)}catch{}var v=!o.observers.size;o.observers.add(g);var S=o.last;return S&&S.error?g.error&&g.error(S.error):S&&S.result&&g.next&&g.next(S.result),v&&o.reobserve().catch(function(){}),function(){o.observers.delete(g)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,p=a.fetchPolicy,d=p===void 0?l:p,f=a.initialFetchPolicy,m=f===void 0?d==="standby"?l:d:f;o.options=E(E({},a),{initialFetchPolicy:m,fetchPolicy:d}),o.queryId=i.queryId||n.generateQueryId();var h=Wt(o.query);return o.queryName=h&&h.name&&h.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(n,i){var a={next:function(s){n(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||fe.ready,a=E(E({},n),{loading:Rr(i),networkStatus:i}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Ee(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===fe.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=fe.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&eu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ee(this.last.result,t)||n&&!Ee(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ee(i.variables,this.variables)))return i[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&t&&xg.call(t,"variables")){var o=Qi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.value)||JSON.stringify(o),`, which does not declare a $variables variable.
|
|
50
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ee(this.options.variables,t)&&(i.variables=this.options.variables=E(E({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,fe.refetch)},e.prototype.fetchMore=function(t){var n=this,i=E(E({},t.query?t:E(E(E(E({},this.options),{query:this.query}),t),{variables:E(E({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=fe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,fe.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===fe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var p=t.updateQuery;p?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(d){return p(d,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Xc(n)})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&L.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ee(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},fe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:s}):t==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,n)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Rr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},fe.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,n){return n===void 0&&(n=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?t:uo(t),variables:n}),$e(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===fe.refetch||n===fe.fetchMore||n===fe.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Ar(this.options,t||{}),u=a?c:Eg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ee(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=fe.setVariables)));var l=u.variables&&E({},u.variables),p=this.fetch(u,n),d={next:function(f){i.reportResult(f,l)},error:function(f){i.reportError(f,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=p,this.observer=d),p.addObserver(d),p.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),ln(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:fe.error,loading:!1});this.updateLastResult(i,n),ln(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ee);fo(Ro);function Xc(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):t}}):r.reobserve()}function Ig(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function eu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Co=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=dc(t.resolvers,n)}):this.resolvers=dc(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ct(this,void 0,void 0,function(){return Pt(this,function(c){return t?[2,this.resolveDocument(t,n.data,i,a,this.fragmentMatcher,s).then(function(u){return E(E({},n),{data:u.result})})]:[2,n]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return pc(e)},r.prototype.prepareContext=function(e){var t=this.cache;return E(E({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),Ct(this,void 0,void 0,function(){return Pt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then(function(a){return E(E({},t),a.exportedVariables)})]:[2,E({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Ye(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return rn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:fc(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ct(this,void 0,void 0,function(){var s,c,u,l,p,d,f,m,h,g,b;return Pt(this,function(v){return s=sn(e),c=on(e),u=nn(c),l=this.collectSelectionsToResolve(s,u),p=s.operation,d=p?p.charAt(0).toUpperCase()+p.slice(1):"Query",f=this,m=f.cache,h=f.client,g={fragmentMap:u,context:E(E({},n),{cache:m,client:h}),variables:i,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},b=!1,[2,this.resolveSelectionSet(s.selectionSet,b,t,g).then(function(S){return{result:S,exportedVariables:g.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Pt(this,function(p){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(d){return Ct(l,void 0,void 0,function(){var f,m;return Pt(this,function(h){return!t&&!i.selectionsToResolve.has(d)?[2]:ur(d,s)?mt(d)?[2,this.resolveField(d,t,n,i).then(function(g){var b;typeof g<"u"&&c.push((b={},b[xt(d)]=g,b))})]:(sc(d)?f=d:(f=a[d.name.value],__DEV__?L(f,"No fragment named ".concat(d.name.value)):L(f,11)),f&&f.typeCondition&&(m=f.typeCondition.name.value,i.fragmentMatcher(n,m,o))?[2,this.resolveSelectionSet(f.selectionSet,t,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return zi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Ct(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,m=this;return Pt(this,function(h){return n?(a=i.variables,o=e.name.value,s=xt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(p=n.__typename||i.defaultOperationType,d=this.resolvers&&this.resolvers[p],d&&(f=d[c?o:s],f&&(l=Promise.resolve(oi.withValue(this.cache,f,[n,lr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var b,v;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(k){k.name.value==="as"&&k.value.kind==="StringValue"&&(i.exportedVariables[k.value.value]=g)})}),!e.selectionSet||g==null)return g;var S=(v=(b=e.directives)===null||b===void 0?void 0:b.some(function(y){return y.name.value==="client"}))!==null&&v!==void 0?v:!1;if(Array.isArray(g))return m.resolveSubSelectedArray(e,t||S,g,i);if(e.selectionSet)return m.resolveSelectionSet(e.selectionSet,t||S,g,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),Ye(o,{Directive:function(c,u,l,p,d){c.name.value==="client"&&d.forEach(function(f){n(f)&&Ui(f)&&s.add(f)})},FragmentSpread:function(c,u,l,p,d){var f=t[c.name.value];__DEV__?L(f,"No fragment named ".concat(c.name.value)):L(f,12);var m=a(f);m.size>0&&(d.forEach(function(h){n(h)&&Ui(h)&&s.add(h)}),s.add(c),m.forEach(function(h){s.add(h)}))}})}return i.get(o)}return a(e)},r}();var ci=new(It?WeakMap:Map);function tu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return ci.set(r,(ci.get(r)+1)%1e15),t.apply(this,arguments)})}function np(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Po=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;ci.has(n)||(ci.set(n,0),tu(n,"evict"),tu(n,"modify"),tu(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||fe.loading;return this.variables&&this.networkStatus!==fe.loading&&!Ee(this.variables,e.variables)&&(t=fe.setVariables),Ee(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){np(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ee(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(t);return this.updateLastDiff(i,t),i},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ee(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=t.getDiff();n.fromOptimisticTransaction?e.observe():Xc(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;np(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Rr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ee(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===ci.get(this.cache)&&Ee(t,n.variables)&&Ee(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new st,s=$e(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&$e(e.incremental)){var c=po(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Lo(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:ci.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var p=a.getDiffOptions(n.variables),d=l.diff(p);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(d,p),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=fe.ready},r.prototype.markError=function(e){return this.networkStatus=fe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Lo(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ti(r);return!n&&t&&r.data&&(n=!0),n}var kg=Object.prototype.hasOwnProperty,ip=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,p=l===void 0?{}:l,d=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(It?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=p,this.localState=d||new Co({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new G("QueryManager stopped while query was in flight"):new G(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,p=l===void 0?!1:l,d=e.update,f=e.onQueryUpdated,m=e.fetchPolicy,h=m===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":m,g=e.errorPolicy,b=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,v=e.keepRootFields,S=e.context;return Ct(this,void 0,void 0,function(){var y,k,N,T,C,$;return Pt(this,function(P){switch(P.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(h==="network-only"||h==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):L(h==="network-only"||h==="no-cache",16),y=this.generateMutationId(),k=this.transform(i),N=k.document,T=k.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),T?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:h,errorPolicy:b,context:S,updateQueries:s,update:d,keepRootFields:v}),this.broadcastQueries(),$=this,[2,new Promise(function(M,we){return lo($.getObservableFromLink(i,E(E({},S),{optimisticResponse:o}),a,!1),function(ke){if(ti(ke)&&b==="none")throw new fr({graphQLErrors:ho(ke)});C&&(C.loading=!1,C.error=null);var I=E({},ke);return typeof u=="function"&&(u=u(I)),b==="ignore"&&ti(I)&&delete I.errors,$.markMutationResult({mutationId:y,result:I,document:i,variables:a,fetchPolicy:h,errorPolicy:b,context:S,update:d,updateQueries:s,awaitRefetchQueries:p,refetchQueries:u,removeOptimistic:o?y:void 0,onQueryUpdated:f,keepRootFields:v})}).subscribe({next:function(ke){$.broadcastQueries(),(!("hasNext"in ke)||ke.hasNext===!1)&&M(ke)},error:function(ke){C&&(C.loading=!1,C.error=ke),o&&$.cache.removeOptimistic(y),$.broadcastQueries(),we(ke instanceof fr?ke:new fr({networkError:ke}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Lo(i,e.errorPolicy)){if(Tr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Tr(i)&&$e(i.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=po(s.result,i)),typeof c<"u"&&(i.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(p,d){var f=p.observableQuery,m=f&&f.queryName;if(!(!m||!kg.call(u,m))){var h=u[m],g=n.queries.get(d),b=g.document,v=g.variables,S=t.diff({query:b,variables:v,returnPartialData:!0,optimistic:!1}),y=S.result,k=S.complete;if(k&&y){var N=h(y,{mutationResult:i,queryName:b&&Yn(b)||void 0,queryVariables:v});N&&a.push({result:N,dataId:"ROOT_QUERY",query:b,variables:v})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(p){o||a.forEach(function(h){return p.write(h)});var d=e.update,f=!Ul(i)||Tr(i)&&!i.hasNext;if(d){if(!o){var m=p.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});m.complete&&(i=E(E({},i),{data:m.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}f&&d(p,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&p.modify({id:"ROOT_MUTATION",fields:function(h,g){var b=g.fieldName,v=g.DELETE;return b==="__typename"?h:v}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(p){return l.push(p)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(E(E({},t),{result:{data:i}}),a)}catch(o){__DEV__&&L.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,n){return this.fetchQueryObservable(e,t,n).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var n=this.cache.transformDocument(e),i=lc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:nc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:cn(Wt(n)),asQuery:E(E({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?E(E({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(n),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return E(E({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Po(this),n=new Ro({queryManager:this,queryInfo:t,options:e});return this.queries.set(n.queryId,t),t.init({document:n.query,observableQuery:n,variables:n.variables}),n},r.prototype.query=function(e,t){var n=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new G("Store reset while query was in flight (not completed in link chain)"):new G(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=fe.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):ac(o)?i.set(t.transform(o).document,!1):oe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,p=c.options.fetchPolicy;if(p==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Hi("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new Ro({queryManager:t,queryInfo:c,options:E(E({},o),{fetchPolicy:"network-only"})});L(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&L.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(p){return t.getObservableFromLink(n,c,p).map(function(d){if(i!=="no-cache"&&(Lo(d,a)&&t.cache.write({query:n,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:p}),t.broadcastQueries()),ti(d))throw new fr({graphQLErrors:d.errors});return d})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ee(function(p){var d=null;return l.then(function(f){return d=f.subscribe(p)},p.error),function(){return d&&d.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,p=u.link,d={query:c,variables:n,operationName:Yn(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!i}))};if(t=d.context,i){var f=l.get(c)||new Map;l.set(c,f);var m=gt(n);if(s=f.get(m),!s){var h=new ei([ri(p,d)]);f.set(m,s=h),h.beforeNext(function(){f.delete(m)&&f.size<1&&l.delete(c)})}}else s=new ei([ri(p,d)])}else s=new ei([ee.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=lo(s,function(b){return a.localState.runResolvers({document:g,remoteResult:b,context:t,variables:n})})),s},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return lo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=ho(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new fr({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:fe.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=fe.error),u},function(o){var s=rp(o)?o:new fr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=fe.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,p=t.errorPolicy,d=p===void 0?c&&c.errorPolicy||"none":p,f=t.returnPartialData,m=f===void 0?!1:f,h=t.notifyOnNetworkStatusChange,g=h===void 0?!1:h,b=t.context,v=b===void 0?{}:b,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:m,notifyOnNetworkStatusChange:g,context:v}),y=function(T){S.variables=T;var C=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),C},k=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(T){k(),setTimeout(function(){return N.cancel(T)})});var N=new ei(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(y):y(S.variables));return N.promise.then(k,k),N},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Hi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(d,f){l.set(f,{oq:d,lastDiff:t.getQuery(f).getDiff()})});var p=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,f,m){var h=d.watcher instanceof Po&&d.watcher.observableQuery;if(h){if(u){l.delete(h.queryId);var g=u(h,f,m);return g===!0&&(g=h.refetch()),g!==!1&&p.set(h,g),g}u!==null&&l.set(h.queryId,{oq:h,lastDiff:m,diff:f})}}}),l.size&&l.forEach(function(d,f){var m=d.oq,h=d.lastDiff,g=d.diff,b;if(u){if(!g){var v=m.queryInfo;v.reset(),g=v.getDiff()}b=u(m,g,h)}(!u||b===!0)&&(b=m.refetch()),b!==!1&&p.set(m,b),f.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),p},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,p=t.context,d=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var m=function(){return e.getDiff(o)},h=function(y,k){k===void 0&&(k=e.networkStatus||fe.loading);var N=y.result;__DEV__&&!l&&!Ee(N,{})&&eu(y.missing);var T=function(C){return ee.of(E({data:C,loading:Rr(k),networkStatus:k},y.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:p,variables:o,onlyRunForcedResolvers:!0}).then(function(C){return T(C.data||void 0)}):u==="none"&&k===fe.refetch&&Array.isArray(y.missing)?T(void 0):T(N)},g=s==="no-cache"?0:n===fe.refetch&&c!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,g,{variables:o,context:p,fetchPolicy:s,errorPolicy:u})},v=d&&typeof f=="number"&&f!==n&&Rr(n);switch(s){default:case"cache-first":{var S=m();return S.complete?[h(S,e.markReady())]:l||v?[h(S),b()]:[b()]}case"cache-and-network":{var S=m();return S.complete||l||v?[h(S),b()]:[b()]}case"cache-only":return[h(m(),e.markReady())];case"network-only":return v?[h(m()),b()]:[b()];case"no-cache":return v?[h(e.getDiff()),b()]:[b()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Po(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return E(E({},t),{clientAwareness:this.clientAwareness})},r}();var ap=!1;var ru=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,p=e.connectToDevTools,d=p===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:p,f=e.queryDeduplication,m=f===void 0?!0:f,h=e.defaultOptions,g=e.assumeImmutableResults,b=g===void 0?!1:g,v=e.resolvers,S=e.typeDefs,y=e.fragmentMatcher,k=e.name,N=e.version,T=e.link;if(T||(T=n?new Nc({uri:n,credentials:i,headers:a}):kt.empty()),!o)throw __DEV__?new G(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
51
|
+
For more information, please visit: https://go.apollo.dev/c/docs`):new G(9);if(this.link=T,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=m,this.defaultOptions=h||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!ap&&d&&__DEV__&&(ap=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,$=C&&C.userAgent,P=void 0;typeof $=="string"&&($.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":$.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Ql,this.localState=new Co({cache:o,client:this,resolvers:v,fragmentMatcher:y}),this.queryManager=new ip({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:m,ssrMode:c,clientAwareness:{name:k,version:N},localState:this.localState,assumeImmutableResults:b,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?L(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):L(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return ri(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();gl(tn?"log":"silent");function et(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function pr(r){return et(r)==="object"}function op(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function nu(r,e){return r.length<124?r:e}var sp="graphql-transport-ws";var ct;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ct||(ct={}));var Ne;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Ne||(Ne={}));function cp(r){if(!pr(r))throw new Error(`Message is expected to be an object, but got ${et(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${et(r.type)}`);switch(r.type){case Ne.ConnectionInit:case Ne.ConnectionAck:case Ne.Ping:case Ne.Pong:{if(r.payload!=null&&!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Ne.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${et(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${et(r.payload.query)}`);if(r.payload.variables!=null&&!pr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${et(r.payload.variables)}`);if(r.payload.operationName!=null&&et(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${et(r.payload.operationName)}`);if(r.payload.extensions!=null&&!pr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${et(r.payload.extensions)}`);break}case Ne.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${et(r.payload)}`);break}case Ne.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!op(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Ne.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${et(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function up(r,e){return cp(typeof r=="string"?JSON.parse(r,e):r)}function ui(r,e){return cp(r),JSON.stringify(r,e)}function iu(r){let{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ge){let ye=1e3;for(let ie=0;ie<ge;ie++)ye*=2;await new Promise(ie=>setTimeout(ie,ye+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:p=$o,isFatalConnectionProblem:d,on:f,webSocketImpl:m,generateID:h=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ge=>{let ye=Math.random()*16|0;return(ge=="x"?ye:ye&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:b}=r,v;if(m){if(!Ag(m))throw new Error("Invalid WebSocket implementation provided");v=m}else typeof WebSocket<"u"?v=WebSocket:typeof global<"u"?v=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(v=window.WebSocket||window.MozWebSocket);if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=v,y=(()=>{let I=(()=>{let ye={};return{on(ie,ae){return ye[ie]=ae,()=>{delete ye[ie]}},emit(ie){var ae;"id"in ie&&((ae=ye[ie.id])===null||ae===void 0||ae.call(ye,ie))}}})(),ge={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[I.emit,f.message]:[I.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:I.on,on(ye,ie){let ae=ge[ye];return ae.push(ie),()=>{ae.splice(ae.indexOf(ie),1)}},emit(ye,...ie){for(let ae of[...ge[ye]])ae(...ie)}}})();function k(I){let ge=[y.on("error",ye=>{ge.forEach(ie=>ie()),I(ye)}),y.on("closed",ye=>{ge.forEach(ie=>ie()),I(ye)})]}let N,T=0,C,$=!1,P=0,M=!1;async function we(){clearTimeout(C);let[I,ge]=await(N??(N=new Promise((ae,Bt)=>(async()=>{if($){if(await l(P),!T)return N=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});P++}y.emit("connecting");let X=new S(typeof e=="function"?await e():e,sp),Vt,_r;function Za(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{X.readyState===S.OPEN&&(X.send(ui({type:Ne.Ping})),y.emit("ping",!1,void 0))},o))}k(ze=>{N=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(ze),$o(ze)&&ze.code===4499&&(X.close(4499,"Terminated"),X.onerror=null,X.onclose=null)}),X.onerror=ze=>y.emit("error",ze),X.onclose=ze=>y.emit("closed",ze),X.onopen=async()=>{try{y.emit("opened",X);let ze=typeof t=="function"?await t():t;if(X.readyState!==S.OPEN)return;X.send(ui(ze?{type:Ne.ConnectionInit,payload:ze}:{type:Ne.ConnectionInit},g)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{X.close(ct.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Za()}catch(ze){y.emit("error",ze),X.close(ct.InternalClientError,nu(ze instanceof Error?ze.message:new Error(ze).message,"Internal client error"))}};let Gn=!1;X.onmessage=({data:ze})=>{try{let We=up(ze,b);if(y.emit("message",We),We.type==="ping"||We.type==="pong"){y.emit(We.type,!0,We.payload),We.type==="pong"?Za():s||(X.send(ui(We.payload?{type:Ne.Pong,payload:We.payload}:{type:Ne.Pong})),y.emit("pong",!1,We.payload));return}if(Gn)return;if(We.type!==Ne.ConnectionAck)throw new Error(`First message cannot be of type ${We.type}`);clearTimeout(Vt),Gn=!0,y.emit("connected",X,We.payload),$=!1,P=0,ae([X,new Promise((rw,$h)=>k($h))])}catch(We){X.onmessage=null,y.emit("error",We),X.close(ct.BadResponse,nu(We instanceof Error?We.message:new Error(We).message,"Bad response"))}}})())));I.readyState===S.CLOSING&&await ge;let ye=()=>{},ie=new Promise(ae=>ye=ae);return[I,ye,Promise.race([ie.then(()=>{if(!T){let ae=()=>I.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{I.readyState===S.OPEN&&ae()},a):ae()}}),ge])]}function ke(I){if($o(I)&&(Tg(I.code)||[ct.InternalServerError,ct.InternalClientError,ct.BadRequest,ct.BadResponse,ct.Unauthorized,ct.SubprotocolNotAcceptable,ct.SubscriberAlreadyExists,ct.TooManyInitialisationRequests].includes(I.code)))throw I;if(M)return!1;if($o(I)&&I.code===1e3)return T>0;if(!u||P>=u||!p(I)||d?.(I))throw I;return $=!0}return n||(async()=>{for(T++;;)try{let[,,I]=await we();await I}catch(I){try{if(!ke(I))return}catch(ge){return i?.(ge)}}})(),{on:y.on,subscribe(I,ge){let ye=h(I),ie=!1,ae=!1,Bt=()=>{T--,ie=!0};return(async()=>{for(T++;;)try{let[X,Vt,_r]=await we();if(ie)return Vt();let Za=y.onMessage(ye,Gn=>{switch(Gn.type){case Ne.Next:{ge.next(Gn.payload);return}case Ne.Error:{ae=!0,ie=!0,ge.error(Gn.payload),Bt();return}case Ne.Complete:{ie=!0,Bt();return}}});X.send(ui({id:ye,type:Ne.Subscribe,payload:I},g)),Bt=()=>{!ie&&X.readyState===S.OPEN&&X.send(ui({id:ye,type:Ne.Complete},g)),T--,ie=!0,Vt()},await _r.finally(Za);return}catch(X){if(!ke(X))return}})().then(()=>{ae||ge.complete()}).catch(X=>{ge.error(X)}),()=>{ie||Bt()}},async dispose(){if(M=!0,N){let[I]=await N;I.close(1e3,"Normal Closure")}},terminate(){N&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function $o(r){return pr(r)&&"code"in r&&"reason"in r}function Tg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function Ag(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Og(r){return oe(r)&&"code"in r&&"reason"in r}var lp=function(r){Ae(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new ee(function(i){return n.client.subscribe(E(E({},t),{query:Hn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Og(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new fr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(kt);var Fo="0.12.0-rc1-dev.2";function fp(){return typeof window!="undefined"&&window.self!==window.top}function au(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function dr(r,e){au()&&localStorage.setItem(`${Fo}/${r}`,e)}function Mo(r){return au()?localStorage.getItem(`${Fo}/${r}`):null}function na(r){au()&&localStorage.removeItem(`${Fo}/${r}`)}function pp(r,e=1e4){return _e(this,null,function*(){return Promise.race([new Promise((t,n)=>{let i;try{i=new WebSocket(r,"graphql-transport-ws"),i.onopen=()=>{i.close(),t(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((t,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Zo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(t){return typeof t}:Zo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(r)}function Dg(r){return Zo(r)=="object"&&r!==null}var Cd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Iu(r,e){for(var t=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=t.exec(r.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Rg(r){return Pd(r.source,Iu(r.source,r.start))}function Pd(r,e){var t=r.locationOffset.column-1,n=Xo(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
+
`),l=n.split(/\r\n|[\n\r]/g),p=l[i];if(p.length>120){for(var d=Math.floor(c/80),f=c%80,m=[],h=0;h<p.length;h+=80)m.push(p.slice(h,h+80));return u+dp([["".concat(o),m[0]]].concat(m.slice(1,d+1).map(function(g){return["",g]}),[[" ",Xo(f-1)+"^"],["",m[d+1]]]))}return u+dp([["".concat(o-1),l[i-1]],["".concat(o),p],["",Xo(c-1)+"^"],["".concat(o+1),l[i+1]]])}function dp(r){var e=r.filter(function(n){n[0];var i=n[1];return i!==void 0}),t=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return Cg(t,i)+(a?" | "+a:" |")}).join(`
|
|
53
|
+
`)}function Xo(r){return Array(r+1).join(" ")}function Cg(r,e){return Xo(r-e.length)+e}function es(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?es=function(t){return typeof t}:es=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},es(r)}function hp(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Pg(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?hp(Object(t),!0).forEach(function(n){Lg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):hp(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Lg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function $g(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function mp(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Fg(r,e,t){return e&&mp(r.prototype,e),t&&mp(r,t),r}function Mg(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&Da(r,e)}function jg(r){var e=$d();return function(){var n=Ra(r),i;if(e){var a=Ra(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Ld(this,i)}}function Ld(r,e){return e&&(es(e)==="object"||typeof e=="function")?e:ca(r)}function ca(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function ku(r){var e=typeof Map=="function"?new Map:void 0;return ku=function(n){if(n===null||!Ug(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return ts(n,arguments,Ra(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Da(i,n)},ku(r)}function ts(r,e,t){return $d()?ts=Reflect.construct:ts=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Da(u,o.prototype),u},ts.apply(null,arguments)}function $d(){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 Ug(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Da(r,e){return Da=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Da(r,e)}function Ra(r){return Ra=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Ra(r)}var qg=function(r){Mg(t,r);var e=jg(t);function t(n,i,a,o,s,c,u){var l,p,d,f;$g(this,t),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=gp(Array.isArray(i)?i:i?[i]:void 0);for(var m=[],h=0,g=(b=f.nodes)!==null&&b!==void 0?b:[];h<g.length;h++){var b,v=g[h],S=v.loc;S!=null&&m.push(S)}m=gp(m),f.source=a??((l=m)===null||l===void 0?void 0:l[0].source),f.positions=o??((p=m)===null||p===void 0?void 0:p.map(function(k){return k.start})),f.locations=o&&a?o.map(function(k){return Iu(a,k)}):(d=m)===null||d===void 0?void 0:d.map(function(k){return Iu(k.source,k.start)}),f.path=s??void 0;var y=c?.extensions;return u==null&&Dg(y)?f.extensions=Pg({},y):f.extensions=u??{},Object.defineProperties(ca(f),{message:{enumerable:!0},locations:{enumerable:f.locations!=null},path:{enumerable:f.path!=null},extensions:{enumerable:f.extensions!=null&&Object.keys(f.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(ca(f),"stack",{value:c.stack,writable:!0,configurable:!0}),Ld(f)):(Error.captureStackTrace?Error.captureStackTrace(ca(f),t):Object.defineProperty(ca(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Fg(t,[{key:"toString",value:function(){return Bg(this)}},{key:Cd,get:function(){return"Object"}}]),t}(ku(Error));function gp(r){return r===void 0||r.length===0?void 0:r}function Bg(r){var e=r.message;if(r.nodes)for(var t=0,n=r.nodes;t<n.length;t++){var i=n[t];i.loc&&(e+=`
|
|
54
54
|
|
|
55
|
-
`+
|
|
55
|
+
`+Rg(i.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
|
|
56
56
|
|
|
57
|
-
`+
|
|
58
|
-
`)}function
|
|
59
|
-
`;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=uy(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw vt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw vt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw vt(r,o,"Unterminated string.")}function cy(r,e,t,n,i,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Re(N.BLOCK_STRING,e,s+3,t,n,i,Xg(l));if(u<32&&u!==9&&u!==10&&u!==13)throw vt(r,s,"Invalid character within String: ".concat(An(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw vt(r,s,"Unterminated string.")}function uy(r,e,t,n){return Mo(r)<<12|Mo(e)<<8|Mo(t)<<4|Mo(n)}function Mo(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function ly(r,e,t,n,i){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Re(N.NAME,e,s,t,n,i,a.slice(e,s))}function fy(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function py(r,e){var t=new dy(r,e);return t.parseDocument()}var dy=function(){function r(t,n){var i=Yg(t)?t:new jd(t);this._lexer=new ty(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(N.NAME);return{kind:V.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:V.DOCUMENT,definitions:this.many(N.SOF,this.parseDefinition,N.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(N.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(N.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(N.BRACE_L))return{kind:V.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(N.NAME)&&(a=this.parseName()),{kind:V.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(N.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(N.PAREN_L,this.parseVariableDefinition,N.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:V.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(N.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(N.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(N.DOLLAR),{kind:V.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:V.SELECTION_SET,selections:this.many(N.BRACE_L,this.parseSelection,N.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(N.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(N.COLON)?(a=i,o=this.parseName()):o=i,{kind:V.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(N.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(N.PAREN_L,i,N.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(N.COLON),{kind:V.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:V.ARGUMENT,name:this.parseName(),value:(this.expectToken(N.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(N.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(N.NAME)?{kind:V.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:V.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:V.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:V.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case N.BRACKET_L:return this.parseList(n);case N.BRACE_L:return this.parseObject(n);case N.INT:return this._lexer.advance(),{kind:V.INT,value:i.value,loc:this.loc(i)};case N.FLOAT:return this._lexer.advance(),{kind:V.FLOAT,value:i.value,loc:this.loc(i)};case N.STRING:case N.BLOCK_STRING:return this.parseStringLiteral();case N.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:V.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:V.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:V.NULL,loc:this.loc(i)};default:return{kind:V.ENUM,value:i.value,loc:this.loc(i)}}case N.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:V.STRING,value:n.value,block:n.kind===N.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:V.LIST,values:this.any(N.BRACKET_L,o,N.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:V.OBJECT,fields:this.any(N.BRACE_L,o,N.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(N.COLON),{kind:V.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(N.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(N.AT),{kind:V.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(N.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(N.BRACKET_R),i={kind:V.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(N.BANG)?{kind:V.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:V.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===N.NAME)switch(n.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(n)},e.peekDescription=function(){return this.peek(N.STRING)||this.peek(N.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);return{kind:V.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(N.COLON);var a=this.parseNamedType();return{kind:V.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:V.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:V.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(N.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(N.AMP)||this.peek(N.NAME));return i}return this.delimitedMany(N.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(N.BRACE_L)&&this._lexer.lookahead().kind===N.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(N.BRACE_L,this.parseFieldDefinition,N.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(N.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:V.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(N.PAREN_L,this.parseInputValueDef,N.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(N.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(N.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:V.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:V.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:V.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(N.EQUALS)?this.delimitedMany(N.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:V.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseEnumValueDefinition,N.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:V.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:V.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseInputValueDef,N.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===N.NAME)switch(n.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(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:V.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:V.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:V.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:V.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(N.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:V.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(N.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Zg[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Fd(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw vt(this._lexer.source,i.start,"Expected ".concat(Ud(n),", found ").concat(su(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===N.NAME&&i.value===n)this._lexer.advance();else throw vt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(su(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===N.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return vt(this._lexer.source,i.start,"Unexpected ".concat(su(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},r}();function su(r){var e=r.value;return Ud(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Ud(r){return ry(r)?'"'.concat(r,'"'):r}var rs=new Map,ku=new Map,qd=!0,ms=!1;function Bd(r){return r.replace(/[\s,]+/g," ").trim()}function hy(r){return Bd(r.source.body.substring(r.start,r.end))}function my(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=hy(n.loc),o=ku.get(i);o&&!o.has(a)?qd&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
57
|
+
`+Pd(r.source,s)}return e}function vt(r,e,t){return new qg("Syntax Error: ".concat(t),void 0,r,[e])}var Q=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 Vg(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Qg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Tu=Qg;function Fd(r){var e=r.prototype.toJSON;typeof e=="function"||Vg(0),r.prototype.inspect=e,Tu&&(r.prototype[Tu]=e)}var Md=function(){function r(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Fd(Md);var Ce=function(){function r(t,n,i,a,o,s,c){this.kind=t,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Fd(Ce);var D=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 rs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?rs=function(t){return typeof t}:rs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rs(r)}var zg=10,jd=2;function Wg(r){return js(r,[])}function js(r,e){switch(rs(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Gg(r,e);default:return String(r)}}function Gg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Jg(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:js(i,t)}else if(Array.isArray(r))return Kg(r,t);return Hg(r,t)}function Hg(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>jd)return"["+Yg(r)+"]";var n=t.map(function(i){var a=js(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Kg(r,e){if(r.length===0)return"[]";if(e.length>jd)return"[Array]";for(var t=Math.min(zg,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(js(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Jg(r){var e=r[String(Tu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Yg(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ou(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var Zg=function(e,t){return e instanceof t};function yp(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Xg(r,e,t){return e&&yp(r.prototype,e),t&&yp(r,t),r}var Ud=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ou(0,"Body must be a string. Received: ".concat(Wg(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ou(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ou(0,"column in locationOffset is 1-indexed and must be positive.")}return Xg(r,[{key:Cd,get:function(){return"Source"}}]),r}();function ey(r){return Zg(r,Ud)}var ty=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 ry(r){var e=r.split(/\r\n|[\n\r]/g),t=ny(r);if(t!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(t);for(var i=0;i<e.length&&vp(e[i]);)++i;for(var a=e.length;a>i&&vp(e[a-1]);)--a;return e.slice(i,a).join(`
|
|
58
|
+
`)}function vp(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function ny(r){for(var e,t=!0,n=!0,i=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!t&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var iy=function(){function r(t){var n=new Ce(D.SOF,0,0,0,0,null);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==D.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=oy(this,n)}while(n.kind===D.COMMENT);return n},r}();function ay(r){return r===D.BANG||r===D.DOLLAR||r===D.AMP||r===D.PAREN_L||r===D.PAREN_R||r===D.SPREAD||r===D.COLON||r===D.EQUALS||r===D.AT||r===D.BRACKET_L||r===D.BRACKET_R||r===D.BRACE_L||r===D.PIPE||r===D.BRACE_R}function An(r){return isNaN(r)?D.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function oy(r,e){for(var t=r.source,n=t.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Ce(D.BANG,a,a+1,s,c,e);case 35:return cy(t,a,s,c,e);case 36:return new Ce(D.DOLLAR,a,a+1,s,c,e);case 38:return new Ce(D.AMP,a,a+1,s,c,e);case 40:return new Ce(D.PAREN_L,a,a+1,s,c,e);case 41:return new Ce(D.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Ce(D.SPREAD,a,a+3,s,c,e);break;case 58:return new Ce(D.COLON,a,a+1,s,c,e);case 61:return new Ce(D.EQUALS,a,a+1,s,c,e);case 64:return new Ce(D.AT,a,a+1,s,c,e);case 91:return new Ce(D.BRACKET_L,a,a+1,s,c,e);case 93:return new Ce(D.BRACKET_R,a,a+1,s,c,e);case 123:return new Ce(D.BRACE_L,a,a+1,s,c,e);case 124:return new Ce(D.PIPE,a,a+1,s,c,e);case 125:return new Ce(D.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?fy(t,a,s,c,e,r):ly(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return uy(t,a,o,s,c,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return dy(t,a,s,c,e)}throw vt(t,a,sy(o))}var u=r.line,l=1+a-r.lineStart;return new Ce(D.EOF,i,i,u,l,e)}function sy(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(An(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(An(r),".")}function cy(r,e,t,n,i){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Ce(D.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function uy(r,e,t,n,i,a){var o=r.body,s=t,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw vt(r,c,"Invalid number, unexpected digit after 0: ".concat(An(s),"."))}else c=su(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=su(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(u=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=su(r,c,s),s=o.charCodeAt(c)),s===46||hy(s))throw vt(r,c,"Invalid number, expected digit but got: ".concat(An(s),"."));return new Ce(u?D.FLOAT:D.INT,e,c,n,i,a,o.slice(e,c))}function su(r,e,t){var n=r.body,i=e,a=t;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw vt(r,i,"Invalid number, expected digit but got: ".concat(An(a),"."))}function ly(r,e,t,n,i){for(var a=r.body,o=e+1,s=o,c=0,u="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return u+=a.slice(s,o),new Ce(D.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw vt(r,o,"Invalid character within String: ".concat(An(c),"."));if(++o,c===92){switch(u+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
|
|
59
|
+
`;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=py(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var p=a.slice(o+1,o+5);throw vt(r,o,"Invalid character escape sequence: \\u".concat(p,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw vt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw vt(r,o,"Unterminated string.")}function fy(r,e,t,n,i,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Ce(D.BLOCK_STRING,e,s+3,t,n,i,ry(l));if(u<32&&u!==9&&u!==10&&u!==13)throw vt(r,s,"Invalid character within String: ".concat(An(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw vt(r,s,"Unterminated string.")}function py(r,e,t,n){return jo(r)<<12|jo(e)<<8|jo(t)<<4|jo(n)}function jo(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function dy(r,e,t,n,i){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Ce(D.NAME,e,s,t,n,i,a.slice(e,s))}function hy(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function my(r,e){var t=new gy(r,e);return t.parseDocument()}var gy=function(){function r(t,n){var i=ey(t)?t:new Ud(t);this._lexer=new iy(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(D.NAME);return{kind:Q.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:Q.DOCUMENT,definitions:this.many(D.SOF,this.parseDefinition,D.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(D.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(D.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(D.BRACE_L))return{kind:Q.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(D.NAME)&&(a=this.parseName()),{kind:Q.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(D.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(D.PAREN_L,this.parseVariableDefinition,D.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:Q.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(D.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(D.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(D.DOLLAR),{kind:Q.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:Q.SELECTION_SET,selections:this.many(D.BRACE_L,this.parseSelection,D.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(D.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(D.COLON)?(a=i,o=this.parseName()):o=i,{kind:Q.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(D.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(D.PAREN_L,i,D.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(D.COLON),{kind:Q.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:Q.ARGUMENT,name:this.parseName(),value:(this.expectToken(D.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(D.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(D.NAME)?{kind:Q.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:Q.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case D.BRACKET_L:return this.parseList(n);case D.BRACE_L:return this.parseObject(n);case D.INT:return this._lexer.advance(),{kind:Q.INT,value:i.value,loc:this.loc(i)};case D.FLOAT:return this._lexer.advance(),{kind:Q.FLOAT,value:i.value,loc:this.loc(i)};case D.STRING:case D.BLOCK_STRING:return this.parseStringLiteral();case D.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:Q.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:Q.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:Q.NULL,loc:this.loc(i)};default:return{kind:Q.ENUM,value:i.value,loc:this.loc(i)}}case D.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:Q.STRING,value:n.value,block:n.kind===D.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:Q.LIST,values:this.any(D.BRACKET_L,o,D.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:Q.OBJECT,fields:this.any(D.BRACE_L,o,D.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(D.COLON),{kind:Q.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(D.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(D.AT),{kind:Q.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(D.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(D.BRACKET_R),i={kind:Q.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(D.BANG)?{kind:Q.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:Q.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===D.NAME)switch(n.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(n)},e.peekDescription=function(){return this.peek(D.STRING)||this.peek(D.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(D.BRACE_L,this.parseOperationTypeDefinition,D.BRACE_R);return{kind:Q.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(D.COLON);var a=this.parseNamedType();return{kind:Q.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:Q.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(D.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(D.AMP)||this.peek(D.NAME));return i}return this.delimitedMany(D.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(D.BRACE_L)&&this._lexer.lookahead().kind===D.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(D.BRACE_L,this.parseFieldDefinition,D.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(D.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:Q.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(D.PAREN_L,this.parseInputValueDef,D.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(D.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(D.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:Q.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:Q.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:Q.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(D.EQUALS)?this.delimitedMany(D.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:Q.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(D.BRACE_L,this.parseEnumValueDefinition,D.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:Q.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(D.BRACE_L,this.parseInputValueDef,D.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===D.NAME)switch(n.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(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(D.BRACE_L,this.parseOperationTypeDefinition,D.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:Q.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:Q.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:Q.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:Q.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(D.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:Q.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(D.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(ty[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Md(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw vt(this._lexer.source,i.start,"Expected ".concat(qd(n),", found ").concat(cu(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===D.NAME&&i.value===n)this._lexer.advance();else throw vt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(cu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===D.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return vt(this._lexer.source,i.start,"Unexpected ".concat(cu(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},r}();function cu(r){var e=r.value;return qd(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function qd(r){return ay(r)?'"'.concat(r,'"'):r}var ns=new Map,Au=new Map,Bd=!0,gs=!1;function Vd(r){return r.replace(/[\s,]+/g," ").trim()}function yy(r){return Vd(r.source.body.substring(r.start,r.end))}function vy(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=yy(n.loc),o=Au.get(i);o&&!o.has(a)?Bd&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
60
60
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
61
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||ku.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),hs(hs({},r),{definitions:t})}function gy(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function yy(r){var e=Bd(r);if(!rs.has(e)){var t=py(r,{experimentalFragmentVariables:ms,allowLegacyFragmentVariables:ms});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");rs.set(e,gy(my(t)))}return rs.get(e)}function x(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),yy(n)}function vy(){rs.clear(),ku.clear()}function by(){qd=!1}function Sy(){ms=!0}function wy(){ms=!1}var na={gql:x,resetCaches:vy,disableFragmentWarnings:by,enableExperimentalFragmentVariables:Sy,disableExperimentalFragmentVariables:wy};(function(r){r.gql=na.gql,r.resetCaches=na.resetCaches,r.disableFragmentWarnings=na.disableFragmentWarnings,r.enableExperimentalFragmentVariables=na.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=na.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;function A(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function _y(){}function Zr(){return _y}var K=Zr,w=Zr,Qe=Zr,he=Zr,z=Zr,_t=Zr,Ey=Zr,Yu=Zr,Vd=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Qd=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},On=class{constructor(e){this.code=e}};Vd([w(),Qd("design:type",String)],On.prototype,"code",void 0);On=Vd([z(),Qd("design:paramtypes",[String])],On);var Zu=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Xu=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},tr=class{constructor(e,t){this.address=e,this.name=t}};Zu([w(),Xu("design:type",String)],tr.prototype,"address",void 0);Zu([w(),Xu("design:type",String)],tr.prototype,"name",void 0);tr=Zu([z(),Xu("design:paramtypes",[String,String])],tr);var xe=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},je=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Sr=class{constructor(e,t){this.key=t,this.signature=e}};xe([w(),je("design:type",String)],Sr.prototype,"signature",void 0);xe([w(),je("design:type",String)],Sr.prototype,"key",void 0);xe([w(),je("design:type",Boolean)],Sr.prototype,"valid",void 0);xe([w(),je("design:type",Boolean)],Sr.prototype,"invalid",void 0);Sr=xe([z(),Qe(),je("design:paramtypes",[String,String])],Sr);var Nn=class{};xe([w(),je("design:type",String)],Nn.prototype,"signature",void 0);xe([w(),je("design:type",String)],Nn.prototype,"key",void 0);xe([w(),je("design:type",Boolean)],Nn.prototype,"valid",void 0);xe([w(),je("design:type",Boolean)],Nn.prototype,"invalid",void 0);Nn=xe([Qe()],Nn);function Xr(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return xe([w(),je("design:type",String)],e.prototype,"author",void 0),xe([w(),je("design:type",String)],e.prototype,"timestamp",void 0),xe([w(),je("design:type",Object)],e.prototype,"data",void 0),xe([w(),je("design:type",Sr)],e.prototype,"proof",void 0),e=xe([z(),je("design:paramtypes",[String,String,Object,Sr])],e),e}function xy(r){let e=class{};return xe([w(),je("design:type",String)],e.prototype,"author",void 0),xe([w(),je("design:type",String)],e.prototype,"timestamp",void 0),xe([w(),je("design:type",Object)],e.prototype,"data",void 0),xe([w(),je("design:type",Nn)],e.prototype,"proof",void 0),e=xe([Qe()],e),e}var vp=class extends Xr(){};vp=xe([z()],vp);var gs=class extends Xr(){};xe([w(),je("design:type",tr)],gs.prototype,"language",void 0);xe([w(),je("design:type",On)],gs.prototype,"icon",void 0);gs=xe([z()],gs);function $T(r){return r&&r.author&&r.timestamp&&r.data}var Pe=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Je=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},pt=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Pe([w(),Je("design:type",String)],pt.prototype,"source",void 0);Pe([w(),Je("design:type",String)],pt.prototype,"target",void 0);Pe([w(),Je("design:type",String)],pt.prototype,"predicate",void 0);pt=Pe([z(),Je("design:paramtypes",[Object])],pt);var ys=class{};Pe([w(),Je("design:type",Array)],ys.prototype,"additions",void 0);Pe([w(),Je("design:type",Array)],ys.prototype,"removals",void 0);ys=Pe([Qe()],ys);var vs=class{constructor(e,t){this.additions=e,this.removals=t}};Pe([w(),Je("design:type",Array)],vs.prototype,"additions",void 0);Pe([w(),Je("design:type",Array)],vs.prototype,"removals",void 0);vs=Pe([z(),Je("design:paramtypes",[Array,Array])],vs);var Ra=class{};Pe([w(),Je("design:type",String)],Ra.prototype,"source",void 0);Pe([w(),Je("design:type",String)],Ra.prototype,"target",void 0);Pe([w(),Je("design:type",String)],Ra.prototype,"predicate",void 0);Ra=Pe([Qe()],Ra);var Wr=class extends Xr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),t=(t<<5)-t+i,t|=0;return t}};Pe([w(),Je("design:type",String)],Wr.prototype,"status",void 0);Wr=Pe([z()],Wr);var Au=class extends xy(){};Pe([w(),Je("design:type",String)],Au.prototype,"status",void 0);Au=Pe([Qe()],Au);function VT(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function QT(r){return r&&r.source&&r.target}var bs=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Pe([w(),Je("design:type",Wr)],bs.prototype,"oldLink",void 0);Pe([w(),Je("design:type",Wr)],bs.prototype,"newLink",void 0);bs=Pe([z(),Je("design:paramtypes",[Wr,Wr])],bs);var jn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},za=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ou,ar=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 n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(n=>n.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}};jn([w(),za("design:type",Array)],ar.prototype,"links",void 0);ar=jn([z(),za("design:paramtypes",[Array])],ar);var Ss=class{};jn([w(),za("design:type",Array)],Ss.prototype,"links",void 0);Ss=jn([Qe()],Ss);var Nu=Ou=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Ou;return t.links.push(e),t}};jn([w(),za("design:type",Array)],Nu.prototype,"links",void 0);Nu=Ou=jn([Qe(),za("design:paramtypes",[Array])],Nu);var Dn=class extends Xr(){};Dn=jn([z()],Dn);var M=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},j=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new ar}};M([w(),j("design:type",String)],qr.prototype,"did",void 0);M([w(),j("design:type",ar)],qr.prototype,"perspective",void 0);M([w(),j("design:type",String)],qr.prototype,"directMessageLanguage",void 0);qr=M([z(),j("design:paramtypes",[String,ar])],qr);var bp=class extends Xr(){};bp=M([z()],bp);var Gr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};M([w(),j("design:type",String)],Gr.prototype,"did",void 0);M([w(),j("design:type",String)],Gr.prototype,"didSigningKeyId",void 0);M([w(),j("design:type",String)],Gr.prototype,"deviceKeyType",void 0);M([w(),j("design:type",String)],Gr.prototype,"deviceKey",void 0);M([w(),j("design:type",String)],Gr.prototype,"deviceKeySignedByDid",void 0);M([w(),j("design:type",String)],Gr.prototype,"didSignedByDeviceKey",void 0);Gr=M([z(),j("design:paramtypes",[String,String,String,String,String,String])],Gr);var Kr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};M([w(),j("design:type",String)],Kr.prototype,"did",void 0);M([w(),j("design:type",String)],Kr.prototype,"didSigningKeyId",void 0);M([w(),j("design:type",String)],Kr.prototype,"deviceKeyType",void 0);M([w(),j("design:type",String)],Kr.prototype,"deviceKey",void 0);M([w(),j("design:type",String)],Kr.prototype,"deviceKeySignedByDid",void 0);M([w(),j("design:type",String)],Kr.prototype,"didSignedByDeviceKey",void 0);Kr=M([Qe(),j("design:paramtypes",[String,String,String,String,String,String])],Kr);var ws=class{constructor(e,t){this.signature=e,this.publicKey=t}};M([w(),j("design:type",String)],ws.prototype,"signature",void 0);M([w(),j("design:type",String)],ws.prototype,"publicKey",void 0);ws=M([z(),j("design:paramtypes",[String,String])],ws);var Si=class{constructor(e,t){this.domain=e,this.pointers=t}};M([w(),j("design:type",String)],Si.prototype,"domain",void 0);M([w(),j("design:type",Array)],Si.prototype,"pointers",void 0);Si=M([z(),j("design:paramtypes",[String,Array])],Si);var _s=class{constructor(e,t){this.with=e,this.can=t}};M([w(),j("design:type",Si)],_s.prototype,"with",void 0);M([w(),j("design:type",Array)],_s.prototype,"can",void 0);_s=M([z(),j("design:paramtypes",[Si,Array])],_s);var wr=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};M([w(),j("design:type",String)],wr.prototype,"appName",void 0);M([w(),j("design:type",String)],wr.prototype,"appDesc",void 0);M([w(),j("design:type",String)],wr.prototype,"appUrl",void 0);M([w(),j("design:type",String)],wr.prototype,"appIconPath",void 0);M([w(),j("design:type",Array)],wr.prototype,"capabilities",void 0);wr=M([z(),j("design:paramtypes",[String,String,String,Array,String])],wr);var wi=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};M([w(),j("design:type",String)],wi.prototype,"requestId",void 0);M([w(),j("design:type",String)],wi.prototype,"token",void 0);M([w(),j("design:type",Boolean)],wi.prototype,"revoked",void 0);M([w(),j("design:type",wr)],wi.prototype,"auth",void 0);wi=M([z(),j("design:paramtypes",[String,wr,String,Boolean])],wi);var _i=class{constructor(e,t){this.domain=e,this.pointers=t}};M([w(),j("design:type",String)],_i.prototype,"domain",void 0);M([w(),j("design:type",Array)],_i.prototype,"pointers",void 0);_i=M([Qe(),j("design:paramtypes",[String,Array])],_i);var Es=class{constructor(e,t){this.with=e,this.can=t}};M([w(),j("design:type",_i)],Es.prototype,"with",void 0);M([w(),j("design:type",Array)],Es.prototype,"can",void 0);Es=M([Qe(),j("design:paramtypes",[_i,Array])],Es);var or=class{constructor(e,t,n,i,a,o){this.appName=e,this.appDesc=t,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};M([w(),j("design:type",String)],or.prototype,"appName",void 0);M([w(),j("design:type",String)],or.prototype,"appDesc",void 0);M([w(),j("design:type",String)],or.prototype,"appDomain",void 0);M([w(),j("design:type",String)],or.prototype,"appUrl",void 0);M([w(),j("design:type",String)],or.prototype,"appIconPath",void 0);M([w(),j("design:type",Array)],or.prototype,"capabilities",void 0);or=M([Qe(),j("design:paramtypes",[String,String,String,String,String,Array])],or);var Rn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};M([w(),j("design:type",String)],Rn.prototype,"did",void 0);M([w(),j("design:type",Boolean)],Rn.prototype,"success",void 0);M([w(),j("design:type",String)],Rn.prototype,"error",void 0);Rn=M([z(),j("design:paramtypes",[String,Boolean,String])],Rn);var Ni=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Di=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ot=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Ni([w(),Di("design:type",Boolean)],Ot.prototype,"isInitialized",void 0);Ni([w(),Di("design:type",Boolean)],Ot.prototype,"isUnlocked",void 0);Ni([w(),Di("design:type",String)],Ot.prototype,"did",void 0);Ni([w(),Di("design:type",String)],Ot.prototype,"didDocument",void 0);Ni([w(),Di("design:type",String)],Ot.prototype,"error",void 0);Ot=Ni([z(),Di("design:paramtypes",[Object])],Ot);var Sp=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ne=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ut,lt,Du=class{constructor(e,t){ut.set(this,void 0),lt.set(this,void 0),Sp(this,ut,e,"f"),Sp(this,lt,t,"f")}async otherAgents(){return await Ne(this,ut,"f").otherAgents(Ne(this,lt,"f"))}async hasTelepresenceAdapter(){return await Ne(this,ut,"f").hasTelepresenceAdapter(Ne(this,lt,"f"))}async onlineAgents(){return await Ne(this,ut,"f").onlineAgents(Ne(this,lt,"f"))}async setOnlineStatus(e){return await Ne(this,ut,"f").setOnlineStatus(Ne(this,lt,"f"),e)}async setOnlineStatusU(e){return await Ne(this,ut,"f").setOnlineStatusU(Ne(this,lt,"f"),e)}async sendSignal(e,t){return await Ne(this,ut,"f").sendSignal(Ne(this,lt,"f"),e,t)}async sendSignalU(e,t){return await Ne(this,ut,"f").sendSignalU(Ne(this,lt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Ne(this,ut,"f").sendBroadcast(Ne(this,lt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Ne(this,ut,"f").sendBroadcastU(Ne(this,lt,"f"),e,t)}async addSignalHandler(e){await Ne(this,ut,"f").addSignalHandler(Ne(this,lt,"f"),e)}removeSignalHandler(e){Ne(this,ut,"f").removeSignalHandler(Ne(this,lt,"f"),e)}};ut=new WeakMap,lt=new WeakMap;var Un=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},qn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},le=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)}};Un([w(),qn("design:type",String)],le.prototype,"source",void 0);Un([w(),qn("design:type",String)],le.prototype,"target",void 0);Un([w(),qn("design:type",String)],le.prototype,"predicate",void 0);Un([w(),qn("design:type",Date)],le.prototype,"fromDate",void 0);Un([w(),qn("design:type",Date)],le.prototype,"untilDate",void 0);Un([w(),qn("design:type",Number)],le.prototype,"limit",void 0);le=Un([z(),Qe(),qn("design:paramtypes",[Object])],le);var wp=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ke=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ft,mr;function jo(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ve=class{constructor(){ft.set(this,void 0),mr.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 ve;return wp(t,mr,e,"f"),t}static from(e){let t=new ve;return wp(t,ft,e,"f"),t}toUrl(){if(Ke(this,mr,"f")&&!Ke(this,ft,"f"))return Ke(this,mr,"f");if(!Ke(this,mr,"f")&&(Ke(this,ft,"f")===void 0||Ke(this,ft,"f")===""||Ke(this,ft,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ke(this,ft,"f")){case"string":e=`string:${jo(Ke(this,ft,"f"))}`;break;case"number":e=`number:${jo(Ke(this,ft,"f"))}`;break;case"boolean":e=`boolean:${jo(Ke(this,ft,"f"))}`;break;case"object":e=`json:${jo(JSON.stringify(Ke(this,ft,"f")))}`;break}return`literal://${e}`}get(){if(Ke(this,ft,"f"))return Ke(this,ft,"f");if(!Ke(this,mr,"f"))throw new Error("Can't render empty Literal");if(!Ke(this,mr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ke(this,mr,"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}`)}};ft=new WeakMap,mr=new WeakMap;function Ut(r){return r.charAt(0).toUpperCase()+r.slice(1)}function xs(r){return`set${Ut(r)}`}function zd(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function Iy(r){return`add${Ut(zd(r))}`}function Ty(r){return`remove${Ut(zd(r))}`}function ky(r){return`set${Ut(r)}`}function dn(r){if(Array.isArray(r))return`[${r.map(dn).join(", ")}]`;let e=Object.keys(r),t=[];for(let n of e){let i=JSON.stringify(r[n]),a=`${n}: ${i}`;t.push(a)}return`{${t.join(", ")}}`}var cu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},J=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},rt,nt,De,Ta=class{constructor(r,e,t){rt.set(this,void 0),nt.set(this,void 0),De.set(this,void 0),cu(this,rt,e,"f"),cu(this,nt,t,"f"),cu(this,De,r,"f")}get baseExpression(){return J(this,rt,"f")}async init(){let isInstance=await J(this,De,"f").isSubjectInstance(J(this,rt,"f"),J(this,nt,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,nt,"f")} for ${J(this,rt,"f")}`;let results=await J(this,De,"f").infer(`subject_class("${J(this,nt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await J(this,De,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,De,"f").getPropertyValueViaSurreal(J(this,rt,"f"),J(this,nt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await J(this,De,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await J(this,De,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[xs(property)]=async r=>{resolveLanguage&&(r=await J(this,De,"f").createExpression(r,resolveLanguage)),await J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let results2=await J(this,De,"f").infer(`subject_class("${J(this,nt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,De,"f").getRelationValuesViaSurreal(J(this,rt,"f"),J(this,nt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await J(this,De,"f").infer(`subject_class("${J(this,nt,"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[Iy(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let removers=await J(this,De,"f").infer(`subject_class("${J(this,nt,"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[Ty(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let relationSetters=await J(this,De,"f").infer(`subject_class("${J(this,nt,"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[ky(relation)]=async r=>{Array.isArray(r)?await J(this,De,"f").executeAction(actions,J(this,rt,"f"),r.map(e=>({name:"value",value:e}))):await J(this,De,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}}};rt=new WeakMap,nt=new WeakMap,De=new WeakMap;function _p(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(0,e+1);let t=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let i=t[2],a=i.lastIndexOf("/");return a!==-1?t[1]+i.substring(0,a+1):t[1]}let n=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return n?n[1]:""}function Ep(r){return r.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 xp(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(e+1);let t=r.lastIndexOf("/");if(t!==-1&&t<r.length-1)return r.substring(t+1);let n=r.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return n?n[1]:r}var Br=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=_p(e),i=xp(e);this.nodeShapeUri=`${n}${i}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#> .
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Au.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),ms(ms({},r),{definitions:t})}function by(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Sy(r){var e=Vd(r);if(!ns.has(e)){var t=my(r,{experimentalFragmentVariables:gs,allowLegacyFragmentVariables:gs});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ns.set(e,by(vy(t)))}return ns.get(e)}function x(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),Sy(n)}function wy(){ns.clear(),Au.clear()}function _y(){Bd=!1}function Ey(){gs=!0}function xy(){gs=!1}var ia={gql:x,resetCaches:wy,disableFragmentWarnings:_y,enableExperimentalFragmentVariables:Ey,disableExperimentalFragmentVariables:xy};(function(r){r.gql=ia.gql,r.resetCaches=ia.resetCaches,r.disableFragmentWarnings=ia.disableFragmentWarnings,r.enableExperimentalFragmentVariables=ia.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=ia.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;function A(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Iy(){}function Xr(){return Iy}var H=Xr,w=Xr,Qe=Xr,he=Xr,z=Xr,_t=Xr,ky=Xr,Zu=Xr,Qd=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},zd=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},On=class{constructor(e){this.code=e}};Qd([w(),zd("design:type",String)],On.prototype,"code",void 0);On=Qd([z(),zd("design:paramtypes",[String])],On);var Xu=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},el=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},tr=class{constructor(e,t){this.address=e,this.name=t}};Xu([w(),el("design:type",String)],tr.prototype,"address",void 0);Xu([w(),el("design:type",String)],tr.prototype,"name",void 0);tr=Xu([z(),el("design:paramtypes",[String,String])],tr);var Ie=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},je=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Sr=class{constructor(e,t){this.key=t,this.signature=e}};Ie([w(),je("design:type",String)],Sr.prototype,"signature",void 0);Ie([w(),je("design:type",String)],Sr.prototype,"key",void 0);Ie([w(),je("design:type",Boolean)],Sr.prototype,"valid",void 0);Ie([w(),je("design:type",Boolean)],Sr.prototype,"invalid",void 0);Sr=Ie([z(),Qe(),je("design:paramtypes",[String,String])],Sr);var Nn=class{};Ie([w(),je("design:type",String)],Nn.prototype,"signature",void 0);Ie([w(),je("design:type",String)],Nn.prototype,"key",void 0);Ie([w(),je("design:type",Boolean)],Nn.prototype,"valid",void 0);Ie([w(),je("design:type",Boolean)],Nn.prototype,"invalid",void 0);Nn=Ie([Qe()],Nn);function en(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ie([w(),je("design:type",String)],e.prototype,"author",void 0),Ie([w(),je("design:type",String)],e.prototype,"timestamp",void 0),Ie([w(),je("design:type",Object)],e.prototype,"data",void 0),Ie([w(),je("design:type",Sr)],e.prototype,"proof",void 0),e=Ie([z(),je("design:paramtypes",[String,String,Object,Sr])],e),e}function Ty(r){let e=class{};return Ie([w(),je("design:type",String)],e.prototype,"author",void 0),Ie([w(),je("design:type",String)],e.prototype,"timestamp",void 0),Ie([w(),je("design:type",Object)],e.prototype,"data",void 0),Ie([w(),je("design:type",Nn)],e.prototype,"proof",void 0),e=Ie([Qe()],e),e}var bp=class extends en(){};bp=Ie([z()],bp);var ys=class extends en(){};Ie([w(),je("design:type",tr)],ys.prototype,"language",void 0);Ie([w(),je("design:type",On)],ys.prototype,"icon",void 0);ys=Ie([z()],ys);function Uk(r){return r&&r.author&&r.timestamp&&r.data}var Le=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Je=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},pt=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Le([w(),Je("design:type",String)],pt.prototype,"source",void 0);Le([w(),Je("design:type",String)],pt.prototype,"target",void 0);Le([w(),Je("design:type",String)],pt.prototype,"predicate",void 0);pt=Le([z(),Je("design:paramtypes",[Object])],pt);var vs=class{};Le([w(),Je("design:type",Array)],vs.prototype,"additions",void 0);Le([w(),Je("design:type",Array)],vs.prototype,"removals",void 0);vs=Le([Qe()],vs);var bs=class{constructor(e,t){this.additions=e,this.removals=t}};Le([w(),Je("design:type",Array)],bs.prototype,"additions",void 0);Le([w(),Je("design:type",Array)],bs.prototype,"removals",void 0);bs=Le([z(),Je("design:paramtypes",[Array,Array])],bs);var Ca=class{};Le([w(),Je("design:type",String)],Ca.prototype,"source",void 0);Le([w(),Je("design:type",String)],Ca.prototype,"target",void 0);Le([w(),Je("design:type",String)],Ca.prototype,"predicate",void 0);Ca=Le([Qe()],Ca);var Gr=class extends en(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),t=(t<<5)-t+i,t|=0;return t}};Le([w(),Je("design:type",String)],Gr.prototype,"status",void 0);Gr=Le([z()],Gr);var Ou=class extends Ty(){};Le([w(),Je("design:type",String)],Ou.prototype,"status",void 0);Ou=Le([Qe()],Ou);function Gk(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function Hk(r){return r&&r.source&&r.target}var Ss=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Le([w(),Je("design:type",Gr)],Ss.prototype,"oldLink",void 0);Le([w(),Je("design:type",Gr)],Ss.prototype,"newLink",void 0);Ss=Le([z(),Je("design:paramtypes",[Gr,Gr])],Ss);var jn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Wa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Nu,ar=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 n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(n=>n.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}};jn([w(),Wa("design:type",Array)],ar.prototype,"links",void 0);ar=jn([z(),Wa("design:paramtypes",[Array])],ar);var ws=class{};jn([w(),Wa("design:type",Array)],ws.prototype,"links",void 0);ws=jn([Qe()],ws);var Du=Nu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Nu;return t.links.push(e),t}};jn([w(),Wa("design:type",Array)],Du.prototype,"links",void 0);Du=Nu=jn([Qe(),Wa("design:paramtypes",[Array])],Du);var Dn=class extends en(){};Dn=jn([z()],Dn);var j=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},U=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new ar}};j([w(),U("design:type",String)],qr.prototype,"did",void 0);j([w(),U("design:type",ar)],qr.prototype,"perspective",void 0);j([w(),U("design:type",String)],qr.prototype,"directMessageLanguage",void 0);qr=j([z(),U("design:paramtypes",[String,ar])],qr);var Sp=class extends en(){};Sp=j([z()],Sp);var Hr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([w(),U("design:type",String)],Hr.prototype,"did",void 0);j([w(),U("design:type",String)],Hr.prototype,"didSigningKeyId",void 0);j([w(),U("design:type",String)],Hr.prototype,"deviceKeyType",void 0);j([w(),U("design:type",String)],Hr.prototype,"deviceKey",void 0);j([w(),U("design:type",String)],Hr.prototype,"deviceKeySignedByDid",void 0);j([w(),U("design:type",String)],Hr.prototype,"didSignedByDeviceKey",void 0);Hr=j([z(),U("design:paramtypes",[String,String,String,String,String,String])],Hr);var Kr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([w(),U("design:type",String)],Kr.prototype,"did",void 0);j([w(),U("design:type",String)],Kr.prototype,"didSigningKeyId",void 0);j([w(),U("design:type",String)],Kr.prototype,"deviceKeyType",void 0);j([w(),U("design:type",String)],Kr.prototype,"deviceKey",void 0);j([w(),U("design:type",String)],Kr.prototype,"deviceKeySignedByDid",void 0);j([w(),U("design:type",String)],Kr.prototype,"didSignedByDeviceKey",void 0);Kr=j([Qe(),U("design:paramtypes",[String,String,String,String,String,String])],Kr);var _s=class{constructor(e,t){this.signature=e,this.publicKey=t}};j([w(),U("design:type",String)],_s.prototype,"signature",void 0);j([w(),U("design:type",String)],_s.prototype,"publicKey",void 0);_s=j([z(),U("design:paramtypes",[String,String])],_s);var wi=class{constructor(e,t){this.domain=e,this.pointers=t}};j([w(),U("design:type",String)],wi.prototype,"domain",void 0);j([w(),U("design:type",Array)],wi.prototype,"pointers",void 0);wi=j([z(),U("design:paramtypes",[String,Array])],wi);var Es=class{constructor(e,t){this.with=e,this.can=t}};j([w(),U("design:type",wi)],Es.prototype,"with",void 0);j([w(),U("design:type",Array)],Es.prototype,"can",void 0);Es=j([z(),U("design:paramtypes",[wi,Array])],Es);var wr=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};j([w(),U("design:type",String)],wr.prototype,"appName",void 0);j([w(),U("design:type",String)],wr.prototype,"appDesc",void 0);j([w(),U("design:type",String)],wr.prototype,"appUrl",void 0);j([w(),U("design:type",String)],wr.prototype,"appIconPath",void 0);j([w(),U("design:type",Array)],wr.prototype,"capabilities",void 0);wr=j([z(),U("design:paramtypes",[String,String,String,Array,String])],wr);var _i=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};j([w(),U("design:type",String)],_i.prototype,"requestId",void 0);j([w(),U("design:type",String)],_i.prototype,"token",void 0);j([w(),U("design:type",Boolean)],_i.prototype,"revoked",void 0);j([w(),U("design:type",wr)],_i.prototype,"auth",void 0);_i=j([z(),U("design:paramtypes",[String,wr,String,Boolean])],_i);var Ei=class{constructor(e,t){this.domain=e,this.pointers=t}};j([w(),U("design:type",String)],Ei.prototype,"domain",void 0);j([w(),U("design:type",Array)],Ei.prototype,"pointers",void 0);Ei=j([Qe(),U("design:paramtypes",[String,Array])],Ei);var xs=class{constructor(e,t){this.with=e,this.can=t}};j([w(),U("design:type",Ei)],xs.prototype,"with",void 0);j([w(),U("design:type",Array)],xs.prototype,"can",void 0);xs=j([Qe(),U("design:paramtypes",[Ei,Array])],xs);var or=class{constructor(e,t,n,i,a,o){this.appName=e,this.appDesc=t,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};j([w(),U("design:type",String)],or.prototype,"appName",void 0);j([w(),U("design:type",String)],or.prototype,"appDesc",void 0);j([w(),U("design:type",String)],or.prototype,"appDomain",void 0);j([w(),U("design:type",String)],or.prototype,"appUrl",void 0);j([w(),U("design:type",String)],or.prototype,"appIconPath",void 0);j([w(),U("design:type",Array)],or.prototype,"capabilities",void 0);or=j([Qe(),U("design:paramtypes",[String,String,String,String,String,Array])],or);var Rn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};j([w(),U("design:type",String)],Rn.prototype,"did",void 0);j([w(),U("design:type",Boolean)],Rn.prototype,"success",void 0);j([w(),U("design:type",String)],Rn.prototype,"error",void 0);Rn=j([z(),U("design:paramtypes",[String,Boolean,String])],Rn);var Di=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Ri=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ot=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Di([w(),Ri("design:type",Boolean)],Ot.prototype,"isInitialized",void 0);Di([w(),Ri("design:type",Boolean)],Ot.prototype,"isUnlocked",void 0);Di([w(),Ri("design:type",String)],Ot.prototype,"did",void 0);Di([w(),Ri("design:type",String)],Ot.prototype,"didDocument",void 0);Di([w(),Ri("design:type",String)],Ot.prototype,"error",void 0);Ot=Di([z(),Ri("design:paramtypes",[Object])],Ot);var wp=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},De=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ut,lt,Ru=class{constructor(e,t){ut.set(this,void 0),lt.set(this,void 0),wp(this,ut,e,"f"),wp(this,lt,t,"f")}async otherAgents(){return await De(this,ut,"f").otherAgents(De(this,lt,"f"))}async hasTelepresenceAdapter(){return await De(this,ut,"f").hasTelepresenceAdapter(De(this,lt,"f"))}async onlineAgents(){return await De(this,ut,"f").onlineAgents(De(this,lt,"f"))}async setOnlineStatus(e){return await De(this,ut,"f").setOnlineStatus(De(this,lt,"f"),e)}async setOnlineStatusU(e){return await De(this,ut,"f").setOnlineStatusU(De(this,lt,"f"),e)}async sendSignal(e,t){return await De(this,ut,"f").sendSignal(De(this,lt,"f"),e,t)}async sendSignalU(e,t){return await De(this,ut,"f").sendSignalU(De(this,lt,"f"),e,t)}async sendBroadcast(e,t=!1){return await De(this,ut,"f").sendBroadcast(De(this,lt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await De(this,ut,"f").sendBroadcastU(De(this,lt,"f"),e,t)}async addSignalHandler(e){await De(this,ut,"f").addSignalHandler(De(this,lt,"f"),e)}removeSignalHandler(e){De(this,ut,"f").removeSignalHandler(De(this,lt,"f"),e)}};ut=new WeakMap,lt=new WeakMap;var Un=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},qn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},le=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)}};Un([w(),qn("design:type",String)],le.prototype,"source",void 0);Un([w(),qn("design:type",String)],le.prototype,"target",void 0);Un([w(),qn("design:type",String)],le.prototype,"predicate",void 0);Un([w(),qn("design:type",Date)],le.prototype,"fromDate",void 0);Un([w(),qn("design:type",Date)],le.prototype,"untilDate",void 0);Un([w(),qn("design:type",Number)],le.prototype,"limit",void 0);le=Un([z(),Qe(),qn("design:paramtypes",[Object])],le);var _p=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},He=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ft,mr;function Uo(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ve=class{constructor(){ft.set(this,void 0),mr.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 ve;return _p(t,mr,e,"f"),t}static from(e){let t=new ve;return _p(t,ft,e,"f"),t}toUrl(){if(He(this,mr,"f")&&!He(this,ft,"f"))return He(this,mr,"f");if(!He(this,mr,"f")&&(He(this,ft,"f")===void 0||He(this,ft,"f")===""||He(this,ft,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof He(this,ft,"f")){case"string":e=`string:${Uo(He(this,ft,"f"))}`;break;case"number":e=`number:${Uo(He(this,ft,"f"))}`;break;case"boolean":e=`boolean:${Uo(He(this,ft,"f"))}`;break;case"object":e=`json:${Uo(JSON.stringify(He(this,ft,"f")))}`;break}return`literal://${e}`}get(){if(He(this,ft,"f"))return He(this,ft,"f");if(!He(this,mr,"f"))throw new Error("Can't render empty Literal");if(!He(this,mr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=He(this,mr,"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}`)}};ft=new WeakMap,mr=new WeakMap;function Ut(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Is(r){return`set${Ut(r)}`}function Wd(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function Ay(r){return`add${Ut(Wd(r))}`}function Oy(r){return`remove${Ut(Wd(r))}`}function Ny(r){return`set${Ut(r)}`}function hn(r){if(Array.isArray(r))return`[${r.map(hn).join(", ")}]`;let e=Object.keys(r),t=[];for(let n of e){let i=JSON.stringify(r[n]),a=`${n}: ${i}`;t.push(a)}return`{${t.join(", ")}}`}var uu=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},J=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},rt,nt,Re,Ta=class{constructor(r,e,t){rt.set(this,void 0),nt.set(this,void 0),Re.set(this,void 0),uu(this,rt,e,"f"),uu(this,nt,t,"f"),uu(this,Re,r,"f")}get baseExpression(){return J(this,rt,"f")}async init(){let isInstance=await J(this,Re,"f").isSubjectInstance(J(this,rt,"f"),J(this,nt,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,nt,"f")} for ${J(this,rt,"f")}`;let results=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await J(this,Re,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Re,"f").getPropertyValueViaSurreal(J(this,rt,"f"),J(this,nt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Is(property)]=async r=>{resolveLanguage&&(r=await J(this,Re,"f").createExpression(r,resolveLanguage)),await J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let results2=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Re,"f").getRelationValuesViaSurreal(J(this,rt,"f"),J(this,nt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"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[Ay(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:e}]))):await J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let removers=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"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[Oy(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:e}]))):await J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}let relationSetters=await J(this,Re,"f").infer(`subject_class("${J(this,nt,"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[Ny(relation)]=async r=>{Array.isArray(r)?await J(this,Re,"f").executeAction(actions,J(this,rt,"f"),r.map(e=>({name:"value",value:e}))):await J(this,Re,"f").executeAction(actions,J(this,rt,"f"),[{name:"value",value:r}])}}}};rt=new WeakMap,nt=new WeakMap,Re=new WeakMap;function Ep(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(0,e+1);let t=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let i=t[2],a=i.lastIndexOf("/");return a!==-1?t[1]+i.substring(0,a+1):t[1]}let n=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return n?n[1]:""}function xp(r){return r.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 Ip(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(e+1);let t=r.lastIndexOf("/");if(t!==-1&&t<r.length-1)return r.substring(t+1);let n=r.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return n?n[1]:r}var Br=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=Ep(e),i=Ip(e);this.nodeShapeUri=`${n}${i}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#> .
|
|
62
62
|
`;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
63
63
|
`,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
64
64
|
`,e+=`@prefix ad4m: <ad4m://> .
|
|
@@ -73,42 +73,42 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
73
73
|
`),n.nodeKind&&(e+=` sh:nodeKind sh:${n.nodeKind} ;
|
|
74
74
|
`),n.minCount!==void 0&&(e+=` sh:minCount ${n.minCount} ;
|
|
75
75
|
`),n.maxCount!==void 0&&(e+=` sh:maxCount ${n.maxCount} ;
|
|
76
|
-
`),n.pattern&&(e+=` sh:pattern "${
|
|
76
|
+
`),n.pattern&&(e+=` sh:pattern "${xp(n.pattern)}" ;
|
|
77
77
|
`),n.minInclusive!==void 0&&(e+=` sh:minInclusive ${n.minInclusive} ;
|
|
78
78
|
`),n.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${n.maxInclusive} ;
|
|
79
|
-
`),n.hasValue&&(e+=` sh:hasValue "${
|
|
79
|
+
`),n.hasValue&&(e+=` sh:hasValue "${xp(n.hasValue)}" ;
|
|
80
80
|
`),n.local!==void 0&&(e+=` ad4m:local ${n.local} ;
|
|
81
81
|
`),n.writable!==void 0&&(e+=` ad4m:writable ${n.writable} ;
|
|
82
82
|
`),e=e.slice(0,-2)+`
|
|
83
83
|
`,e+=i?` ] .
|
|
84
84
|
`:` ] ;
|
|
85
|
-
`}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 n=this.properties[t],i;if(n.name&&this.targetClass){let a=_p(this.targetClass),o=xp(this.targetClass);i=`${a}${o}.${n.name}`}else i=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:i}),e.push({source:i,predicate:"sh://path",target:n.path}),n.datatype&&e.push({source:i,predicate:"sh://datatype",target:n.datatype}),n.nodeKind&&e.push({source:i,predicate:"sh://nodeKind",target:`sh://${n.nodeKind}`}),n.minCount!==void 0&&e.push({source:i,predicate:"sh://minCount",target:`literal://${n.minCount}^^xsd:integer`}),n.maxCount!==void 0&&e.push({source:i,predicate:"sh://maxCount",target:`literal://${n.maxCount}^^xsd:integer`}),n.pattern&&e.push({source:i,predicate:"sh://pattern",target:`literal://${n.pattern}`}),n.minInclusive!==void 0&&e.push({source:i,predicate:"sh://minInclusive",target:`literal://${n.minInclusive}`}),n.maxInclusive!==void 0&&e.push({source:i,predicate:"sh://maxInclusive",target:`literal://${n.maxInclusive}`}),n.hasValue&&e.push({source:i,predicate:"sh://hasValue",target:`literal://${n.hasValue}`}),n.local!==void 0&&e.push({source:i,predicate:"ad4m://local",target:`literal://${n.local}`}),n.writable!==void 0&&e.push({source:i,predicate:"ad4m://writable",target:`literal://${n.writable}`}),n.resolveLanguage&&e.push({source:i,predicate:"ad4m://resolveLanguage",target:`literal://string:${n.resolveLanguage}`}),n.setter&&n.setter.length>0&&e.push({source:i,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(n.setter)}`}),n.adder&&n.adder.length>0&&e.push({source:i,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(n.adder)}`}),n.remover&&n.remover.length>0&&e.push({source:i,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(n.remover)}`})}return e}static fromLinks(e,t){let n=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),i=new Br(t,n?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");i.constructor_actions=JSON.parse(c)}catch{}let o=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(o)try{let c=o.target.replace("literal://string:","");i.destructor_actions=JSON.parse(c)}catch{}let s=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of s){let u=c.target,l=e.find(I=>I.source===u&&I.predicate==="sh://path");if(!l)continue;let d;if(!u.startsWith("_:")){let I=u.lastIndexOf(".");I!==-1&&(d=u.substring(I+1))}let p={name:d,path:l.target},f=e.find(I=>I.source===u&&I.predicate==="sh://datatype");f&&(p.datatype=f.target);let h=e.find(I=>I.source===u&&I.predicate==="sh://nodeKind");h&&(p.nodeKind=h.target.replace("sh://",""));let m=e.find(I=>I.source===u&&I.predicate==="sh://minCount");if(m){let I=m.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),p.minCount=parseInt(I)}let g=e.find(I=>I.source===u&&I.predicate==="sh://maxCount");if(g){let I=g.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),p.maxCount=parseInt(I)}let S=e.find(I=>I.source===u&&I.predicate==="sh://pattern");S&&(p.pattern=S.target.replace("literal://",""));let b=e.find(I=>I.source===u&&I.predicate==="sh://minInclusive");if(b){let I=b.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),p.minInclusive=parseFloat(I)}let v=e.find(I=>I.source===u&&I.predicate==="sh://maxInclusive");if(v){let I=v.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),p.maxInclusive=parseFloat(I)}let y=e.find(I=>I.source===u&&I.predicate==="sh://hasValue");y&&(p.hasValue=y.target.replace("literal://",""));let k=e.find(I=>I.source===u&&I.predicate==="ad4m://local");if(k){let I=k.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),p.local=I==="true"}let R=e.find(I=>I.source===u&&I.predicate==="ad4m://writable");if(R){let I=R.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),p.writable=I==="true"}let T=e.find(I=>I.source===u&&I.predicate==="ad4m://resolveLanguage");T&&(p.resolveLanguage=T.target.replace("literal://string:",""));let P=e.find(I=>I.source===u&&I.predicate==="ad4m://setter");if(P)try{let I=P.target.replace("literal://string:","");p.setter=JSON.parse(I)}catch{}let $=e.find(I=>I.source===u&&I.predicate==="ad4m://adder");if($)try{let I=$.target.replace("literal://string:","");p.adder=JSON.parse(I)}catch{}let C=e.find(I=>I.source===u&&I.predicate==="ad4m://remover");if(C)try{let I=C.target.replace("literal://string:","");p.remover=JSON.parse(I)}catch{}i.addProperty(p)}return i}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Br(e.node_shape_uri,e.target_class):new Br(e.target_class);for(let n of e.properties||[])t.addProperty({path:n.path,name:n.name,datatype:n.datatype,nodeKind:n.node_kind,minCount:n.min_count,maxCount:n.max_count,minInclusive:n.min_inclusive,maxInclusive:n.max_inclusive,pattern:n.pattern,hasValue:n.has_value,local:n.local,writable:n.writable,resolveLanguage:n.resolve_language,setter:n.setter,adder:n.adder,remover:n.remover});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let n of e.parent_shapes)t.addParentShape(n);return t}},rr=new WeakMap,Xe=new WeakMap;function Tn(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=rr.get(i);a&&Object.assign(e,a)}return e}function Zt(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=Xe.get(i);a&&Object.assign(e,a)}return e}function Ay(r,e,t){rr.has(r)||rr.set(r,{}),rr.get(r)[e]=t}function Oy(r,e,t){Xe.has(r)||Xe.set(r,{}),Xe.get(r)[e]=t}function fk(r){let e=r.constructor,t=Tn(e),n={};for(let[i,a]of Object.entries(t))n[i]=r[i];return n}function Wd(r){let e="",t="abcdefghijklmnopqrstuvwxyz",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}var Ip=class{};function pk(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function dk(r){return`triple(this, "${r}", _)`}function js(r){return function(e,t){let n=r.readOnly?!1:!!r.through;if(r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let i=e.constructor;if(rr.has(i)||rr.set(i,{}),rr.get(i)[t]={...r,writable:n},n){let a=t;e[`set${Ut(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function hk(r){return js({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function mk(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");let n={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},i=e.constructor;rr.has(i)||rr.set(i,{}),rr.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Ny(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",n=r.name,i=e.prototype,a=Wd(8);t+=`subject_class("${n}", ${a}).
|
|
86
|
-
`;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let c=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(c=c.concat(i.isSubjectInstance));let u=[],l=
|
|
87
|
-
`,{through:
|
|
88
|
-
`,g+=`property_resolve_language(${a}, "${
|
|
89
|
-
`),T?g+=`property_getter(${a}, Base, "${
|
|
90
|
-
`:
|
|
91
|
-
`,
|
|
92
|
-
`;else if(k&&
|
|
93
|
-
`}u.push(g);let
|
|
94
|
-
`,{predicate:
|
|
95
|
-
`;let
|
|
96
|
-
`,g+=`collection_remover(${a}, "${
|
|
97
|
-
`,g+=`collection_setter(${a}, "${
|
|
98
|
-
`}
|
|
99
|
-
`,c.length>0){let
|
|
85
|
+
`}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 n=this.properties[t],i;if(n.name&&this.targetClass){let a=Ep(this.targetClass),o=Ip(this.targetClass);i=`${a}${o}.${n.name}`}else i=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:i}),e.push({source:i,predicate:"sh://path",target:n.path}),n.datatype&&e.push({source:i,predicate:"sh://datatype",target:n.datatype}),n.nodeKind&&e.push({source:i,predicate:"sh://nodeKind",target:`sh://${n.nodeKind}`}),n.minCount!==void 0&&e.push({source:i,predicate:"sh://minCount",target:`literal://${n.minCount}^^xsd:integer`}),n.maxCount!==void 0&&e.push({source:i,predicate:"sh://maxCount",target:`literal://${n.maxCount}^^xsd:integer`}),n.pattern&&e.push({source:i,predicate:"sh://pattern",target:`literal://${n.pattern}`}),n.minInclusive!==void 0&&e.push({source:i,predicate:"sh://minInclusive",target:`literal://${n.minInclusive}`}),n.maxInclusive!==void 0&&e.push({source:i,predicate:"sh://maxInclusive",target:`literal://${n.maxInclusive}`}),n.hasValue&&e.push({source:i,predicate:"sh://hasValue",target:`literal://${n.hasValue}`}),n.local!==void 0&&e.push({source:i,predicate:"ad4m://local",target:`literal://${n.local}`}),n.writable!==void 0&&e.push({source:i,predicate:"ad4m://writable",target:`literal://${n.writable}`}),n.resolveLanguage&&e.push({source:i,predicate:"ad4m://resolveLanguage",target:`literal://string:${n.resolveLanguage}`}),n.setter&&n.setter.length>0&&e.push({source:i,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(n.setter)}`}),n.adder&&n.adder.length>0&&e.push({source:i,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(n.adder)}`}),n.remover&&n.remover.length>0&&e.push({source:i,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(n.remover)}`}),n.getter&&e.push({source:i,predicate:"ad4m://getter",target:`literal://string:${n.getter}`}),n.conformanceConditions&&n.conformanceConditions.length>0&&e.push({source:i,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(n.conformanceConditions)}`}),n.class&&e.push({source:i,predicate:"sh://class",target:n.class})}return e}static fromLinks(e,t){let n=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),i=new Br(t,n?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");i.constructor_actions=JSON.parse(c)}catch{}let o=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(o)try{let c=o.target.replace("literal://string:","");i.destructor_actions=JSON.parse(c)}catch{}let s=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of s){let u=c.target,l=e.find(I=>I.source===u&&I.predicate==="sh://path");if(!l)continue;let p;if(!u.startsWith("_:")){let I=u.lastIndexOf(".");I!==-1&&(p=u.substring(I+1))}let d={name:p,path:l.target},f=e.find(I=>I.source===u&&I.predicate==="sh://datatype");f&&(d.datatype=f.target);let m=e.find(I=>I.source===u&&I.predicate==="sh://nodeKind");m&&(d.nodeKind=m.target.replace("sh://",""));let h=e.find(I=>I.source===u&&I.predicate==="sh://minCount");if(h){let I=h.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),d.minCount=parseInt(I)}let g=e.find(I=>I.source===u&&I.predicate==="sh://maxCount");if(g){let I=g.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),d.maxCount=parseInt(I)}let b=e.find(I=>I.source===u&&I.predicate==="sh://pattern");b&&(d.pattern=b.target.replace("literal://",""));let v=e.find(I=>I.source===u&&I.predicate==="sh://minInclusive");if(v){let I=v.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),d.minInclusive=parseFloat(I)}let S=e.find(I=>I.source===u&&I.predicate==="sh://maxInclusive");if(S){let I=S.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),d.maxInclusive=parseFloat(I)}let y=e.find(I=>I.source===u&&I.predicate==="sh://hasValue");y&&(d.hasValue=y.target.replace("literal://",""));let k=e.find(I=>I.source===u&&I.predicate==="ad4m://local");if(k){let I=k.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),d.local=I==="true"}let N=e.find(I=>I.source===u&&I.predicate==="ad4m://writable");if(N){let I=N.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),d.writable=I==="true"}let T=e.find(I=>I.source===u&&I.predicate==="ad4m://resolveLanguage");T&&(d.resolveLanguage=T.target.replace("literal://string:",""));let C=e.find(I=>I.source===u&&I.predicate==="ad4m://setter");if(C)try{let I=C.target.replace("literal://string:","");d.setter=JSON.parse(I)}catch{}let $=e.find(I=>I.source===u&&I.predicate==="ad4m://adder");if($)try{let I=$.target.replace("literal://string:","");d.adder=JSON.parse(I)}catch{}let P=e.find(I=>I.source===u&&I.predicate==="ad4m://remover");if(P)try{let I=P.target.replace("literal://string:","");d.remover=JSON.parse(I)}catch{}let M=e.find(I=>I.source===u&&I.predicate==="ad4m://getter");M&&(d.getter=M.target.replace("literal://string:",""));let we=e.find(I=>I.source===u&&I.predicate==="ad4m://conformanceConditions");if(we)try{let I=we.target.replace("literal://string:","");d.conformanceConditions=JSON.parse(I)}catch{}let ke=e.find(I=>I.source===u&&I.predicate==="sh://class");ke&&(d.class=ke.target),i.addProperty(d)}return i}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 Br(e.node_shape_uri,e.target_class):new Br(e.target_class);for(let n of e.properties||[])t.addProperty({path:n.path,name:n.name,datatype:n.datatype,nodeKind:n.node_kind,minCount:n.min_count,maxCount:n.max_count,minInclusive:n.min_inclusive,maxInclusive:n.max_inclusive,pattern:n.pattern,hasValue:n.has_value,local:n.local,writable:n.writable,resolveLanguage:n.resolve_language,setter:n.setter,adder:n.adder,remover:n.remover,getter:n.getter,conformanceConditions:n.conformance_conditions,class:n.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 n of e.parent_shapes)t.addParentShape(n);return t}};function kp(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function mT(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,n=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${kp(e)} your ${t} actions, with access to ${kp(n)}`}function Y(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function vi(r){return typeof r=="string"?`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?`[${r.map(e=>vi(e)).join(", ")}]`:String(r)}function Dy(r,e,t){let n=Y(r),i=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(o=>vi(o)).join(", ");return`count(->link[WHERE predicate = '${n}' AND ${i} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,o=[];if(a.not!==void 0)if(Array.isArray(a.not)){let c=a.not.map(u=>vi(u)).join(", ");o.push(`count(->link[WHERE predicate = '${n}' AND ${i} IN [${c}]]) = 0`)}else o.push(`count(->link[WHERE predicate = '${n}' AND ${i} = ${vi(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)&&o.push(`count(->link[WHERE predicate = '${n}']) > 0`),o.join(" AND ")}else return`count(->link[WHERE predicate = '${n}' AND ${i} = ${vi(e)}]) > 0`}function Gd(r,e){let t=[];for(let[n,i]of Object.entries(r)){if(["id","author","timestamp"].includes(n))continue;let a,o;if(e){let c=e.properties[n];c?(a=c.predicate,o=c.resolveLanguage):a=n}else a=n;let s=Dy(a,i,{resolveLanguage:o});s&&t.push(s)}return t}var rr=new WeakMap,Xe=new WeakMap;function Vr(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=rr.get(i);a&&Object.assign(e,a)}return e}function Zt(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=Xe.get(i);a&&Object.assign(e,a)}return e}function Ry(r,e,t){rr.has(r)||rr.set(r,{}),rr.get(r)[e]=t}function Cy(r,e,t){Xe.has(r)||Xe.set(r,{}),Xe.get(r)[e]=t}function Hd(r,e){try{let t=Vr(e),n=[],i=[];for(let[s,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(n.push({type:"flag",predicate:c.through,value:c.initial}),i.push(`count(->link[WHERE predicate = '${Y(c.through)}' AND out.uri = '${Y(c.initial)}']) > 0`));for(let[s,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(n.push({type:"required",predicate:c.through}),i.push(`count(->link[WHERE predicate = '${Y(c.through)}']) > 0`));return n.length===0?void 0:{getter:`(->link[WHERE predicate = '${Y(r)}'].out[WHERE ${i.join(" AND ")}].uri)`,conformanceConditions:n}}catch{return}}function gT(r){let e=r.constructor,t=Vr(e),n={};for(let[i,a]of Object.entries(t))n[i]=r[i];return n}function Kd(r){let e="",t="abcdefghijklmnopqrstuvwxyz",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}var Tp=class{};function yT(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function vT(r){return`triple(this, "${r}", _)`}function Us(r){return function(e,t){let n=r.readOnly?!1:!!r.through;if(r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let i=e.constructor;if(rr.has(i)||rr.set(i,{}),rr.get(i)[t]={...r,writable:n},n){let a=t;e[`set${Ut(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function bT(r){return Us({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function ST(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");let n={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},i=e.constructor;rr.has(i)||rr.set(i,{}),rr.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Py(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",n=r.name,i=e.prototype,a=Kd(8);t+=`subject_class("${n}", ${a}).
|
|
86
|
+
`;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let c=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(c=c.concat(i.isSubjectInstance));let u=[],l=Vr(e);for(let h in l){let g=`property(${a}, "${h}").
|
|
87
|
+
`,{through:b,initial:v,required:S,resolveLanguage:y,writable:k,flag:N,prologGetter:T,prologSetter:C,local:$}=l[h];if(y&&(g+=`property_resolve(${a}, "${h}").
|
|
88
|
+
`,g+=`property_resolve_language(${a}, "${h}", "${y}").
|
|
89
|
+
`),T?g+=`property_getter(${a}, Base, "${h}", Value) :- ${T}.
|
|
90
|
+
`:b&&(g+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${b}", Value).
|
|
91
|
+
`,S&&(N?c.push(`triple(Base, "${b}", "${v}")`):c.push(`triple(Base, "${b}", _)`))),C)g+=`property_setter(${a}, "${h}", Actions) :- ${C}.
|
|
92
|
+
`;else if(k&&b&&typeof i[Is(h)]=="function"){let we=[{action:"setSingleTarget",source:"this",predicate:b,target:"value",...$&&{local:!0}}];g+=`property_setter(${a}, "${h}", '${hn(we)}').
|
|
93
|
+
`}u.push(g);let P=v??(S&&k&&!N&&b?"literal://string:":void 0);P&&(s.push({action:"addLink",source:"this",predicate:b,target:P}),o.push({action:"removeLink",source:"this",predicate:b,target:"*"}))}let p=[],d=Zt(e),f=Object.fromEntries(Object.entries(d).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));for(let h in f){let g=`collection(${a}, "${h}").
|
|
94
|
+
`,{predicate:b,local:v}=f[h];if(b){g+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${b}", C), List).
|
|
95
|
+
`;let S=[{action:"addLink",source:"this",predicate:b,target:"value",...v&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:b,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:b,target:"value",...v&&{local:!0}}];g+=`collection_adder(${a}, "${h}", '${hn(S)}').
|
|
96
|
+
`,g+=`collection_remover(${a}, "${h}", '${hn(y)}').
|
|
97
|
+
`,g+=`collection_setter(${a}, "${h}", '${hn(k)}').
|
|
98
|
+
`}p.push(g)}let m=hn(s);if(t+=`constructor(${a}, '${m}').
|
|
99
|
+
`,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
|
|
100
100
|
`,t+=`
|
|
101
|
-
`}return t+=`destructor(${a}, '${
|
|
101
|
+
`}return t+=`destructor(${a}, '${hn(o)}').
|
|
102
102
|
`,t+=`
|
|
103
103
|
`,t+=u.join(`
|
|
104
104
|
`),t+=`
|
|
105
|
-
`,t+=
|
|
106
|
-
`),{sdna:t,name:n}},e.generateSHACL=function(){let t=r.name,n=e.prototype,i="ad4m://",a=Tn(e),o=Zt(e),s=Object.fromEntries(Object.entries(o).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(a).length>0){let h=a[Object.keys(a)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(i=m[1])}}else if(Object.keys(s).length>0){let h=s[Object.keys(s)[0]];if(h.predicate){let m=h.predicate.match(/^([^:]+:\/\/)/);m&&(i=m[1])}}let c=`${i}${t}Shape`,u=`${i}${t}`,l=new Br(c,u),d=Object.getPrototypeOf(e);if(d&&typeof d.generateSHACL=="function"){let h=d.generateSHACL();h?.shape?.nodeShapeUri&&l.addParentShape(h.shape.nodeShapeUri)}let p=[];n.subjectConstructor&&n.subjectConstructor.length&&(p=p.concat(n.subjectConstructor));let f=[];for(let h in a){let m=a[h];if(!m.through)continue;let g={name:h,path:m.through};if(m.resolveLanguage==="literal")g.datatype="xsd://string";else if(m.initial){let b=typeof n[h];b==="number"?g.datatype="xsd://integer":b==="boolean"?g.datatype="xsd://boolean":b==="string"&&(g.datatype="xsd://string")}m.required&&(g.minCount=1),g.maxCount=1,m.flag&&m.initial&&(g.hasValue=m.initial),m.local!==void 0&&(g.local=m.local),m.writable!==void 0&&(g.writable=m.writable),m.resolveLanguage&&(g.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):m.writable&&m.through&&typeof n[xs(h)]=="function"&&(g.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let S=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal://string:":void 0);S&&(p.push({action:"addLink",source:"this",predicate:m.through,target:S}),f.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),l.addProperty(g)}for(let h in s){let m=s[h];if(!m.predicate)continue;let g={name:h,path:m.predicate};g.nodeKind="IRI",m.local!==void 0&&(g.local=m.local),g.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],g.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],l.addProperty(g)}return l.setConstructorActions(p),l.setDestructorActions(f),{shape:l,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function Dy(r){let e=r.required??!1;return js({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function gk(r){return Dy({...r,readOnly:!0})}function Us(r,e){let t=typeof r=="function"?{...e,target:r}:r;if(!t.through)throw new Error("Relation decorator requires a { through: '...' } option specifying the predicate URI.");return t}function yk(r,e){let t=Us(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter}};let s=i;n[`add${Ut(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${Ut(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${Ut(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)},Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function vk(r,e){let t=Us(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local},js({through:t.through,readOnly:!1,local:t.local})(n,i);let s=i;n[`add${Ut(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${Ut(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${Ut(s)}`]=async function(c){return this.setRelationValues(s,c)}}}function bk(r,e){let t=Us(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local},js({through:t.through,readOnly:!0,local:t.local})(n,i)}}function Sk(r,e){let t=Us(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter}},Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function Tp(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function wk(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,n=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Tp(e)} your ${t} actions, with access to ${Tp(n)}`}function oe(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var Ei=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:ve.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 n of this._states){let i=this.stateUri(n.name);e.push({source:t,predicate:"ad4m://hasState",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:i,predicate:"ad4m://stateName",target:ve.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:ve.from(n.value).toUrl()}),e.push({source:i,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(n.stateCheck))}`})}for(let n of this._transitions){let i=this.transitionUri(n.fromState,n.toState),a=this.stateUri(n.fromState),o=this.stateUri(n.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:i,predicate:"ad4m://actionName",target:ve.from(n.actionName).toUrl()}),e.push({source:i,predicate:"ad4m://fromState",target:a}),e.push({source:i,predicate:"ad4m://toState",target:o}),e.push({source:i,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(n.actions))}`})}return e}static fromLinks(e,t){let n="Flow";if(!t.endsWith(n))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let i=t.slice(0,-n.length),a=Math.max(i.lastIndexOf("/"),i.lastIndexOf(":")),o=i.slice(0,a+1),s=i.slice(a+1),c=new Ei(s,o),u=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(u)if(u.target==="ad4m://any")c.flowable="any";else try{let h=u.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(h))}catch{c.flowable="any"}let l=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(l)try{let h=l.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(h))}catch{}let d=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),p=new Map;for(let h of d){let m=h.target,g=e.find(R=>R.source===m&&R.predicate==="ad4m://stateName"),S=g?ve.fromUrl(g.target).get():"";p.set(m,S);let b=e.find(R=>R.source===m&&R.predicate==="ad4m://stateValue"),v=b?ve.fromUrl(b.target).get():0,y=e.find(R=>R.source===m&&R.predicate==="ad4m://stateCheck"),k={predicate:"",target:""};if(y)try{let R=y.target.replace("literal://string:","");k=JSON.parse(decodeURIComponent(R))}catch{}c.addState({name:S,value:v,stateCheck:k})}let f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of f){let m=h.target,g=e.find(C=>C.source===m&&C.predicate==="ad4m://actionName"),S=g?ve.fromUrl(g.target).get():"",v=e.find(C=>C.source===m&&C.predicate==="ad4m://fromState")?.target||"",y=p.get(v)||"",R=e.find(C=>C.source===m&&C.predicate==="ad4m://toState")?.target||"",T=p.get(R)||"",P=e.find(C=>C.source===m&&C.predicate==="ad4m://transitionActions"),$=[];if(P)try{let C=P.target.replace("literal://string:","");$=JSON.parse(decodeURIComponent(C))}catch{}c.addTransition({actionName:S,fromState:y,toState:T,actions:$})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new Ei(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let n of e.states||[])t.addState(n);for(let n of e.transitions||[])t.addTransition(n);return t}},de=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},O=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ns,gr,Ht,Jt,_n,$r,Fr,hn,ca,is,mn,gn,kt,gi,Ru,se,ue,yn,vn,bn,ua,Is=class{constructor(e,t,n){ns.add(this),gr.set(this,void 0),Ht.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),$r.set(this,void 0),Fr.set(this,void 0),hn.set(this,void 0),ca.set(this,!1),is.set(this,void 0),mn.set(this,void 0),gn.set(this,void 0),kt.set(this,void 0),gi.set(this,void 0),this.isSurrealDB=!1,de(this,gr,e,"f"),de(this,gi,t,"f"),de(this,Jt,n,"f"),de(this,_n,new Set,"f"),de(this,hn,null,"f"),de(this,is,new Promise((i,a)=>{de(this,mn,i,"f"),de(this,gn,a,"f")}),"f")}async subscribe(){O(this,Fr,"f")&&(O(this,Fr,"f").call(this),de(this,Fr,void 0,"f")),O(this,kt,"f")&&(clearTimeout(O(this,kt,"f")),de(this,kt,void 0,"f")),O(this,$r,"f")&&(clearTimeout(O(this,$r,"f")),de(this,$r,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,gr,"f"),O(this,gi,"f")):t=await O(this,Jt,"f").subscribeQuery(O(this,gr,"f"),O(this,gi,"f")),de(this,Ht,t.subscriptionId,"f"),t.result?(de(this,hn,t.result,"f"),O(this,ns,"m",Ru).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),de(this,kt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),de(this,Fr,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Ht,"f"),n=>{O(this,kt,"f")&&(clearTimeout(O(this,kt,"f")),de(this,kt,void 0,"f")),O(this,mn,"f")&&(O(this,mn,"f").call(this,!0),de(this,mn,void 0,"f"),de(this,gn,void 0,"f")),!(n.isInit&&O(this,hn,"f"))&&(de(this,hn,n,"f"),O(this,ns,"m",Ru).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,gn,"f")&&(O(this,gn,"f").call(this,t),de(this,mn,void 0,"f"),de(this,gn,void 0,"f")),t}let e=async()=>{if(!O(this,ca,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,gr,"f"),O(this,Ht,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,gr,"f"),O(this,Ht,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,gi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,ca,"f")||de(this,$r,setTimeout(e,3e4),"f")}};de(this,$r,setTimeout(e,3e4),"f")}get id(){return O(this,Ht,"f")}get initialized(){return O(this,is,"f")}get result(){return O(this,hn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){de(this,ca,!0,"f"),clearTimeout(O(this,$r,"f")),O(this,Fr,"f")&&O(this,Fr,"f").call(this),O(this,_n,"f").clear(),O(this,kt,"f")&&(clearTimeout(O(this,kt,"f")),de(this,kt,void 0,"f")),O(this,Ht,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,gr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,gr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};gr=new WeakMap,Ht=new WeakMap,Jt=new WeakMap,_n=new WeakMap,$r=new WeakMap,Fr=new WeakMap,hn=new WeakMap,ca=new WeakMap,is=new WeakMap,mn=new WeakMap,gn=new WeakMap,kt=new WeakMap,gi=new WeakMap,ns=new WeakSet,Ru=function r(e){for(let t of O(this,_n,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var vi=class{constructor(e,t){se.set(this,void 0),ue.set(this,void 0),yn.set(this,void 0),vn.set(this,void 0),bn.set(this,void 0),ua.set(this,void 0),de(this,yn,[],"f"),de(this,vn,[],"f"),de(this,bn,[],"f"),de(this,ua,[],"f"),de(this,se,e,"f"),de(this,ue,t,"f"),this.uuid=O(this,se,"f").uuid,this.name=O(this,se,"f").name,this.owners=O(this,se,"f").owners,this.sharedUrl=O(this,se,"f").sharedUrl,this.neighbourhood=O(this,se,"f").neighbourhood,this.state=O(this,se,"f").state,O(this,ue,"f").addPerspectiveLinkAddedListener(O(this,se,"f").uuid,O(this,yn,"f")),O(this,ue,"f").addPerspectiveLinkRemovedListener(O(this,se,"f").uuid,O(this,vn,"f")),O(this,ue,"f").addPerspectiveLinkUpdatedListener(O(this,se,"f").uuid,O(this,bn,"f")),O(this,ue,"f").addPerspectiveSyncStateChangeListener(O(this,se,"f").uuid,O(this,ua,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await O(this,ue,"f").executeCommands(O(this,se,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await O(this,ue,"f").queryLinks(O(this,se,"f").uuid,e)}async infer(e){return await O(this,ue,"f").queryProlog(O(this,se,"f").uuid,e)}async querySurrealDB(e){return await O(this,ue,"f").querySurrealDB(O(this,se,"f").uuid,e)}async add(e,t="shared",n){return await O(this,ue,"f").addLink(O(this,se,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await O(this,ue,"f").addLinks(O(this,se,"f").uuid,e,t,n)}async removeLinks(e,t){return await O(this,ue,"f").removeLinks(O(this,se,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await O(this,ue,"f").linkMutations(O(this,se,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await O(this,ue,"f").addLinkExpression(O(this,se,"f").uuid,e,t,n)}async update(e,t,n){return await O(this,ue,"f").updateLink(O(this,se,"f").uuid,e,t,n)}async remove(e,t){return await O(this,ue,"f").removeLink(O(this,se,"f").uuid,e,t)}async createBatch(){return await O(this,ue,"f").createBatch(O(this,se,"f").uuid)}async commitBatch(e){return await O(this,ue,"f").commitBatch(O(this,se,"f").uuid,e)}async getExpression(e){return await O(this,ue,"f").getExpression(e)}async createExpression(e,t){return await O(this,ue,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,yn,"f").push(t):e==="link-removed"?O(this,vn,"f").push(t):e==="link-updated"&&O(this,bn,"f").push(t)}async addSyncStateChangeListener(e){O(this,ua,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,yn,"f").indexOf(t);O(this,yn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,vn,"f").indexOf(t);O(this,vn,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,bn,"f").indexOf(t);O(this,bn,"f").splice(n,1)}}async snapshot(){return O(this,ue,"f").snapshotByUUID(O(this,se,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(n=>{delete n.data.__typename});for(let n of t.links)await this.addLinkExpression(n)}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 n=new le({source:e.source,predicate:e.predicate}),i=await this.get(n),a=[];for(let s of i)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,a.push(s);let o=[e];await this.linkMutations({additions:o,removals:a},t)}async sdnaFlows(){return(await this.get(new le({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return ve.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),n=[];for(let i of t){let a=await this.getFlow(i);if(!!a)if(a.flowable==="any")n.push(i);else{let o=a.flowable,s=o.source||e;(await this.get(new le({source:s,predicate:o.predicate,target:o.target}))).length>0&&n.push(i)}}return n}async startFlow(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;if(n.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(n.startAction,t,void 0)}async expressionsInFlowState(e,t){let n=await this.getFlow(e);if(!n)return[];let i=n.states.find(s=>s.value===t);if(!i)return[];let a=i.stateCheck;return(await this.get(new le({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;for(let i of n.states){let a=i.stateCheck,o=a.source||t;if((await this.get(new le({source:o,predicate:a.predicate,target:a.target}))).length>0)return i.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let n=await this.getFlow(e);if(!n)return[];let i=null;for(let a of n.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new le({source:s,predicate:o.predicate,target:o.target}))).length>0){i=a.name;break}}return i?n.transitions.filter(a=>a.fromState===i).map(a=>a.actionName):[]}async runFlowAction(e,t,n){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;let a=i.transitions.find(o=>o.actionName===n);if(!a)throw`Action "${n}" 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 n of e){let i=await this.get(new le({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new le({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=ve.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=ve.from(e);if((await this.get(new le({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new le({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=ve.fromUrl(i[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,n,i){return O(this,ue,"f").addSdna(O(this,se,"f").uuid,e,t,n,i)}async addShacl(e,t){let n=t.toLinks(),i=ve.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new pt({source:o.source,predicate:o.predicate,target:o.target})),new pt({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new pt({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=ve.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new le({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;oe(i);let a=await this.get(new le({source:i,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[i,...a.map(d=>d.data.target)].map(d=>`'${oe(d)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return Br.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new le({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=ve.fromUrl(i).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let n=t.toLinks(),i=ve.from(e).toUrl(),a=[...n.map(o=>new pt({source:o.source,predicate:o.predicate,target:o.target})),new pt({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new pt({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=ve.from(e).toUrl(),n=await this.get(new le({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=oe(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=oe(o),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${s}')`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return Ei.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new le({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(n=>{let a=n.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(n=>n.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,n,i){let a;if(typeof e=="string")a=e,await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({className:a,initialValues:n}),t,n?JSON.stringify(n):void 0,i);else{let o=e,s=o.className||o.constructor?.className||o.constructor?.prototype?.className||await this.findClassByProperties(o);if(!s)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({className:s,initialValues:n}),t,n?JSON.stringify(n):void 0,i)}return i?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({className:e}),t));let n=e,i=n.className||n.constructor?.className||n.constructor?.prototype?.className||await this.findClassByProperties(n);if(!i)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({className:i}),t))}async getActionsFromSHACL(e,t){let n=this.escapeRegExp(e),i=new RegExp(`[/:#]${n}Shape$`),a=await this.get(new le({predicate:t}));for(let o of a)if(i.test(o.data.source)){let s="literal://string:";if(o.data.target.startsWith(s)){let c=o.data.target.slice(s.length),u=c;try{u=decodeURIComponent(c)}catch{}try{return JSON.parse(u)}catch(l){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,l),null}}}return null}async removeSubject(e,t,n){let i=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(i,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${i}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,n)}async isSubjectInstance(e,t){let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=await this.getSubjectClassMetadataFromSDNA(n);if(!i)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${n}`),!1;if(i.requiredTriples.length===0){let o=`SELECT count() AS count FROM link WHERE in.uri = '${oe(e)}'`,c=(await this.querySurrealDB(o))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of i.requiredTriples){let o=oe(e),s=oe(a.predicate),c;if(a.target){let p=oe(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${p}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===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 n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new Ta(this,e,n);return await i.init(),i}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let n=[],i=[],a=new Map,o=new Map,s=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&s.add(c.path),c.adder&&c.adder.length>0?o.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){n.push(c.predicate);let u=s.has(c.predicate);c.target&&c.target!=="value"&&!u?i.push({predicate:c.predicate,target:c.target}):i.push({predicate:c.predicate})}}return{requiredPredicates:n,requiredTriples:i,properties:a,relations:o}}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(n=>{let i=oe(n.predicate);if(n.target){let a=oe(n.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return;let a=i.properties.get(n);if(!a)return;let o=oe(e),s=oe(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${o}' AND predicate = '${s}' LIMIT 1`,u=await this.querySurrealDB(c);if(!u||u.length===0)return;let l=u[0].value;if(a.resolveLanguage&&l)try{let d=await this.getExpression(l);try{return JSON.parse(d.data)}catch{return d.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=oe(e),s=oe(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${o}' AND predicate = '${s}' ORDER BY timestamp ASC`,u=await this.querySurrealDB(c);if(!u||u.length===0)return[];let l=u.map(d=>d.value).filter(d=>d!==""&&d!=="");if(a.condition&&l.length>0)try{let d=[];for(let p of l){let f=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${p.replace(/'/g,"\\'")}'`);f.trim().startsWith("WHERE")&&(f=`array::len(SELECT * FROM link ${f}) > 0`);let h=await this.querySurrealDB(`RETURN ${f}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&d.push(p)}l=d}catch(d){console.warn(`Failed to apply condition filter for ${n}:`,d)}if(a.instanceFilter)try{let d=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return d?await this.batchCheckSubjectInstances(l,d):this.filterInstancesSequential(l,a.instanceFilter)}catch{return this.filterInstancesSequential(l,a.instanceFilter)}return l}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${oe(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(o)).map(c=>c.uri)}let n=[];for(let a of t.requiredTriples){let o=e.map(l=>`'${oe(l)}'`).join(", "),s=oe(a.predicate),c;if(a.target){let l=oe(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}' AND out.uri = '${l}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}'`;let u=await this.querySurrealDB(c);n.push(new Set(u.map(l=>l.uri)))}return n.length===0?e:e.filter(a=>n.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let n=[];for(let i of e)try{await this.isSubjectInstance(i,t)&&n.push(i)}catch{continue}return n}async getAllSubjectInstances(e){let t=[],n=typeof e=="function";typeof e=="string"?t=[e]:n?t=[e.name]:t=await this.subjectClassesByTemplate(e);let i=[];for(let a of t){let o=await this.getSubjectClassMetadataFromSDNA(a);if(o){let s=this.generateSurrealInstanceQuery(o),c=await this.querySurrealDB(s);for(let u of c||[])try{let l;n?(l=new e(this,u.base),await l.get()):(l=new Ta(this,u.base,a),await l.init()),i.push(l)}catch{}}}return i}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let n=[];for(let i of t){let a=await this.getSubjectClassMetadataFromSDNA(i);if(a){let o=this.generateSurrealInstanceQuery(a),s=await this.querySurrealDB(o);for(let c of s||[])try{let u=new Ta(this,c.base,i);await u.init(),n.push(u)}catch{}}}return n}async findClassByProperties(e){let t=[],n=[],a=Object.getPrototypeOf(e)?.constructor,o=a?Tn(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(d=>!Array.isArray(e[d]));let s=a?Object.fromEntries(Object.entries(Zt(a)).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(d=>d!=="isSubjectInstance"):n=Object.keys(e).filter(d=>Array.isArray(e[d])&&d!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let c=`SELECT
|
|
105
|
+
`,t+=p.join(`
|
|
106
|
+
`),{sdna:t,name:n}},e.generateSHACL=function(){let t=r.name,n=e.prototype,i="ad4m://",a=Vr(e),o=Zt(e),s=Object.fromEntries(Object.entries(o).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));if(Object.keys(a).length>0){let m=a[Object.keys(a)[0]];if(m.through){let h=m.through.match(/^([^:]+:\/\/)/);h&&(i=h[1])}}else if(Object.keys(s).length>0){let m=s[Object.keys(s)[0]];if(m.predicate){let h=m.predicate.match(/^([^:]+:\/\/)/);h&&(i=h[1])}}let c=`${i}${t}Shape`,u=`${i}${t}`,l=new Br(c,u),p=Object.getPrototypeOf(e);if(p&&typeof p.generateSHACL=="function"){let m=p.generateSHACL();m?.shape?.nodeShapeUri&&l.addParentShape(m.shape.nodeShapeUri)}let d=[];n.subjectConstructor&&n.subjectConstructor.length&&(d=d.concat(n.subjectConstructor));let f=[];for(let m in a){let h=a[m];if(!h.through)continue;let g={name:m,path:h.through};if(h.resolveLanguage==="literal")g.datatype="xsd://string";else if(h.initial){let v=typeof n[m];v==="number"?g.datatype="xsd://integer":v==="boolean"?g.datatype="xsd://boolean":v==="string"&&(g.datatype="xsd://string")}h.required&&(g.minCount=1),g.maxCount=1,h.flag&&h.initial&&(g.hasValue=h.initial),h.local!==void 0&&(g.local=h.local),h.writable!==void 0&&(g.writable=h.writable),h.resolveLanguage&&(g.resolveLanguage=h.resolveLanguage),h.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${m}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):h.writable&&h.through&&typeof n[Is(m)]=="function"&&(g.setter=[{action:"setSingleTarget",source:"this",predicate:h.through,target:"value",...h.local&&{local:!0}}]);let b=h.initial??(h.required&&h.writable&&!h.flag&&h.through?"literal://string:":void 0);b&&(d.push({action:"addLink",source:"this",predicate:h.through,target:b}),f.push({action:"removeLink",source:"this",predicate:h.through,target:"*"})),l.addProperty(g)}for(let m in s){let h=s[m];if(!h.predicate)continue;let g={name:m,path:h.predicate};if(g.nodeKind="IRI",h.local!==void 0&&(g.local=h.local),g.adder=[{action:"addLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],g.remover=[{action:"removeLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],h.getter)g.getter=h.getter;else if(h.where)try{let b=h.target?.(),v=b?b.getModelMetadata?.()??null:null,S=Gd(h.where,v);if(S.length>0){let y=Y(h.predicate);g.getter=`(->link[WHERE predicate = '${y}'].out[WHERE ${S.join(" AND ")}].uri)`}}catch{}else if(h.target&&h.filter!==!1)try{let b=h.target(),v=Hd(h.predicate,b);v&&(g.getter=v.getter,g.conformanceConditions=v.conformanceConditions)}catch{}if(h.target)try{let v=h.target().generateSHACL?.();v?.shape?.nodeShapeUri&&(g.class=v.shape.nodeShapeUri)}catch{}l.addProperty(g)}return l.setConstructorActions(d),l.setDestructorActions(f),{shape:l,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function Ly(r){let e=r.required??!1;return Us({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function wT(r){return Ly({...r,readOnly:!0})}function qs(r,e){let t=typeof r=="function"?{...e||{},target:r}:r;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 _T(r,e){let t=qs(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={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 s=i;t.through&&(n[`add${Ut(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${Ut(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${Ut(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)}),Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function ET(r,e){let t=qs(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={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 s=i;t.through?(Us({through:t.through,readOnly:!1,local:t.local})(n,i),n[`add${Ut(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${Ut(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${Ut(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function xT(r,e){let t=qs(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={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?Us({through:t.through,readOnly:!0,local:t.local})(n,i):Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function IT(r,e){let t=qs(r,e);return function(n,i){let a=n.constructor;Xe.has(a)||Xe.set(a,{});let o=Xe.get(a);o[i]={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(n,i,{configurable:!0,writable:!0})}}var xi=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:ve.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 n of this._states){let i=this.stateUri(n.name);e.push({source:t,predicate:"ad4m://hasState",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:i,predicate:"ad4m://stateName",target:ve.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:ve.from(n.value).toUrl()}),e.push({source:i,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(n.stateCheck))}`})}for(let n of this._transitions){let i=this.transitionUri(n.fromState,n.toState),a=this.stateUri(n.fromState),o=this.stateUri(n.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:i,predicate:"ad4m://actionName",target:ve.from(n.actionName).toUrl()}),e.push({source:i,predicate:"ad4m://fromState",target:a}),e.push({source:i,predicate:"ad4m://toState",target:o}),e.push({source:i,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(n.actions))}`})}return e}static fromLinks(e,t){let n="Flow";if(!t.endsWith(n))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let i=t.slice(0,-n.length),a=Math.max(i.lastIndexOf("/"),i.lastIndexOf(":")),o=i.slice(0,a+1),s=i.slice(a+1),c=new xi(s,o),u=e.find(m=>m.source===t&&m.predicate==="ad4m://flowable");if(u)if(u.target==="ad4m://any")c.flowable="any";else try{let m=u.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(m))}catch{c.flowable="any"}let l=e.find(m=>m.source===t&&m.predicate==="ad4m://startAction");if(l)try{let m=l.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(m))}catch{}let p=e.filter(m=>m.source===t&&m.predicate==="ad4m://hasState"),d=new Map;for(let m of p){let h=m.target,g=e.find(N=>N.source===h&&N.predicate==="ad4m://stateName"),b=g?ve.fromUrl(g.target).get():"";d.set(h,b);let v=e.find(N=>N.source===h&&N.predicate==="ad4m://stateValue"),S=v?ve.fromUrl(v.target).get():0,y=e.find(N=>N.source===h&&N.predicate==="ad4m://stateCheck"),k={predicate:"",target:""};if(y)try{let N=y.target.replace("literal://string:","");k=JSON.parse(decodeURIComponent(N))}catch{}c.addState({name:b,value:S,stateCheck:k})}let f=e.filter(m=>m.source===t&&m.predicate==="ad4m://hasTransition");for(let m of f){let h=m.target,g=e.find(P=>P.source===h&&P.predicate==="ad4m://actionName"),b=g?ve.fromUrl(g.target).get():"",S=e.find(P=>P.source===h&&P.predicate==="ad4m://fromState")?.target||"",y=d.get(S)||"",N=e.find(P=>P.source===h&&P.predicate==="ad4m://toState")?.target||"",T=d.get(N)||"",C=e.find(P=>P.source===h&&P.predicate==="ad4m://transitionActions"),$=[];if(C)try{let P=C.target.replace("literal://string:","");$=JSON.parse(decodeURIComponent(P))}catch{}c.addTransition({actionName:b,fromState:y,toState:T,actions:$})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new xi(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let n of e.states||[])t.addState(n);for(let n of e.transitions||[])t.addTransition(n);return t}},de=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},O=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},is,gr,Kt,Jt,En,$r,Fr,mn,ua,as,gn,yn,Tt,gi,Cu,se,ue,vn,bn,Sn,la,ks=class{constructor(e,t,n){is.add(this),gr.set(this,void 0),Kt.set(this,void 0),Jt.set(this,void 0),En.set(this,void 0),$r.set(this,void 0),Fr.set(this,void 0),mn.set(this,void 0),ua.set(this,!1),as.set(this,void 0),gn.set(this,void 0),yn.set(this,void 0),Tt.set(this,void 0),gi.set(this,void 0),this.isSurrealDB=!1,de(this,gr,e,"f"),de(this,gi,t,"f"),de(this,Jt,n,"f"),de(this,En,new Set,"f"),de(this,mn,null,"f"),de(this,as,new Promise((i,a)=>{de(this,gn,i,"f"),de(this,yn,a,"f")}),"f")}async subscribe(){O(this,Fr,"f")&&(O(this,Fr,"f").call(this),de(this,Fr,void 0,"f")),O(this,Tt,"f")&&(clearTimeout(O(this,Tt,"f")),de(this,Tt,void 0,"f")),O(this,$r,"f")&&(clearTimeout(O(this,$r,"f")),de(this,$r,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,gr,"f"),O(this,gi,"f")):t=await O(this,Jt,"f").subscribeQuery(O(this,gr,"f"),O(this,gi,"f")),de(this,Kt,t.subscriptionId,"f"),t.result?(de(this,mn,t.result,"f"),O(this,is,"m",Cu).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),de(this,Tt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),de(this,Fr,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Kt,"f"),n=>{O(this,Tt,"f")&&(clearTimeout(O(this,Tt,"f")),de(this,Tt,void 0,"f")),O(this,gn,"f")&&(O(this,gn,"f").call(this,!0),de(this,gn,void 0,"f"),de(this,yn,void 0,"f")),!(n.isInit&&O(this,mn,"f"))&&(de(this,mn,n,"f"),O(this,is,"m",Cu).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,yn,"f")&&(O(this,yn,"f").call(this,t),de(this,gn,void 0,"f"),de(this,yn,void 0,"f")),t}let e=async()=>{if(!O(this,ua,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,gr,"f"),O(this,Kt,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,gr,"f"),O(this,Kt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,gi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,ua,"f")||de(this,$r,setTimeout(e,3e4),"f")}};de(this,$r,setTimeout(e,3e4),"f")}get id(){return O(this,Kt,"f")}get initialized(){return O(this,as,"f")}get result(){return O(this,mn,"f")}onResult(e){return O(this,En,"f").add(e),()=>O(this,En,"f").delete(e)}dispose(){de(this,ua,!0,"f"),clearTimeout(O(this,$r,"f")),O(this,Fr,"f")&&O(this,Fr,"f").call(this),O(this,En,"f").clear(),O(this,Tt,"f")&&(clearTimeout(O(this,Tt,"f")),de(this,Tt,void 0,"f")),O(this,Kt,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,gr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,gr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};gr=new WeakMap,Kt=new WeakMap,Jt=new WeakMap,En=new WeakMap,$r=new WeakMap,Fr=new WeakMap,mn=new WeakMap,ua=new WeakMap,as=new WeakMap,gn=new WeakMap,yn=new WeakMap,Tt=new WeakMap,gi=new WeakMap,is=new WeakSet,Cu=function r(e){for(let t of O(this,En,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var bi=class{constructor(e,t){se.set(this,void 0),ue.set(this,void 0),vn.set(this,void 0),bn.set(this,void 0),Sn.set(this,void 0),la.set(this,void 0),de(this,vn,[],"f"),de(this,bn,[],"f"),de(this,Sn,[],"f"),de(this,la,[],"f"),de(this,se,e,"f"),de(this,ue,t,"f"),this.uuid=O(this,se,"f").uuid,this.name=O(this,se,"f").name,this.owners=O(this,se,"f").owners,this.sharedUrl=O(this,se,"f").sharedUrl,this.neighbourhood=O(this,se,"f").neighbourhood,this.state=O(this,se,"f").state,O(this,ue,"f").addPerspectiveLinkAddedListener(O(this,se,"f").uuid,O(this,vn,"f")),O(this,ue,"f").addPerspectiveLinkRemovedListener(O(this,se,"f").uuid,O(this,bn,"f")),O(this,ue,"f").addPerspectiveLinkUpdatedListener(O(this,se,"f").uuid,O(this,Sn,"f")),O(this,ue,"f").addPerspectiveSyncStateChangeListener(O(this,se,"f").uuid,O(this,la,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await O(this,ue,"f").executeCommands(O(this,se,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await O(this,ue,"f").queryLinks(O(this,se,"f").uuid,e)}async infer(e){return await O(this,ue,"f").queryProlog(O(this,se,"f").uuid,e)}async querySurrealDB(e){return await O(this,ue,"f").querySurrealDB(O(this,se,"f").uuid,e)}async add(e,t="shared",n){return await O(this,ue,"f").addLink(O(this,se,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await O(this,ue,"f").addLinks(O(this,se,"f").uuid,e,t,n)}async removeLinks(e,t){return await O(this,ue,"f").removeLinks(O(this,se,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await O(this,ue,"f").linkMutations(O(this,se,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await O(this,ue,"f").addLinkExpression(O(this,se,"f").uuid,e,t,n)}async update(e,t,n){return await O(this,ue,"f").updateLink(O(this,se,"f").uuid,e,t,n)}async remove(e,t){return await O(this,ue,"f").removeLink(O(this,se,"f").uuid,e,t)}async createBatch(){return await O(this,ue,"f").createBatch(O(this,se,"f").uuid)}async commitBatch(e){return await O(this,ue,"f").commitBatch(O(this,se,"f").uuid,e)}async getExpression(e){return await O(this,ue,"f").getExpression(e)}async createExpression(e,t){return await O(this,ue,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,vn,"f").push(t):e==="link-removed"?O(this,bn,"f").push(t):e==="link-updated"&&O(this,Sn,"f").push(t)}async addSyncStateChangeListener(e){O(this,la,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,vn,"f").indexOf(t);O(this,vn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,bn,"f").indexOf(t);O(this,bn,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,Sn,"f").indexOf(t);O(this,Sn,"f").splice(n,1)}}async snapshot(){return O(this,ue,"f").snapshotByUUID(O(this,se,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(n=>{delete n.data.__typename});for(let n of t.links)await this.addLinkExpression(n)}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 n=new le({source:e.source,predicate:e.predicate}),i=await this.get(n),a=[];for(let s of i)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,a.push(s);let o=[e];await this.linkMutations({additions:o,removals:a},t)}async sdnaFlows(){return(await this.get(new le({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return ve.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),n=[];for(let i of t){let a=await this.getFlow(i);if(!!a)if(a.flowable==="any")n.push(i);else{let o=a.flowable,s=o.source||e;(await this.get(new le({source:s,predicate:o.predicate,target:o.target}))).length>0&&n.push(i)}}return n}async startFlow(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;if(n.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(n.startAction,t,void 0)}async expressionsInFlowState(e,t){let n=await this.getFlow(e);if(!n)return[];let i=n.states.find(s=>s.value===t);if(!i)return[];let a=i.stateCheck;return(await this.get(new le({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;for(let i of n.states){let a=i.stateCheck,o=a.source||t;if((await this.get(new le({source:o,predicate:a.predicate,target:a.target}))).length>0)return i.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let n=await this.getFlow(e);if(!n)return[];let i=null;for(let a of n.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new le({source:s,predicate:o.predicate,target:o.target}))).length>0){i=a.name;break}}return i?n.transitions.filter(a=>a.fromState===i).map(a=>a.actionName):[]}async runFlowAction(e,t,n){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;let a=i.transitions.find(o=>o.actionName===n);if(!a)throw`Action "${n}" 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 n of e){let i=await this.get(new le({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new le({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=ve.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=ve.from(e);if((await this.get(new le({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new le({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=ve.fromUrl(i[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,n,i){return O(this,ue,"f").addSdna(O(this,se,"f").uuid,e,t,n,i)}async addShacl(e,t){let n=t.toLinks(),i=ve.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new pt({source:o.source,predicate:o.predicate,target:o.target})),new pt({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new pt({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=ve.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new le({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;Y(i);let a=await this.get(new le({source:i,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[i,...a.map(p=>p.data.target)].map(p=>`'${Y(p)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(p=>({source:p.source,predicate:p.predicate,target:p.target}));return Br.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new le({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=ve.fromUrl(i).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let n=t.toLinks(),i=ve.from(e).toUrl(),a=[...n.map(o=>new pt({source:o.source,predicate:o.predicate,target:o.target})),new pt({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new pt({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=ve.from(e).toUrl(),n=await this.get(new le({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=Y(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=Y(o),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${s}')`,l=(await this.querySurrealDB(c)||[]).map(p=>({source:p.source,predicate:p.predicate,target:p.target}));return xi.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new le({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(n=>{let a=n.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(n=>n.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,n,i){let a;if(typeof e=="string")a=e,await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({className:a,initialValues:n}),t,n?JSON.stringify(n):void 0,i);else{let o=e,s=o.className||o.constructor?.className||o.constructor?.prototype?.className||await this.findClassByProperties(o);if(!s)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({className:s,initialValues:n}),t,n?JSON.stringify(n):void 0,i)}return i?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({className:e}),t));let n=e,i=n.className||n.constructor?.className||n.constructor?.prototype?.className||await this.findClassByProperties(n);if(!i)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({className:i}),t))}async getActionsFromSHACL(e,t){let n=this.escapeRegExp(e),i=new RegExp(`[/:#]${n}Shape$`),a=await this.get(new le({predicate:t}));for(let o of a)if(i.test(o.data.source)){let s="literal://string:";if(o.data.target.startsWith(s)){let c=o.data.target.slice(s.length),u=c;try{u=decodeURIComponent(c)}catch{}try{return JSON.parse(u)}catch(l){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,l),null}}}return null}async removeSubject(e,t,n){let i=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(i,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${i}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,n)}async isSubjectInstance(e,t){let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=await this.getSubjectClassMetadataFromSDNA(n);if(!i)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${n}`),!1;if(i.requiredTriples.length===0){let o=`SELECT count() AS count FROM link WHERE in.uri = '${Y(e)}'`,c=(await this.querySurrealDB(o))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of i.requiredTriples){let o=Y(e),s=Y(a.predicate),c;if(a.target){let d=Y(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${d}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===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 n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new Ta(this,e,n);return await i.init(),i}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let n=[],i=[],a=new Map,o=new Map,s=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&s.add(c.path),c.adder&&c.adder.length>0?o.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){n.push(c.predicate);let u=s.has(c.predicate);c.target&&c.target!=="value"&&!u?i.push({predicate:c.predicate,target:c.target}):i.push({predicate:c.predicate})}}return{requiredPredicates:n,requiredTriples:i,properties:a,relations:o}}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(n=>{let i=Y(n.predicate);if(n.target){let a=Y(n.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return;let a=i.properties.get(n);if(!a)return;let o=Y(e),s=Y(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${o}' AND predicate = '${s}' LIMIT 1`,u=await this.querySurrealDB(c);if(!u||u.length===0)return;let l=u[0].value;if(a.resolveLanguage&&l)try{let p=await this.getExpression(l);try{return JSON.parse(p.data)}catch{return p.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=Y(e),s=Y(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${o}' AND predicate = '${s}' ORDER BY timestamp ASC`,u=await this.querySurrealDB(c);if(!u||u.length===0)return[];let l=u.map(p=>p.value).filter(p=>p!==""&&p!=="");if(a.condition&&l.length>0)try{let p=[];for(let d of l){let f=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${d.replace(/'/g,"\\'")}'`);f.trim().startsWith("WHERE")&&(f=`array::len(SELECT * FROM link ${f}) > 0`);let m=await this.querySurrealDB(`RETURN ${f}`);(m===!0||Array.isArray(m)&&m.length>0&&m[0]===!0)&&p.push(d)}l=p}catch(p){console.warn(`Failed to apply condition filter for ${n}:`,p)}if(a.instanceFilter)try{let p=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return p?await this.batchCheckSubjectInstances(l,p):this.filterInstancesSequential(l,a.instanceFilter)}catch{return this.filterInstancesSequential(l,a.instanceFilter)}return l}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${Y(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(o)).map(c=>c.uri)}let n=[];for(let a of t.requiredTriples){let o=e.map(l=>`'${Y(l)}'`).join(", "),s=Y(a.predicate),c;if(a.target){let l=Y(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}' AND out.uri = '${l}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}'`;let u=await this.querySurrealDB(c);n.push(new Set(u.map(l=>l.uri)))}return n.length===0?e:e.filter(a=>n.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let n=[];for(let i of e)try{await this.isSubjectInstance(i,t)&&n.push(i)}catch{continue}return n}async getAllSubjectInstances(e){let t=[],n=typeof e=="function";typeof e=="string"?t=[e]:n?t=[e.name]:t=await this.subjectClassesByTemplate(e);let i=[];for(let a of t){let o=await this.getSubjectClassMetadataFromSDNA(a);if(o){let s=this.generateSurrealInstanceQuery(o),c=await this.querySurrealDB(s);for(let u of c||[])try{let l;n?(l=new e(this,u.base),await l.get()):(l=new Ta(this,u.base,a),await l.init()),i.push(l)}catch{}}}return i}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let n=[];for(let i of t){let a=await this.getSubjectClassMetadataFromSDNA(i);if(a){let o=this.generateSurrealInstanceQuery(a),s=await this.querySurrealDB(o);for(let c of s||[])try{let u=new Ta(this,c.base,i);await u.init(),n.push(u)}catch{}}}return n}async findClassByProperties(e){let t=[],n=[],a=Object.getPrototypeOf(e)?.constructor,o=a?Vr(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(p=>!Array.isArray(e[p]));let s=a?Object.fromEntries(Object.entries(Zt(a)).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(p=>p!=="isSubjectInstance"):n=Object.keys(e).filter(p=>Array.isArray(e[p])&&p!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let c=`SELECT
|
|
107
107
|
in.uri AS shape_source,
|
|
108
108
|
predicate,
|
|
109
109
|
out.uri AS target
|
|
110
110
|
FROM link
|
|
111
|
-
WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,u=await this.querySurrealDB(c);if(!u||u.length===0)return null;let l=new Map;for(let
|
|
111
|
+
WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,u=await this.querySurrealDB(c);if(!u||u.length===0)return null;let l=new Map;for(let p of u)if(p.predicate==="rdf://type"&&p.target==="ad4m://SubjectClass"){let d=p.shape_source,f=d.indexOf("://");if(f<0)continue;let m=d.substring(f+3).split("/").pop();if(!m)continue;l.set(m,{shapeUri:d,properties:[],relations:[]})}for(let p of u)if(p.predicate==="sh://property"||p.predicate==="sh://collection"){for(let[d,f]of l)if(p.shape_source.endsWith(`${d}Shape`)){let m=p.target.lastIndexOf(".");if(m<0)continue;let h=p.target.substring(m+1);p.predicate==="sh://property"?f.properties.push(h):f.relations.push(h)}}for(let[p,d]of l){let f=t.every(h=>d.properties.includes(h)),m=n.every(h=>d.relations.includes(h));if(f&&m)return p}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:n}=e.generateSHACL(),i=JSON.stringify(n.toJSON());await this.addSdna(t,"","subject_class",i)}getNeighbourhoodProxy(){return O(this,ue,"f").getNeighbourhoodProxy(O(this,se,"f").uuid)}get ai(){return O(this,ue,"f").aiClient}async subscribeInfer(e){let t=new ks(this.uuid,e,O(this,ue,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new ks(this.uuid,e,O(this,ue,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};se=new WeakMap,ue=new WeakMap,vn=new WeakMap,bn=new WeakMap,Sn=new WeakMap,la=new WeakMap;var Cr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Z,fa,pa,da,os,ha,ss,cs,tt=`
|
|
112
112
|
author
|
|
113
113
|
timestamp
|
|
114
114
|
status
|
|
@@ -135,73 +135,73 @@ neighbourhood {
|
|
|
135
135
|
}
|
|
136
136
|
author
|
|
137
137
|
}
|
|
138
|
-
`,Ts=class{constructor(e,t=!0){
|
|
138
|
+
`,Ts=class{constructor(e,t=!0){Z.set(this,void 0),fa.set(this,void 0),pa.set(this,void 0),da.set(this,void 0),os.set(this,void 0),ha.set(this,void 0),ss.set(this,void 0),cs.set(this,void 0),Cr(this,Z,e,"f"),Cr(this,fa,[],"f"),Cr(this,pa,[],"f"),Cr(this,da,[],"f"),Cr(this,os,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Cr(this,ha,e,"f")}setNeighbourhoodClient(e){Cr(this,ss,e,"f")}setAIClient(e){Cr(this,cs,e,"f")}get aiClient(){return B(this,cs,"f")}async all(){let{perspectives:e}=A(await B(this,Z,"f").query({query:x`query perspectives {
|
|
139
139
|
perspectives {
|
|
140
140
|
${li}
|
|
141
141
|
}
|
|
142
|
-
}`}));return e.map(t=>new
|
|
142
|
+
}`}));return e.map(t=>new bi(t,this))}async byUUID(e){let{perspective:t}=A(await B(this,Z,"f").query({query:x`query perspective($uuid: String!) {
|
|
143
143
|
perspective(uuid: $uuid) {
|
|
144
144
|
${li}
|
|
145
145
|
}
|
|
146
|
-
}`,variables:{uuid:e}}));return t?new
|
|
146
|
+
}`,variables:{uuid:e}}));return t?new bi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=A(await B(this,Z,"f").query({query:x`query perspectiveSnapshot($uuid: String!) {
|
|
147
147
|
perspectiveSnapshot(uuid: $uuid) {
|
|
148
148
|
links { ${tt} }
|
|
149
149
|
}
|
|
150
|
-
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=A(await
|
|
150
|
+
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
151
151
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
152
|
-
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=A(await
|
|
152
|
+
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=A(await B(this,Z,"f").query({query:x`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
153
153
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
154
154
|
${tt}
|
|
155
155
|
}
|
|
156
|
-
}`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=A(await
|
|
156
|
+
}`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=A(await B(this,Z,"f").query({query:x`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
157
157
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
158
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=A(await
|
|
158
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=A(await B(this,Z,"f").query({query:x`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
159
159
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
160
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=A(await
|
|
160
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
161
161
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
162
162
|
subscriptionId
|
|
163
163
|
result
|
|
164
164
|
}
|
|
165
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:n}=A(await
|
|
165
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
166
166
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
167
167
|
subscriptionId
|
|
168
168
|
result
|
|
169
169
|
}
|
|
170
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:n}=A(await
|
|
170
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
171
171
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
172
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=A(await
|
|
172
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
173
173
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
174
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=
|
|
174
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=B(this,Z,"f").subscribe({query:x`
|
|
175
175
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
176
176
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
177
177
|
}
|
|
178
|
-
`,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:n}=A(await
|
|
178
|
+
`,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
179
179
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
180
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=A(await
|
|
180
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
181
181
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
182
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=A(await
|
|
182
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveAdd($name: String!) {
|
|
183
183
|
perspectiveAdd(name: $name) {
|
|
184
184
|
${li}
|
|
185
185
|
}
|
|
186
|
-
}`,variables:{name:e}}));return new
|
|
186
|
+
}`,variables:{name:e}}));return new bi(t,this)}async update(e,t){let{perspectiveUpdate:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
187
187
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
188
188
|
${li}
|
|
189
189
|
}
|
|
190
|
-
}`,variables:{uuid:e,name:t}}));return new
|
|
190
|
+
}`,variables:{uuid:e,name:t}}));return new bi(n,this)}async remove(e){return A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveRemove($uuid: String!) {
|
|
191
191
|
perspectiveRemove(uuid: $uuid)
|
|
192
|
-
}`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=A(await
|
|
192
|
+
}`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
193
193
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
194
194
|
${tt}
|
|
195
195
|
}
|
|
196
|
-
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=A(await
|
|
196
|
+
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
197
197
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
198
198
|
${tt}
|
|
199
199
|
}
|
|
200
|
-
}`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=A(await
|
|
200
|
+
}`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
201
201
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
202
202
|
${tt}
|
|
203
203
|
}
|
|
204
|
-
}`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=A(await
|
|
204
|
+
}`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
205
205
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
206
206
|
additions {
|
|
207
207
|
${tt}
|
|
@@ -210,43 +210,43 @@ neighbourhood {
|
|
|
210
210
|
${tt}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
}`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=A(await
|
|
213
|
+
}`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
214
214
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
215
215
|
${tt}
|
|
216
216
|
}
|
|
217
|
-
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=A(await
|
|
217
|
+
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
218
218
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
219
219
|
${tt}
|
|
220
220
|
}
|
|
221
|
-
}`,variables:{uuid:e,oldLink:t,newLink:n,batchId:i}}));return a}async removeLink(e,t,n){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:i}=A(await
|
|
221
|
+
}`,variables:{uuid:e,oldLink:t,newLink:n,batchId:i}}));return a}async removeLink(e,t,n){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:i}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
222
222
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
223
|
-
}`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return A(await
|
|
223
|
+
}`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
224
224
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
225
|
-
}`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return A(await
|
|
225
|
+
}`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
226
226
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
227
|
-
}`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return A(await
|
|
227
|
+
}`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
228
228
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
229
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return A(await
|
|
229
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
230
230
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
231
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await
|
|
231
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,ha,"f").get(e)}async createExpression(e,t){return await B(this,ha,"f").create(e,t)}addPerspectiveAddedListener(e){B(this,fa,"f").push(e)}subscribePerspectiveAdded(){B(this,Z,"f").subscribe({query:x` subscription {
|
|
232
232
|
perspectiveAdded { ${li} }
|
|
233
233
|
}
|
|
234
|
-
`}).subscribe({next:e=>{
|
|
234
|
+
`}).subscribe({next:e=>{B(this,fa,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,pa,"f").push(e)}subscribePerspectiveUpdated(){B(this,Z,"f").subscribe({query:x` subscription {
|
|
235
235
|
perspectiveUpdated { ${li} }
|
|
236
236
|
}
|
|
237
|
-
`}).subscribe({next:e=>{
|
|
237
|
+
`}).subscribe({next:e=>{B(this,pa,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,os,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){B(this,Z,"f").subscribe({query:x` subscription {
|
|
238
238
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
239
239
|
}
|
|
240
|
-
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){
|
|
240
|
+
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){B(this,da,"f").push(e)}subscribePerspectiveRemoved(){B(this,Z,"f").subscribe({query:x` subscription {
|
|
241
241
|
perspectiveRemoved
|
|
242
242
|
}
|
|
243
|
-
`}).subscribe({next:e=>{
|
|
243
|
+
`}).subscribe({next:e=>{B(this,da,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){B(this,Z,"f").subscribe({query:x` subscription {
|
|
244
244
|
perspectiveLinkAdded(uuid: "${e}") { ${tt} }
|
|
245
245
|
}
|
|
246
|
-
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,t){
|
|
246
|
+
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,t){B(this,Z,"f").subscribe({query:x` subscription {
|
|
247
247
|
perspectiveLinkRemoved(uuid: "${e}") { ${tt} }
|
|
248
248
|
}
|
|
249
|
-
`}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,t){
|
|
249
|
+
`}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,t){B(this,Z,"f").subscribe({query:x` subscription {
|
|
250
250
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
251
251
|
oldLink {
|
|
252
252
|
${tt}
|
|
@@ -256,9 +256,9 @@ neighbourhood {
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
`}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new
|
|
259
|
+
`}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new Ru(B(this,ss,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveCreateBatch($uuid: String!) {
|
|
260
260
|
perspectiveCreateBatch(uuid: $uuid)
|
|
261
|
-
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=A(await
|
|
261
|
+
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=A(await B(this,Z,"f").mutate({mutation:x`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
262
262
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
263
263
|
additions {
|
|
264
264
|
${tt}
|
|
@@ -267,7 +267,7 @@ neighbourhood {
|
|
|
267
267
|
${tt}
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
}`,variables:{uuid:e,batchId:t}}));return n}};
|
|
270
|
+
}`,variables:{uuid:e,batchId:t}}));return n}};Z=new WeakMap,fa=new WeakMap,pa=new WeakMap,da=new WeakMap,os=new WeakMap,ha=new WeakMap,ss=new WeakMap,cs=new WeakMap;var qo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},re=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ce,ma,ga,ya,aa=`
|
|
271
271
|
did
|
|
272
272
|
directMessageLanguage
|
|
273
273
|
perspective {
|
|
@@ -281,7 +281,7 @@ neighbourhood {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
`,
|
|
284
|
+
`,Bo=`
|
|
285
285
|
requestId
|
|
286
286
|
revoked
|
|
287
287
|
auth {
|
|
@@ -303,27 +303,27 @@ neighbourhood {
|
|
|
303
303
|
did
|
|
304
304
|
didDocument
|
|
305
305
|
error
|
|
306
|
-
`,
|
|
306
|
+
`,Vo=`
|
|
307
307
|
did
|
|
308
308
|
didSigningKeyId
|
|
309
309
|
deviceKeyType
|
|
310
310
|
deviceKey
|
|
311
311
|
deviceKeySignedByDid
|
|
312
312
|
didSignedByDeviceKey
|
|
313
|
-
|
|
313
|
+
`,$y=`
|
|
314
314
|
signature
|
|
315
315
|
publicKey
|
|
316
|
-
`,
|
|
316
|
+
`,Pa=class{constructor(e,t=!0){ce.set(this,void 0),ma.set(this,void 0),ga.set(this,void 0),ya.set(this,void 0),qo(this,ce,e,"f"),qo(this,ga,[],"f"),qo(this,ya,[],"f"),qo(this,ma,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=A(await re(this,ce,"f").query({query:x`query agent { agent { ${aa} } }`})),t=new qr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=A(await re(this,ce,"f").query({query:x`query agentStatus {
|
|
317
317
|
agentStatus {
|
|
318
318
|
${fi}
|
|
319
319
|
}
|
|
320
|
-
}`}));return new Ot(e)}async generate(e){let{agentGenerate:t}=A(await
|
|
320
|
+
}`}));return new Ot(e)}async generate(e){let{agentGenerate:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentGenerate(
|
|
321
321
|
$passphrase: String!
|
|
322
322
|
) {
|
|
323
323
|
agentGenerate(passphrase: $passphrase) {
|
|
324
324
|
${fi}
|
|
325
325
|
}
|
|
326
|
-
}`,variables:{passphrase:e}}));return new Ot(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=A(await
|
|
326
|
+
}`,variables:{passphrase:e}}));return new Ot(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentImport(
|
|
327
327
|
$did: String!,
|
|
328
328
|
$didDocument: String!,
|
|
329
329
|
$keystore: String!,
|
|
@@ -332,110 +332,110 @@ neighbourhood {
|
|
|
332
332
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
333
333
|
${fi}
|
|
334
334
|
}
|
|
335
|
-
}`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Ot(o)}async lock(e){let{agentLock:t}=A(await
|
|
335
|
+
}`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Ot(o)}async lock(e){let{agentLock:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentLock($passphrase: String!) {
|
|
336
336
|
agentLock(passphrase: $passphrase) {
|
|
337
337
|
${fi}
|
|
338
338
|
}
|
|
339
|
-
}`,variables:{passphrase:e}}));return new Ot(t)}async unlock(e,t=!0){let{agentUnlock:n}=A(await
|
|
339
|
+
}`,variables:{passphrase:e}}));return new Ot(t)}async unlock(e,t=!0){let{agentUnlock:n}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
340
340
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
341
341
|
${fi}
|
|
342
342
|
}
|
|
343
|
-
}`,variables:{passphrase:e,holochain:t}}));return new Ot(n)}async byDID(e){let{agentByDID:t}=A(await
|
|
343
|
+
}`,variables:{passphrase:e,holochain:t}}));return new Ot(n)}async byDID(e){let{agentByDID:t}=A(await re(this,ce,"f").query({query:x`query agentByDID($did: String!) {
|
|
344
344
|
agentByDID(did: $did) {
|
|
345
|
-
${
|
|
345
|
+
${aa}
|
|
346
346
|
}
|
|
347
|
-
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:n}=A(await
|
|
347
|
+
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:n}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
348
348
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
349
|
-
${
|
|
349
|
+
${aa}
|
|
350
350
|
}
|
|
351
|
-
}`,variables:{perspective:t}})),i=n,a=new qr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ts(
|
|
351
|
+
}`,variables:{perspective:t}})),i=n,a=new qr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ts(re(this,ce,"f")),n=new Pa(re(this,ce,"f")),i=await t.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let c of e.additions)await i.add(c);for(let c of e.removals)await i.remove(c);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
352
352
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
353
|
-
${
|
|
353
|
+
${aa}
|
|
354
354
|
}
|
|
355
|
-
}`,variables:{directMessageLanguage:e}})),n=t,i=new qr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=A(await
|
|
355
|
+
}`,variables:{directMessageLanguage:e}})),n=t,i=new qr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
356
356
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
357
|
-
${
|
|
357
|
+
${Vo}
|
|
358
358
|
}
|
|
359
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=A(await
|
|
359
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
360
360
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
361
|
-
${
|
|
361
|
+
${Vo}
|
|
362
362
|
}
|
|
363
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=A(await
|
|
363
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=A(await re(this,ce,"f").query({query:x`query agentGetEntanglementProofs {
|
|
364
364
|
agentGetEntanglementProofs {
|
|
365
|
-
${
|
|
365
|
+
${Vo}
|
|
366
366
|
}
|
|
367
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=A(await
|
|
367
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
368
368
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
369
|
-
${
|
|
369
|
+
${Vo}
|
|
370
370
|
}
|
|
371
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){
|
|
372
|
-
agentUpdated { ${
|
|
371
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){re(this,ga,"f").push(e)}addAppChangedListener(e){re(this,ma,"f").push(e)}subscribeAgentUpdated(){re(this,ce,"f").subscribe({query:x` subscription {
|
|
372
|
+
agentUpdated { ${aa} }
|
|
373
373
|
}
|
|
374
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;
|
|
374
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;re(this,ga,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){re(this,ce,"f").subscribe({query:x` subscription {
|
|
375
375
|
agentAppsChanged {
|
|
376
|
-
${
|
|
376
|
+
${Bo}
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
`}).subscribe({next:e=>{
|
|
379
|
+
`}).subscribe({next:e=>{re(this,ma,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){re(this,ya,"f").push(e)}subscribeAgentStatusChanged(){re(this,ce,"f").subscribe({query:x` subscription {
|
|
380
380
|
agentStatusChanged { ${fi} }
|
|
381
381
|
}
|
|
382
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;
|
|
382
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;re(this,ya,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=A(await re(this,ce,"f").mutate({mutation:x`
|
|
383
383
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
384
384
|
agentRequestCapability(authInfo: $authInfo)
|
|
385
385
|
}
|
|
386
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=A(await
|
|
386
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=A(await re(this,ce,"f").mutate({mutation:x`
|
|
387
387
|
mutation agentPermitCapability($auth: String!) {
|
|
388
388
|
agentPermitCapability(auth: $auth)
|
|
389
389
|
}
|
|
390
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=A(await
|
|
390
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=A(await re(this,ce,"f").mutate({mutation:x`
|
|
391
391
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
392
392
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
393
393
|
}
|
|
394
|
-
`,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=A(await
|
|
394
|
+
`,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=A(await re(this,ce,"f").mutate({mutation:x`query agentGetApps {
|
|
395
395
|
agentGetApps {
|
|
396
|
-
${
|
|
396
|
+
${Bo}
|
|
397
397
|
}
|
|
398
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=A(await
|
|
398
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentRemoveApp($requestId: String!) {
|
|
399
399
|
agentRemoveApp(requestId: $requestId) {
|
|
400
|
-
${
|
|
400
|
+
${Bo}
|
|
401
401
|
}
|
|
402
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=A(await
|
|
402
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentRevokeToken($requestId: String!) {
|
|
403
403
|
agentRevokeToken(requestId: $requestId) {
|
|
404
|
-
${
|
|
404
|
+
${Bo}
|
|
405
405
|
}
|
|
406
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=A(await
|
|
406
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=A(await re(this,ce,"f").mutate({mutation:x`
|
|
407
407
|
query agentIsLocked {
|
|
408
408
|
agentIsLocked
|
|
409
409
|
}
|
|
410
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=A(await
|
|
410
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=A(await re(this,ce,"f").mutate({mutation:x`mutation agentSignMessage($message: String!) {
|
|
411
411
|
agentSignMessage(message: $message) {
|
|
412
|
-
${
|
|
412
|
+
${$y}
|
|
413
413
|
}
|
|
414
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=A(await
|
|
414
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=A(await re(this,ce,"f").mutate({mutation:x`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
415
415
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
416
416
|
did
|
|
417
417
|
success
|
|
418
418
|
error
|
|
419
419
|
}
|
|
420
|
-
}`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=A(await
|
|
420
|
+
}`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=A(await re(this,ce,"f").mutate({mutation:x`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
421
421
|
runtimeLoginUser(email: $email, password: $password)
|
|
422
|
-
}`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=A(await
|
|
422
|
+
}`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=A(await re(this,ce,"f").mutate({mutation:x`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
423
423
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
424
424
|
success
|
|
425
425
|
message
|
|
426
426
|
requiresPassword
|
|
427
427
|
isExistingUser
|
|
428
428
|
}
|
|
429
|
-
}`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=A(await
|
|
429
|
+
}`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=A(await re(this,ce,"f").mutate({mutation:x`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
430
430
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
431
|
-
}`,variables:{email:e,code:t,verificationType:n}}));return i}};ce=new WeakMap,
|
|
431
|
+
}`,variables:{email:e,code:t,verificationType:n}}));return i}};ce=new WeakMap,ma=new WeakMap,ga=new WeakMap,ya=new WeakMap;var Fy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Pr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Mt,Ap=`
|
|
432
432
|
name
|
|
433
433
|
address
|
|
434
434
|
settings
|
|
435
435
|
icon { code }
|
|
436
436
|
constructorIcon { code }
|
|
437
437
|
settingsIcon { code }
|
|
438
|
-
`,
|
|
438
|
+
`,Op=`
|
|
439
439
|
name
|
|
440
440
|
address
|
|
441
441
|
description
|
|
@@ -445,13 +445,13 @@ neighbourhood {
|
|
|
445
445
|
templateAppliedParams
|
|
446
446
|
possibleTemplateParams
|
|
447
447
|
sourceCodeLink
|
|
448
|
-
`,
|
|
448
|
+
`,Pu=class{constructor(e){Mt.set(this,void 0),Fy(this,Mt,e,"f")}async byAddress(e){let{language:t}=A(await Pr(this,Mt,"f").query({query:x`query byAddress($address: String!) {
|
|
449
449
|
language(address: $address) {
|
|
450
|
-
${
|
|
450
|
+
${Ap}
|
|
451
451
|
}
|
|
452
452
|
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=A(await Pr(this,Mt,"f").query({query:x`query byFilter($filter: String!) {
|
|
453
453
|
languages(filter: $filter) {
|
|
454
|
-
${
|
|
454
|
+
${Ap}
|
|
455
455
|
}
|
|
456
456
|
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=A(await Pr(this,Mt,"f").mutate({mutation:x`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
457
457
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
@@ -467,13 +467,13 @@ neighbourhood {
|
|
|
467
467
|
$languageMeta: LanguageMetaInput!,
|
|
468
468
|
) {
|
|
469
469
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
470
|
-
${
|
|
470
|
+
${Op}
|
|
471
471
|
}
|
|
472
472
|
}`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=A(await Pr(this,Mt,"f").query({query:x`query languageMeta(
|
|
473
473
|
$address: String!,
|
|
474
474
|
) {
|
|
475
475
|
languageMeta(address: $address) {
|
|
476
|
-
${
|
|
476
|
+
${Op}
|
|
477
477
|
}
|
|
478
478
|
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=A(await Pr(this,Mt,"f").query({query:x`query languageSource(
|
|
479
479
|
$address: String!,
|
|
@@ -483,7 +483,7 @@ neighbourhood {
|
|
|
483
483
|
$address: String!,
|
|
484
484
|
) {
|
|
485
485
|
languageRemove(address: $address)
|
|
486
|
-
}`,variables:{address:e}}));return t}};Mt=new WeakMap;var
|
|
486
|
+
}`,variables:{address:e}}));return t}};Mt=new WeakMap;var My=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ze=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,yi,Lu=class{constructor(e){it.set(this,void 0),yi.set(this,new Map),My(this,it,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=A(await Ze(this,it,"f").mutate({mutation:x`mutation neighbourhoodPublishFromPerspective(
|
|
487
487
|
$linkLanguage: String!,
|
|
488
488
|
$meta: PerspectiveInput!,
|
|
489
489
|
$perspectiveUUID: String!
|
|
@@ -607,7 +607,7 @@ neighbourhood {
|
|
|
607
607
|
}
|
|
608
608
|
proof { valid, invalid, signature, key }
|
|
609
609
|
}
|
|
610
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{try{let{neighbourhoodSignal:i}=A(n);t.dispatchSignal(e,i)}catch(i){console.error("Error in signal subscription:",i)}},error:n=>{console.error("Signal subscription error for perspective",e,n)}})}async addSignalHandler(e,t){let n=Ze(this,yi,"f").get(e);n?n.push(t):(n=[],Ze(this,yi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=Ze(this,yi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};it=new WeakMap,yi=new WeakMap;var
|
|
610
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{try{let{neighbourhoodSignal:i}=A(n);t.dispatchSignal(e,i)}catch(i){console.error("Error in signal subscription:",i)}},error:n=>{console.error("Signal subscription error for perspective",e,n)}})}async addSignalHandler(e,t){let n=Ze(this,yi,"f").get(e);n?n.push(t):(n=[],Ze(this,yi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=Ze(this,yi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};it=new WeakMap,yi=new WeakMap;var Qo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},V=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},W,va,ba,Sa,Jd,zo=`
|
|
611
611
|
author
|
|
612
612
|
timestamp
|
|
613
613
|
data {
|
|
@@ -619,7 +619,7 @@ data {
|
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
proof { valid, invalid, signature, key }
|
|
622
|
-
`,
|
|
622
|
+
`,jy=`
|
|
623
623
|
description
|
|
624
624
|
appName
|
|
625
625
|
appUrl
|
|
@@ -628,72 +628,72 @@ trigger
|
|
|
628
628
|
perspectiveIds
|
|
629
629
|
webhookUrl
|
|
630
630
|
webhookAuth
|
|
631
|
-
`,
|
|
631
|
+
`,Yd=`
|
|
632
632
|
id
|
|
633
633
|
granted
|
|
634
|
-
${
|
|
635
|
-
|
|
636
|
-
notification { ${
|
|
634
|
+
${jy}
|
|
635
|
+
`,Uy=`
|
|
636
|
+
notification { ${Yd} }
|
|
637
637
|
perspectiveId
|
|
638
638
|
triggerMatch
|
|
639
|
-
|
|
639
|
+
`,$u=class{constructor(e,t=!0){W.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),Sa.set(this,void 0),Jd.set(this,void 0),Qo(this,W,e,"f"),Qo(this,va,[],"f"),Qo(this,ba,[],"f"),Qo(this,Sa,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=A(await V(this,W,"f").query({query:x`query runtimeInfo {
|
|
640
640
|
runtimeInfo {
|
|
641
641
|
ad4mExecutorVersion,
|
|
642
642
|
isInitialized,
|
|
643
643
|
isUnlocked
|
|
644
644
|
}
|
|
645
|
-
}`}));return e}async quit(){return A(await
|
|
645
|
+
}`}));return e}async quit(){return A(await V(this,W,"f").mutate({mutation:x`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeOpenLink($url: String!) {
|
|
646
646
|
runtimeOpenLink(url: $url)
|
|
647
|
-
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=A(await
|
|
647
|
+
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=A(await V(this,W,"f").mutate({mutation:x`mutation addTrustedAgents($agents: [String!]!) {
|
|
648
648
|
addTrustedAgents(agents: $agents)
|
|
649
|
-
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=A(await
|
|
649
|
+
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=A(await V(this,W,"f").mutate({mutation:x`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
650
650
|
deleteTrustedAgents(agents: $agents)
|
|
651
|
-
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=A(await
|
|
651
|
+
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=A(await V(this,W,"f").query({query:x`query getTrustedAgents {
|
|
652
652
|
getTrustedAgents
|
|
653
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=A(await
|
|
653
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
654
654
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
655
|
-
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=A(await
|
|
655
|
+
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
656
656
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
657
|
-
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=A(await
|
|
657
|
+
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=A(await V(this,W,"f").query({query:x`query runtimeKnownLinkLanguageTemplates {
|
|
658
658
|
runtimeKnownLinkLanguageTemplates
|
|
659
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=A(await
|
|
659
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeAddFriends($dids: [String!]!) {
|
|
660
660
|
runtimeAddFriends(dids: $dids)
|
|
661
|
-
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=A(await
|
|
661
|
+
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
662
662
|
runtimeRemoveFriends(dids: $dids)
|
|
663
|
-
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=A(await
|
|
663
|
+
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=A(await V(this,W,"f").query({query:x`query runtimeFriends {
|
|
664
664
|
runtimeFriends
|
|
665
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=A(await
|
|
665
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=A(await V(this,W,"f").query({query:x`query runtimeHcAgentInfos {
|
|
666
666
|
runtimeHcAgentInfos
|
|
667
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=A(await
|
|
667
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=A(await V(this,W,"f").query({query:x`query runtimeGetNetworkMetrics {
|
|
668
668
|
runtimeGetNetworkMetrics
|
|
669
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=A(await
|
|
669
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeRestartHolochain {
|
|
670
670
|
runtimeRestartHolochain
|
|
671
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=A(await
|
|
671
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
672
672
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
673
|
-
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=A(await
|
|
673
|
+
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=A(await V(this,W,"f").mutate({mutation:x`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
674
674
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
675
|
-
}`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=A(await
|
|
675
|
+
}`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
676
676
|
runtimeSetStatus(status: $status)
|
|
677
|
-
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=A(await
|
|
678
|
-
runtimeFriendStatus(did: $did) { ${
|
|
679
|
-
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=A(await
|
|
677
|
+
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=A(await V(this,W,"f").query({query:x`query runtimeFriendStatus($did: String!) {
|
|
678
|
+
runtimeFriendStatus(did: $did) { ${zo} }
|
|
679
|
+
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
680
680
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
681
|
-
}`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=A(await
|
|
682
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
683
|
-
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=A(await
|
|
681
|
+
}`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=A(await V(this,W,"f").query({query:x`query runtimeMessageInbox($filter: String) {
|
|
682
|
+
runtimeMessageInbox(filter: $filter) { ${zo} }
|
|
683
|
+
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=A(await V(this,W,"f").query({query:x`query runtimeMessageOutbox($filter: String) {
|
|
684
684
|
runtimeMessageOutbox(filter: $filter) {
|
|
685
685
|
recipient,
|
|
686
686
|
message {
|
|
687
|
-
${
|
|
687
|
+
${zo}
|
|
688
688
|
}
|
|
689
689
|
}
|
|
690
|
-
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=A(await
|
|
690
|
+
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
691
691
|
runtimeRequestInstallNotification(notification: $notification)
|
|
692
|
-
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=A(await
|
|
692
|
+
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeGrantNotification($id: String!) {
|
|
693
693
|
runtimeGrantNotification(id: $id)
|
|
694
|
-
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=A(await
|
|
694
|
+
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeExportDb($filePath: String!) {
|
|
695
695
|
runtimeExportDb(filePath: $filePath)
|
|
696
|
-
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=A(await
|
|
696
|
+
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeImportDb($filePath: String!) {
|
|
697
697
|
runtimeImportDb(filePath: $filePath) {
|
|
698
698
|
perspectives { total imported failed omitted errors }
|
|
699
699
|
links { total imported failed omitted errors }
|
|
@@ -707,51 +707,51 @@ triggerMatch
|
|
|
707
707
|
trustedAgents { total imported failed omitted errors }
|
|
708
708
|
knownLinkLanguages { total imported failed omitted errors }
|
|
709
709
|
}
|
|
710
|
-
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=A(await
|
|
711
|
-
runtimeNotifications { ${
|
|
712
|
-
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=A(await
|
|
710
|
+
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=A(await V(this,W,"f").query({query:x`query runtimeNotifications {
|
|
711
|
+
runtimeNotifications { ${Yd} }
|
|
712
|
+
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
713
713
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
714
|
-
}`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=A(await
|
|
714
|
+
}`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeRemoveNotification($id: String!) {
|
|
715
715
|
runtimeRemoveNotification(id: $id)
|
|
716
|
-
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=A(await
|
|
716
|
+
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
717
717
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
718
|
-
}`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=A(await
|
|
718
|
+
}`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeImportPerspective($filePath: String!) {
|
|
719
719
|
runtimeImportPerspective(filePath: $filePath)
|
|
720
|
-
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=A(await
|
|
720
|
+
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=A(await V(this,W,"f").query({query:x`query runtimeMultiUserEnabled {
|
|
721
721
|
runtimeMultiUserEnabled
|
|
722
|
-
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=A(await
|
|
722
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
723
723
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
724
|
-
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=A(await
|
|
724
|
+
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=A(await V(this,W,"f").query({query:x`query runtimeListUsers {
|
|
725
725
|
runtimeListUsers {
|
|
726
726
|
email
|
|
727
727
|
did
|
|
728
728
|
lastSeen
|
|
729
729
|
perspectiveCount
|
|
730
730
|
}
|
|
731
|
-
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=A(await
|
|
731
|
+
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeEmailTestModeEnable {
|
|
732
732
|
runtimeEmailTestModeEnable
|
|
733
|
-
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=A(await
|
|
733
|
+
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeEmailTestModeDisable {
|
|
734
734
|
runtimeEmailTestModeDisable
|
|
735
|
-
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=A(await
|
|
735
|
+
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeEmailTestGetCode($email: String!) {
|
|
736
736
|
runtimeEmailTestGetCode(email: $email)
|
|
737
|
-
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=A(await
|
|
737
|
+
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeEmailTestClearCodes {
|
|
738
738
|
runtimeEmailTestClearCodes
|
|
739
|
-
}`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=A(await
|
|
739
|
+
}`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=A(await V(this,W,"f").mutate({mutation:x`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
740
740
|
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
741
|
-
}`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){
|
|
742
|
-
runtimeNotificationTriggered { ${
|
|
741
|
+
}`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){V(this,Sa,"f").push(e)}subscribeNotificationTriggered(){V(this,W,"f").subscribe({query:x` subscription {
|
|
742
|
+
runtimeNotificationTriggered { ${Uy} }
|
|
743
743
|
}
|
|
744
|
-
`}).subscribe({next:e=>{
|
|
745
|
-
runtimeMessageReceived { ${
|
|
744
|
+
`}).subscribe({next:e=>{V(this,Sa,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){V(this,va,"f").push(e)}subscribeMessageReceived(){V(this,W,"f").subscribe({query:x` subscription {
|
|
745
|
+
runtimeMessageReceived { ${zo} }
|
|
746
746
|
}
|
|
747
|
-
`}).subscribe({next:e=>{
|
|
747
|
+
`}).subscribe({next:e=>{V(this,va,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){V(this,ba,"f").push(e)}subscribeExceptionOccurred(){V(this,W,"f").subscribe({query:x` subscription {
|
|
748
748
|
exceptionOccurred {
|
|
749
749
|
title
|
|
750
750
|
message
|
|
751
751
|
type
|
|
752
752
|
addon
|
|
753
753
|
}
|
|
754
|
-
}`}).subscribe({next:e=>{
|
|
754
|
+
}`}).subscribe({next:e=>{V(this,ba,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};W=new WeakMap,va=new WeakMap,ba=new WeakMap,Sa=new WeakMap,Jd=new WeakMap;var qy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},yr,Fu=class{constructor(e){yr.set(this,void 0),qy(this,yr,e,"f")}async get(e,t=!1){if(!t)try{let i=ve.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=A(await pi(this,yr,"f").query({query:x`query expression($url: String!) {
|
|
755
755
|
expression(url: $url) {
|
|
756
756
|
author
|
|
757
757
|
timestamp
|
|
@@ -789,7 +789,7 @@ triggerMatch
|
|
|
789
789
|
}
|
|
790
790
|
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=A(await pi(this,yr,"f").mutate({mutation:x`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
791
791
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
792
|
-
}`,variables:{url:e,interactionCall:t}}));return n}};yr=new WeakMap;var qs={};qs.byteLength=jy;qs.toByteArray=qy;qs.fromByteArray=Qy;var Xt=[],At=[],My=typeof Uint8Array<"u"?Uint8Array:Array,uu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,Op=uu.length;pn<Op;++pn)Xt[pn]=uu[pn],At[uu.charCodeAt(pn)]=pn;var pn,Op;At["-".charCodeAt(0)]=62;At["_".charCodeAt(0)]=63;function Hd(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function jy(r){var e=Hd(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Uy(r,e,t){return(e+t)*3/4-t}function qy(r){var e,t=Hd(r),n=t[0],i=t[1],a=new My(Uy(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=At[r.charCodeAt(c)]<<18|At[r.charCodeAt(c+1)]<<12|At[r.charCodeAt(c+2)]<<6|At[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=At[r.charCodeAt(c)]<<2|At[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=At[r.charCodeAt(c)]<<10|At[r.charCodeAt(c+1)]<<4|At[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function By(r){return Xt[r>>18&63]+Xt[r>>12&63]+Xt[r>>6&63]+Xt[r&63]}function Vy(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),i.push(By(n));return i.join("")}function Qy(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(Vy(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(Xt[e>>2]+Xt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Xt[e>>10]+Xt[e>>4&63]+Xt[e<<2&63]+"=")),i.join("")}var zy=4,Np=0,Dp=1,Wy=2;function Ri(r){let e=r.length;for(;--e>=0;)r[e]=0}var Gy=0,Jd=1,Ky=2,Hy=3,Jy=258,el=29,Wa=256,Pa=Wa+1+el,bi=30,tl=19,Yd=2*Pa+1,En=15,lu=16,Yy=7,rl=256,Zd=16,Xd=17,eh=18,Fu=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]),cs=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]),Zy=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),th=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xy=512,vr=new Array((Pa+2)*2);Ri(vr);var ka=new Array(bi*2);Ri(ka);var La=new Array(Xy);Ri(La);var $a=new Array(Jy-Hy+1);Ri($a);var nl=new Array(el);Ri(nl);var ks=new Array(bi);Ri(ks);function fu(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}var rh,nh,ih;function pu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var ah=r=>r<256?La[r]:La[256+(r>>>7)],Fa=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},dt=(r,e,t)=>{r.bi_valid>lu-t?(r.bi_buf|=e<<r.bi_valid&65535,Fa(r,r.bi_buf),r.bi_buf=e>>lu-r.bi_valid,r.bi_valid+=t-lu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},er=(r,e,t)=>{dt(r,t[e*2],t[e*2+1])},oh=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},ev=r=>{r.bi_valid===16?(Fa(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},tv=(r,e)=>{let t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,p,f,h,m=0;for(p=0;p<=En;p++)r.bl_count[p]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<Yd;u++)l=r.heap[u],p=t[t[l*2+1]*2+1]+1,p>c&&(p=c,m++),t[l*2+1]=p,!(l>n)&&(r.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=t[l*2],r.opt_len+=h*(p+f),a&&(r.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(p=c-1;r.bl_count[p]===0;)p--;r.bl_count[p]--,r.bl_count[p+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(l=r.bl_count[p];l!==0;)d=r.heap[--u],!(d>n)&&(t[d*2+1]!==p&&(r.opt_len+=(p-t[d*2+1])*t[d*2],t[d*2+1]=p),l--)}},sh=(r,e,t)=>{let n=new Array(En+1),i=0,a,o;for(a=1;a<=En;a++)i=i+t[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=oh(n[s]++,s))}},rv=()=>{let r,e,t,n,i,a=new Array(En+1);for(t=0,n=0;n<el-1;n++)for(nl[n]=t,r=0;r<1<<Fu[n];r++)$a[t++]=n;for($a[t-1]=n,i=0,n=0;n<16;n++)for(ks[n]=i,r=0;r<1<<cs[n];r++)La[i++]=n;for(i>>=7;n<bi;n++)for(ks[n]=i<<7,r=0;r<1<<cs[n]-7;r++)La[256+i++]=n;for(e=0;e<=En;e++)a[e]=0;for(r=0;r<=143;)vr[r*2+1]=8,r++,a[8]++;for(;r<=255;)vr[r*2+1]=9,r++,a[9]++;for(;r<=279;)vr[r*2+1]=7,r++,a[7]++;for(;r<=287;)vr[r*2+1]=8,r++,a[8]++;for(sh(vr,Pa+1,a),r=0;r<bi;r++)ka[r*2+1]=5,ka[r*2]=oh(r,5);rh=new fu(vr,Fu,Wa+1,Pa,En),nh=new fu(ka,cs,0,bi,En),ih=new fu(new Array(0),Zy,0,tl,Yy)},ch=r=>{let e;for(e=0;e<Pa;e++)r.dyn_ltree[e*2]=0;for(e=0;e<bi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<tl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[rl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},uh=r=>{r.bi_valid>8?Fa(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Rp=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},du=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&Rp(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!Rp(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Cp=(r,e,t)=>{let n,i,a=0,o,s;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+a++]&255,n+=(r.pending_buf[r.sym_buf+a++]&255)<<8,i=r.pending_buf[r.sym_buf+a++],n===0?er(r,i,e):(o=$a[i],er(r,o+Wa+1,e),s=Fu[o],s!==0&&(i-=nl[o],dt(r,i,s)),n--,o=ah(n),er(r,o,t),s=cs[o],s!==0&&(n-=ks[o],dt(r,n,s)));while(a<r.sym_next);er(r,rl,e)},Mu=(r,e)=>{let t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=Yd,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,i&&(r.static_len-=n[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)du(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],du(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[u*2]=t[o*2]+t[s*2],r.depth[u]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=u,r.heap[1]=u++,du(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],tv(r,e),sh(t,c,r.bl_count)},Pp=(r,e,t)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,n=0;n<=t;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==i&&r.bl_tree[a*2]++,r.bl_tree[Zd*2]++):s<=10?r.bl_tree[Xd*2]++:r.bl_tree[eh*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Lp=(r,e,t)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),n=0;n<=t;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do er(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(er(r,a,r.bl_tree),s--),er(r,Zd,r.bl_tree),dt(r,s-3,2)):s<=10?(er(r,Xd,r.bl_tree),dt(r,s-3,3)):(er(r,eh,r.bl_tree),dt(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},nv=r=>{let e;for(Pp(r,r.dyn_ltree,r.l_desc.max_code),Pp(r,r.dyn_dtree,r.d_desc.max_code),Mu(r,r.bl_desc),e=tl-1;e>=3&&r.bl_tree[th[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},iv=(r,e,t,n)=>{let i;for(dt(r,e-257,5),dt(r,t-1,5),dt(r,n-4,4),i=0;i<n;i++)dt(r,r.bl_tree[th[i]*2+1],3);Lp(r,r.dyn_ltree,e-1),Lp(r,r.dyn_dtree,t-1)},av=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Np;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Dp;for(t=32;t<Wa;t++)if(r.dyn_ltree[t*2]!==0)return Dp;return Np},$p=!1,ov=r=>{$p||(rv(),$p=!0),r.l_desc=new pu(r.dyn_ltree,rh),r.d_desc=new pu(r.dyn_dtree,nh),r.bl_desc=new pu(r.bl_tree,ih),r.bi_buf=0,r.bi_valid=0,ch(r)},lh=(r,e,t,n)=>{dt(r,(Gy<<1)+(n?1:0),3),uh(r),Fa(r,t),Fa(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},sv=r=>{dt(r,Jd<<1,3),er(r,rl,vr),ev(r)},cv=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===Wy&&(r.strm.data_type=av(r)),Mu(r,r.l_desc),Mu(r,r.d_desc),o=nv(r),i=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=i&&(i=a)):i=a=t+5,t+4<=i&&e!==-1?lh(r,e,t,n):r.strategy===zy||a===i?(dt(r,(Jd<<1)+(n?1:0),3),Cp(r,vr,ka)):(dt(r,(Ky<<1)+(n?1:0),3),iv(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Cp(r,r.dyn_ltree,r.dyn_dtree)),ch(r),n&&uh(r)},uv=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[($a[t]+Wa+1)*2]++,r.dyn_dtree[ah(e)*2]++),r.sym_next===r.sym_end),lv=ov,fv=lh,pv=cv,dv=uv,hv=sv,mv={_tr_init:lv,_tr_stored_block:fv,_tr_flush_block:pv,_tr_tally:dv,_tr_align:hv},gv=(r,e,t,n)=>{let i=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},Ma=gv,yv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},vv=new Uint32Array(yv()),bv=(r,e,t,n)=>{let i=vv,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},Be=bv,Cn={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"},Bn={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:Sv,_tr_stored_block:ju,_tr_flush_block:wv,_tr_tally:Vr,_tr_align:_v}=mv,{Z_NO_FLUSH:Qr,Z_PARTIAL_FLUSH:Ev,Z_FULL_FLUSH:xv,Z_FINISH:Nt,Z_BLOCK:Fp,Z_OK:He,Z_STREAM_END:Mp,Z_STREAM_ERROR:nr,Z_DATA_ERROR:Iv,Z_BUF_ERROR:hu,Z_DEFAULT_COMPRESSION:Tv,Z_FILTERED:kv,Z_HUFFMAN_ONLY:zo,Z_RLE:Av,Z_FIXED:Ov,Z_DEFAULT_STRATEGY:Nv,Z_UNKNOWN:Dv,Z_DEFLATED:Bs}=Bn,Rv=9,Cv=15,Pv=8,Lv=29,$v=256,Uu=$v+1+Lv,Fv=30,Mv=19,jv=2*Uu+1,Uv=15,re=3,jr=258,ir=jr+re+1,qv=32,xi=42,il=57,qu=69,Bu=73,Vu=91,Qu=103,xn=113,Sa=666,at=1,Ci=2,Pn=3,Pi=4,Bv=3,In=(r,e)=>(r.msg=Cn[e],e),jp=r=>r*2-(r>4?9:0),Mr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Vv=r=>{let e,t,n,i=r.w_size;e=r.hash_size,n=e;do t=r.head[--n],r.head[n]=t>=i?t-i:0;while(--e);e=i,n=e;do t=r.prev[--n],r.prev[n]=t>=i?t-i:0;while(--e)},Qv=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,zr=Qv,yt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},bt=(r,e)=>{wv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,yt(r.strm)},pe=(r,e)=>{r.pending_buf[r.pending++]=e},aa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},zu=(r,e,t,n)=>{let i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,e.set(r.input.subarray(r.next_in,r.next_in+i),t),r.state.wrap===1?r.adler=Ma(r.adler,e,i,t):r.state.wrap===2&&(r.adler=Be(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},fh=(r,e)=>{let t=r.max_chain_length,n=r.strstart,i,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-ir?r.strstart-(r.w_size-ir):0,u=r.window,l=r.w_mask,d=r.prev,p=r.strstart+jr,f=u[n+o-1],h=u[n+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(i=e,!(u[i+o]!==h||u[i+o-1]!==f||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&n<p);if(a=jr-(p-n),n=p-jr,a>o){if(r.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Ii=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-ir)&&(r.window.set(r.window.subarray(e,e+e-n),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Vv(r),n+=e),r.strm.avail_in===0)break;if(t=zu(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=re)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=zr(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=zr(r,r.ins_h,r.window[i+re-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert<re)););}while(r.lookahead<ir&&r.strm.avail_in!==0)},ph=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,i,a,o=0,s=r.strm.avail_in;do{if(n=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,i=r.strstart-r.block_start,n>i+r.strm.avail_in&&(n=i+r.strm.avail_in),n>a&&(n=a),n<t&&(n===0&&e!==Nt||e===Qr||n!==i+r.strm.avail_in)))break;o=e===Nt&&n===i+r.strm.avail_in?1:0,ju(r,0,0,o),r.pending_buf[r.pending-4]=n,r.pending_buf[r.pending-3]=n>>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,yt(r.strm),i&&(i>n&&(i=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+i),r.strm.next_out),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i,r.block_start+=i,n-=i),n&&(zu(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?Pi:e!==Qr&&e!==Nt&&r.strm.avail_in===0&&r.strstart===r.block_start?Ci:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(zu(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,i=r.strstart-r.block_start,(i>=t||(i||e===Nt)&&e!==Qr&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Nt&&r.strm.avail_in===0&&n===i?1:0,ju(r,r.block_start,n,o),r.block_start+=n,yt(r.strm)),o?Pn:at)},mu=(r,e)=>{let t,n;for(;;){if(r.lookahead<ir){if(Ii(r),r.lookahead<ir&&e===Qr)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=re&&(r.ins_h=zr(r,r.ins_h,r.window[r.strstart+re-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-ir&&(r.match_length=fh(r,t)),r.match_length>=re)if(n=Vr(r,r.strstart-r.match_start,r.match_length-re),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=re){r.match_length--;do r.strstart++,r.ins_h=zr(r,r.ins_h,r.window[r.strstart+re-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=zr(r,r.ins_h,r.window[r.strstart+1]);else n=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=r.strstart<re-1?r.strstart:re-1,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Pi):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Ci},di=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<ir){if(Ii(r),r.lookahead<ir&&e===Qr)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=re&&(r.ins_h=zr(r,r.ins_h,r.window[r.strstart+re-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=re-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-ir&&(r.match_length=fh(r,t),r.match_length<=5&&(r.strategy===kv||r.match_length===re&&r.strstart-r.match_start>4096)&&(r.match_length=re-1)),r.prev_length>=re&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-re,n=Vr(r,r.strstart-1-r.prev_match,r.prev_length-re),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=zr(r,r.ins_h,r.window[r.strstart+re-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=re-1,r.strstart++,n&&(bt(r,!1),r.strm.avail_out===0))return at}else if(r.match_available){if(n=Vr(r,0,r.window[r.strstart-1]),n&&bt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return at}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Vr(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<re-1?r.strstart:re-1,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Pi):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Ci},zv=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=jr){if(Ii(r),r.lookahead<=jr&&e===Qr)return at;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=re&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+jr;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);r.match_length=jr-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=re?(t=Vr(r,1,r.match_length-re),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Pi):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Ci},Wv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Ii(r),r.lookahead===0)){if(e===Qr)return at;break}if(r.match_length=0,t=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Pi):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Ci};function Kt(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}var wa=[new Kt(0,0,0,0,ph),new Kt(4,4,8,4,mu),new Kt(4,5,16,8,mu),new Kt(4,6,32,32,mu),new Kt(4,4,16,16,di),new Kt(8,16,32,32,di),new Kt(8,16,128,128,di),new Kt(8,32,128,256,di),new Kt(32,128,258,1024,di),new Kt(32,258,258,4096,di)],Gv=r=>{r.window_size=2*r.w_size,Mr(r.head),r.max_lazy_match=wa[r.level].max_lazy,r.good_match=wa[r.level].good_length,r.nice_match=wa[r.level].nice_length,r.max_chain_length=wa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=re-1,r.match_available=0,r.ins_h=0};function Kv(){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=Bs,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(jv*2),this.dyn_dtree=new Uint16Array((2*Fv+1)*2),this.bl_tree=new Uint16Array((2*Mv+1)*2),Mr(this.dyn_ltree),Mr(this.dyn_dtree),Mr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Uv+1),this.heap=new Uint16Array(2*Uu+1),Mr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Uu+1),Mr(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 Ga=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==xi&&e.status!==il&&e.status!==qu&&e.status!==Bu&&e.status!==Vu&&e.status!==Qu&&e.status!==xn&&e.status!==Sa?1:0},dh=r=>{if(Ga(r))return In(r,nr);r.total_in=r.total_out=0,r.data_type=Dv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?il:e.wrap?xi:xn,r.adler=e.wrap===2?0:1,e.last_flush=-2,Sv(e),He},hh=r=>{let e=dh(r);return e===He&&Gv(r.state),e},Hv=(r,e)=>Ga(r)||r.state.wrap!==2?nr:(r.state.gzhead=e,He),mh=(r,e,t,n,i,a)=>{if(!r)return nr;let o=1;if(e===Tv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>Rv||t!==Bs||n<8||n>15||e<0||e>9||a<0||a>Ov||n===8&&o!==1)return In(r,nr);n===8&&(n=9);let s=new Kv;return r.state=s,s.strm=r,s.status=xi,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+re-1)/re),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,hh(r)},Jv=(r,e)=>mh(r,e,Bs,Cv,Pv,Nv),Yv=(r,e)=>{if(Ga(r)||e>Fp||e<0)return r?In(r,nr):nr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Sa&&e!==Nt)return In(r,r.avail_out===0?hu:nr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(yt(r),r.avail_out===0)return t.last_flush=-1,He}else if(r.avail_in===0&&jp(e)<=jp(n)&&e!==Nt)return In(r,hu);if(t.status===Sa&&r.avail_in!==0)return In(r,hu);if(t.status===xi&&t.wrap===0&&(t.status=xn),t.status===xi){let i=Bs+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=zo||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=qv),i+=31-i%31,aa(t,i),t.strstart!==0&&(aa(t,r.adler>>>16),aa(t,r.adler&65535)),r.adler=1,t.status=xn,yt(r),t.pending!==0)return t.last_flush=-1,He}if(t.status===il){if(r.adler=0,pe(t,31),pe(t,139),pe(t,8),t.gzhead)pe(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)),pe(t,t.gzhead.time&255),pe(t,t.gzhead.time>>8&255),pe(t,t.gzhead.time>>16&255),pe(t,t.gzhead.time>>24&255),pe(t,t.level===9?2:t.strategy>=zo||t.level<2?4:0),pe(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(pe(t,t.gzhead.extra.length&255),pe(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Be(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=qu;else if(pe(t,0),pe(t,0),pe(t,0),pe(t,0),pe(t,0),pe(t,t.level===9?2:t.strategy>=zo||t.level<2?4:0),pe(t,Bv),t.status=xn,yt(r),t.pending!==0)return t.last_flush=-1,He}if(t.status===qu){if(t.gzhead.extra){let i=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,yt(r),t.pending!==0)return t.last_flush=-1,He;i=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Bu}if(t.status===Bu){if(t.gzhead.name){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),yt(r),t.pending!==0)return t.last_flush=-1,He;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,pe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Vu}if(t.status===Vu){if(t.gzhead.comment){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),yt(r),t.pending!==0)return t.last_flush=-1,He;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,pe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i))}t.status=Qu}if(t.status===Qu){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(yt(r),t.pending!==0))return t.last_flush=-1,He;pe(t,r.adler&255),pe(t,r.adler>>8&255),r.adler=0}if(t.status=xn,yt(r),t.pending!==0)return t.last_flush=-1,He}if(r.avail_in!==0||t.lookahead!==0||e!==Qr&&t.status!==Sa){let i=t.level===0?ph(t,e):t.strategy===zo?Wv(t,e):t.strategy===Av?zv(t,e):wa[t.level].func(t,e);if((i===Pn||i===Pi)&&(t.status=Sa),i===at||i===Pn)return r.avail_out===0&&(t.last_flush=-1),He;if(i===Ci&&(e===Ev?_v(t):e!==Fp&&(ju(t,0,0,!1),e===xv&&(Mr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),yt(r),r.avail_out===0))return t.last_flush=-1,He}return e!==Nt?He:t.wrap<=0?Mp:(t.wrap===2?(pe(t,r.adler&255),pe(t,r.adler>>8&255),pe(t,r.adler>>16&255),pe(t,r.adler>>24&255),pe(t,r.total_in&255),pe(t,r.total_in>>8&255),pe(t,r.total_in>>16&255),pe(t,r.total_in>>24&255)):(aa(t,r.adler>>>16),aa(t,r.adler&65535)),yt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?He:Mp)},Zv=r=>{if(Ga(r))return nr;let e=r.state.status;return r.state=null,e===xn?In(r,Iv):He},Xv=(r,e)=>{let t=e.length;if(Ga(r))return nr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==xi||n.lookahead)return nr;if(i===1&&(r.adler=Ma(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Mr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(t-n.w_size,t),0),e=c,t=n.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Ii(n);n.lookahead>=re;){let c=n.strstart,u=n.lookahead-(re-1);do n.ins_h=zr(n,n.ins_h,n.window[c+re-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--u);n.strstart=c,n.lookahead=re-1,Ii(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=re-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,He},eb=Jv,tb=mh,rb=hh,nb=dh,ib=Hv,ab=Yv,ob=Zv,sb=Xv,cb="pako deflate (from Nodeca project)",Aa={deflateInit:eb,deflateInit2:tb,deflateReset:rb,deflateResetKeep:nb,deflateSetHeader:ib,deflate:ab,deflateEnd:ob,deflateSetDictionary:sb,deflateInfo:cb},ub=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),lb=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let n in t)ub(t,n)&&(r[n]=t[n])}}return r},fb=r=>{let e=0;for(let n=0,i=r.length;n<i;n++)e+=r[n].length;let t=new Uint8Array(e);for(let n=0,i=0,a=r.length;n<a;n++){let o=r[n];t.set(o,i),i+=o.length}return t},Vs={assign:lb,flattenChunks:fb},gh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){gh=!1}var ja=new Uint8Array(256);for(let r=0;r<256;r++)ja[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;ja[254]=ja[254]=1;var pb=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,n,i,a,o=r.length,s=0;for(i=0;i<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),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},db=(r,e)=>{if(e<65534&&r.subarray&&gh)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(r[n]);return t},hb=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let n,i,a=new Array(t*2);for(i=0,n=0;n<t;){let o=r[n++];if(o<128){a[i++]=o;continue}let s=ja[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<t;)o=o<<6|r[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return db(a,i)},mb=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+ja[r[t]]>e?t:e},Ua={string2buf:pb,buf2string:hb,utf8border:mb};function gb(){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 yh=gb,vh=Object.prototype.toString,{Z_NO_FLUSH:yb,Z_SYNC_FLUSH:vb,Z_FULL_FLUSH:bb,Z_FINISH:Sb,Z_OK:As,Z_STREAM_END:wb,Z_DEFAULT_COMPRESSION:_b,Z_DEFAULT_STRATEGY:Eb,Z_DEFLATED:xb}=Bn;function Ka(r){this.options=Vs.assign({level:_b,method:xb,chunkSize:16384,windowBits:15,memLevel:8,strategy:Eb},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yh,this.strm.avail_out=0;let t=Aa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==As)throw new Error(Cn[t]);if(e.header&&Aa.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=Ua.string2buf(e.dictionary):vh.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=Aa.deflateSetDictionary(this.strm,n),t!==As)throw new Error(Cn[t]);this._dict_set=!0}}Ka.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?Sb:yb,typeof r=="string"?t.input=Ua.string2buf(r):vh.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),(a===vb||a===bb)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=Aa.deflate(t,a),i===wb)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Aa.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===As;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};Ka.prototype.onData=function(r){this.chunks.push(r)};Ka.prototype.onEnd=function(r){r===As&&(this.result=Vs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function al(r,e){let t=new Ka(e);if(t.push(r,!0),t.err)throw t.msg||Cn[t.err];return t.result}function Ib(r,e){return e=e||{},e.raw=!0,al(r,e)}function Tb(r,e){return e=e||{},e.gzip=!0,al(r,e)}var kb=Ka,Ab=al,Ob=Ib,Nb=Tb,Db=Bn,Rb={Deflate:kb,deflate:Ab,deflateRaw:Ob,gzip:Nb,constants:Db},Wo=16209,Cb=16191,Pb=function r(e,t){let n,i,a,o,s,c,u,l,d,p,f,h,m,g,S,b,v,y,k,R,T,P,$,C,I=e.state;n=e.next_in,$=e.input,i=n+(e.avail_in-5),a=e.next_out,C=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=I.dmax,u=I.wsize,l=I.whave,d=I.wnext,p=I.window,f=I.hold,h=I.bits,m=I.lencode,g=I.distcode,S=(1<<I.lenbits)-1,b=(1<<I.distbits)-1;e:do{h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),v=m[f&S];t:for(;;){if(y=v>>>24,f>>>=y,h-=y,y=v>>>16&255,y===0)C[a++]=v&65535;else if(y&16){k=v&65535,y&=15,y&&(h<y&&(f+=$[n++]<<h,h+=8),k+=f&(1<<y)-1,f>>>=y,h-=y),h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),v=g[f&b];r:for(;;){if(y=v>>>24,f>>>=y,h-=y,y=v>>>16&255,y&16){if(R=v&65535,y&=15,h<y&&(f+=$[n++]<<h,h+=8,h<y&&(f+=$[n++]<<h,h+=8)),R+=f&(1<<y)-1,R>c){e.msg="invalid distance too far back",I.mode=Wo;break e}if(f>>>=y,h-=y,y=a-o,R>y){if(y=R-y,y>l&&I.sane){e.msg="invalid distance too far back",I.mode=Wo;break e}if(T=0,P=p,d===0){if(T+=u-y,y<k){k-=y;do C[a++]=p[T++];while(--y);T=a-R,P=C}}else if(d<y){if(T+=u+d-y,y-=d,y<k){k-=y;do C[a++]=p[T++];while(--y);if(T=0,d<k){y=d,k-=y;do C[a++]=p[T++];while(--y);T=a-R,P=C}}}else if(T+=d-y,y<k){k-=y;do C[a++]=p[T++];while(--y);T=a-R,P=C}for(;k>2;)C[a++]=P[T++],C[a++]=P[T++],C[a++]=P[T++],k-=3;k&&(C[a++]=P[T++],k>1&&(C[a++]=P[T++]))}else{T=a-R;do C[a++]=C[T++],C[a++]=C[T++],C[a++]=C[T++],k-=3;while(k>2);k&&(C[a++]=C[T++],k>1&&(C[a++]=C[T++]))}}else if((y&64)===0){v=g[(v&65535)+(f&(1<<y)-1)];continue r}else{e.msg="invalid distance code",I.mode=Wo;break e}break}}else if((y&64)===0){v=m[(v&65535)+(f&(1<<y)-1)];continue t}else if(y&32){I.mode=Cb;break e}else{e.msg="invalid literal/length code",I.mode=Wo;break e}break}}while(n<i&&a<s);k=h>>3,n-=k,h-=k<<3,f&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),I.hold=f,I.bits=h},hi=15,Up=852,qp=592,Bp=0,gu=1,Vp=2,Lb=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]),$b=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]),Fb=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]),Mb=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]),jb=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,p=0,f=0,h=0,m=0,g=0,S=0,b=0,v,y,k,R,T,P=null,$,C=new Uint16Array(hi+1),I=new Uint16Array(hi+1),Ie=null,Le,Q,ge;for(u=0;u<=hi;u++)C[u]=0;for(l=0;l<n;l++)C[e[t+l]]++;for(f=c,p=hi;p>=1&&C[p]===0;p--);if(f>p&&(f=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<p&&C[d]===0;d++);for(f<d&&(f=d),g=1,u=1;u<=hi;u++)if(g<<=1,g-=C[u],g<0)return-1;if(g>0&&(r===Bp||p!==1))return-1;for(I[1]=0,u=1;u<hi;u++)I[u+1]=I[u]+C[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[I[e[t+l]]++]=l);if(r===Bp?(P=Ie=o,$=20):r===gu?(P=Lb,Ie=$b,$=257):(P=Fb,Ie=Mb,$=0),b=0,l=0,u=d,T=a,h=f,m=0,k=-1,S=1<<f,R=S-1,r===gu&&S>Up||r===Vp&&S>qp)return 1;for(;;){Le=u-m,o[l]+1<$?(Q=0,ge=o[l]):o[l]>=$?(Q=Ie[o[l]-$],ge=P[o[l]-$]):(Q=32+64,ge=0),v=1<<u-m,y=1<<h,d=y;do y-=v,i[T+(b>>m)+y]=Le<<24|Q<<16|ge|0;while(y!==0);for(v=1<<u-1;b&v;)v>>=1;if(v!==0?(b&=v-1,b+=v):b=0,l++,--C[u]===0){if(u===p)break;u=e[t+o[l]]}if(u>f&&(b&R)!==k){for(m===0&&(m=f),T+=d,h=u-m,g=1<<h;h+m<p&&(g-=C[h+m],!(g<=0));)h++,g<<=1;if(S+=1<<h,r===gu&&S>Up||r===Vp&&S>qp)return 1;k=b&R,i[k]=f<<24|h<<16|T-a|0}}return b!==0&&(i[T+b]=u-m<<24|64<<16|0),s.bits=f,0},Oa=jb,Ub=0,bh=1,Sh=2,{Z_FINISH:Qp,Z_BLOCK:qb,Z_TREES:Go,Z_OK:Ln,Z_STREAM_END:Bb,Z_NEED_DICT:Vb,Z_STREAM_ERROR:Dt,Z_DATA_ERROR:wh,Z_MEM_ERROR:_h,Z_BUF_ERROR:Qb,Z_DEFLATED:zp}=Bn,Qs=16180,Wp=16181,Gp=16182,Kp=16183,Hp=16184,Jp=16185,Yp=16186,Zp=16187,Xp=16188,ed=16189,Os=16190,hr=16191,yu=16192,td=16193,vu=16194,rd=16195,nd=16196,id=16197,ad=16198,Ko=16199,Ho=16200,od=16201,sd=16202,cd=16203,ud=16204,ld=16205,bu=16206,fd=16207,pd=16208,Ee=16209,Eh=16210,xh=16211,zb=852,Wb=592,Gb=15,Kb=Gb,dd=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Hb(){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 Vn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Qs||e.mode>xh?1:0},Ih=r=>{if(Vn(r))return Dt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Qs,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(zb),e.distcode=e.distdyn=new Int32Array(Wb),e.sane=1,e.back=-1,Ln},Th=r=>{if(Vn(r))return Dt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Ih(r)},kh=(r,e)=>{let t;if(Vn(r))return Dt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Dt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Th(r))},Ah=(r,e)=>{if(!r)return Dt;let t=new Hb;r.state=t,t.strm=r,t.window=null,t.mode=Qs;let n=kh(r,e);return n!==Ln&&(r.state=null),n},Jb=r=>Ah(r,Kb),hd=!0,Su,wu,Yb=r=>{if(hd){Su=new Int32Array(512),wu=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(Oa(bh,r.lens,0,288,Su,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Oa(Sh,r.lens,0,32,wu,0,r.work,{bits:5}),hd=!1}r.lencode=Su,r.lenbits=9,r.distcode=wu,r.distbits=5},Oh=(r,e,t,n)=>{let i,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(t-n,t-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(t-n,t),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Zb=(r,e)=>{let t,n,i,a,o,s,c,u,l,d,p,f,h,m,g=0,S,b,v,y,k,R,T,P,$=new Uint8Array(4),C,I,Ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vn(r)||!r.output||!r.input&&r.avail_in!==0)return Dt;t=r.state,t.mode===hr&&(t.mode=yu),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,p=c,P=Ln;e:for(;;)switch(t.mode){case Qs:if(t.wrap===0){t.mode=yu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,$[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0),u=0,l=0,t.mode=Wp;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=Ee;break}if((u&15)!==zp){r.msg="unknown compression method",t.mode=Ee;break}if(u>>>=4,l-=4,T=(u&15)+8,t.wbits===0&&(t.wbits=T),T>15||T>t.wbits){r.msg="invalid window size",t.mode=Ee;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?ed:hr,u=0,l=0;break;case Wp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==zp){r.msg="unknown compression method",t.mode=Ee;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Ee;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0,t.mode=Gp;case Gp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,$[2]=u>>>16&255,$[3]=u>>>24&255,t.check=Be(t.check,$,4,0)),u=0,l=0,t.mode=Kp;case Kp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0,t.mode=Hp;case Hp:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=Jp;case Jp:if(t.flags&1024&&(f=t.length,f>s&&(f=s),f&&(t.head&&(T=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(a,a+f),T)),t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,t.length-=f),t.length))break e;t.length=0,t.mode=Yp;case Yp:if(t.flags&2048){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.name+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Zp;case Zp:if(t.flags&4096){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.comment+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.comment=null);t.mode=Xp;case Xp:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Ee;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=hr;break;case ed:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=dd(u),u=0,l=0,t.mode=Os;case Os:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,Vb;r.adler=t.check=1,t.mode=hr;case hr:if(e===qb||e===Go)break e;case yu:if(t.last){u>>>=l&7,l-=l&7,t.mode=bu;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=td;break;case 1:if(Yb(t),t.mode=Ko,e===Go){u>>>=2,l-=2;break e}break;case 2:t.mode=nd;break;case 3:r.msg="invalid block type",t.mode=Ee}u>>>=2,l-=2;break;case td:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Ee;break}if(t.length=u&65535,u=0,l=0,t.mode=vu,e===Go)break e;case vu:t.mode=rd;case rd:if(f=t.length,f){if(f>s&&(f=s),f>c&&(f=c),f===0)break e;i.set(n.subarray(a,a+f),o),s-=f,a+=f,c-=f,o+=f,t.length-=f;break}t.mode=hr;break;case nd:for(;l<14;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Ee;break}t.have=0,t.mode=id;case id:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.lens[Ie[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Ie[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,C={bits:t.lenbits},P=Oa(Ub,t.lens,0,19,t.lencode,0,t.work,C),t.lenbits=C.bits,P){r.msg="invalid code lengths set",t.mode=Ee;break}t.have=0,t.mode=ad;case ad:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[u&(1<<t.lenbits)-1],S=g>>>24,b=g>>>16&255,v=g&65535,!(S<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(v<16)u>>>=S,l-=S,t.lens[t.have++]=v;else{if(v===16){for(I=S+2;l<I;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=S,l-=S,t.have===0){r.msg="invalid bit length repeat",t.mode=Ee;break}T=t.lens[t.have-1],f=3+(u&3),u>>>=2,l-=2}else if(v===17){for(I=S+3;l<I;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=S,l-=S,T=0,f=3+(u&7),u>>>=3,l-=3}else{for(I=S+7;l<I;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=S,l-=S,T=0,f=11+(u&127),u>>>=7,l-=7}if(t.have+f>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Ee;break}for(;f--;)t.lens[t.have++]=T}}if(t.mode===Ee)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Ee;break}if(t.lenbits=9,C={bits:t.lenbits},P=Oa(bh,t.lens,0,t.nlen,t.lencode,0,t.work,C),t.lenbits=C.bits,P){r.msg="invalid literal/lengths set",t.mode=Ee;break}if(t.distbits=6,t.distcode=t.distdyn,C={bits:t.distbits},P=Oa(Sh,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,C),t.distbits=C.bits,P){r.msg="invalid distances set",t.mode=Ee;break}if(t.mode=Ko,e===Go)break e;case Ko:t.mode=Ho;case Ho:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,Pb(r,p),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===hr&&(t.back=-1);break}for(t.back=0;g=t.lencode[u&(1<<t.lenbits)-1],S=g>>>24,b=g>>>16&255,v=g&65535,!(S<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(b&&(b&240)===0){for(y=S,k=b,R=v;g=t.lencode[R+((u&(1<<y+k)-1)>>y)],S=g>>>24,b=g>>>16&255,v=g&65535,!(y+S<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=S,l-=S,t.back+=S,t.length=v,b===0){t.mode=ld;break}if(b&32){t.back=-1,t.mode=hr;break}if(b&64){r.msg="invalid literal/length code",t.mode=Ee;break}t.extra=b&15,t.mode=od;case od:if(t.extra){for(I=t.extra;l<I;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=sd;case sd:for(;g=t.distcode[u&(1<<t.distbits)-1],S=g>>>24,b=g>>>16&255,v=g&65535,!(S<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((b&240)===0){for(y=S,k=b,R=v;g=t.distcode[R+((u&(1<<y+k)-1)>>y)],S=g>>>24,b=g>>>16&255,v=g&65535,!(y+S<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=S,l-=S,t.back+=S,b&64){r.msg="invalid distance code",t.mode=Ee;break}t.offset=v,t.extra=b&15,t.mode=cd;case cd:if(t.extra){for(I=t.extra;l<I;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Ee;break}t.mode=ud;case ud:if(c===0)break e;if(f=p-c,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Ee;break}f>t.wnext?(f-=t.wnext,h=t.wsize-f):h=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,h=o-t.offset,f=t.length;f>c&&(f=c),c-=f,t.length-=f;do i[o++]=m[h++];while(--f);t.length===0&&(t.mode=Ho);break;case ld:if(c===0)break e;i[o++]=t.length,c--,t.mode=Ho;break;case bu:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(p-=c,r.total_out+=p,t.total+=p,t.wrap&4&&p&&(r.adler=t.check=t.flags?Be(t.check,i,p,o-p):Ma(t.check,i,p,o-p)),p=c,t.wrap&4&&(t.flags?u:dd(u))!==t.check){r.msg="incorrect data check",t.mode=Ee;break}u=0,l=0}t.mode=fd;case fd:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Ee;break}u=0,l=0}t.mode=pd;case pd:P=Bb;break e;case Ee:P=wh;break e;case Eh:return _h;case xh:default:return Dt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||p!==r.avail_out&&t.mode<Ee&&(t.mode<bu||e!==Qp))&&Oh(r,r.output,r.next_out,p-r.avail_out),d-=r.avail_in,p-=r.avail_out,r.total_in+=d,r.total_out+=p,t.total+=p,t.wrap&4&&p&&(r.adler=t.check=t.flags?Be(t.check,i,p,r.next_out-p):Ma(t.check,i,p,r.next_out-p)),r.data_type=t.bits+(t.last?64:0)+(t.mode===hr?128:0)+(t.mode===Ko||t.mode===vu?256:0),(d===0&&p===0||e===Qp)&&P===Ln&&(P=Qb),P},Xb=r=>{if(Vn(r))return Dt;let e=r.state;return e.window&&(e.window=null),r.state=null,Ln},eS=(r,e)=>{if(Vn(r))return Dt;let t=r.state;return(t.wrap&2)===0?Dt:(t.head=e,e.done=!1,Ln)},tS=(r,e)=>{let t=e.length,n,i,a;return Vn(r)||(n=r.state,n.wrap!==0&&n.mode!==Os)?Dt:n.mode===Os&&(i=1,i=Ma(i,e,t,0),i!==n.check)?wh:(a=Oh(r,e,t,t),a?(n.mode=Eh,_h):(n.havedict=1,Ln))},rS=Th,nS=kh,iS=Ih,aS=Jb,oS=Ah,sS=Zb,cS=Xb,uS=eS,lS=tS,fS="pako inflate (from Nodeca project)",br={inflateReset:rS,inflateReset2:nS,inflateResetKeep:iS,inflateInit:aS,inflateInit2:oS,inflate:sS,inflateEnd:cS,inflateGetHeader:uS,inflateSetDictionary:lS,inflateInfo:fS};function pS(){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 dS=pS,Nh=Object.prototype.toString,{Z_NO_FLUSH:hS,Z_FINISH:mS,Z_OK:qa,Z_STREAM_END:_u,Z_NEED_DICT:Eu,Z_STREAM_ERROR:gS,Z_DATA_ERROR:md,Z_MEM_ERROR:yS}=Bn;function Ha(r){this.options=Vs.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new yh,this.strm.avail_out=0;let t=br.inflateInit2(this.strm,e.windowBits);if(t!==qa)throw new Error(Cn[t]);if(this.header=new dS,br.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Ua.string2buf(e.dictionary):Nh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=br.inflateSetDictionary(this.strm,e.dictionary),t!==qa)))throw new Error(Cn[t])}Ha.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?mS:hS,Nh.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),a=br.inflate(t,o),a===Eu&&i&&(a=br.inflateSetDictionary(t,i),a===qa?a=br.inflate(t,o):a===md&&(a=Eu));t.avail_in>0&&a===_u&&t.state.wrap>0&&r[t.next_in]!==0;)br.inflateReset(t),a=br.inflate(t,o);switch(a){case gS:case md:case Eu:case yS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===_u))if(this.options.to==="string"){let c=Ua.utf8border(t.output,t.next_out),u=t.next_out-c,l=Ua.buf2string(t.output,c);t.next_out=u,t.avail_out=n-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===qa&&s===0)){if(a===_u)return a=br.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Ha.prototype.onData=function(r){this.chunks.push(r)};Ha.prototype.onEnd=function(r){r===qa&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Vs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ol(r,e){let t=new Ha(e);if(t.push(r),t.err)throw t.msg||Cn[t.err];return t.result}function vS(r,e){return e=e||{},e.raw=!0,ol(r,e)}var bS=Ha,SS=ol,wS=vS,_S=ol,ES=Bn,xS={Inflate:bS,inflate:SS,inflateRaw:wS,ungzip:_S,constants:ES},{Deflate:IS,deflate:TS,deflateRaw:kS,gzip:AS}=Rb,{Inflate:OS,inflate:NS,inflateRaw:DS,ungzip:RS}=xS,CS=IS,PS=TS,LS=kS,$S=AS,FS=OS,MS=NS,jS=DS,US=RS,qS=Bn,BS={Deflate:CS,deflate:PS,deflateRaw:LS,gzip:$S,Inflate:FS,inflate:MS,inflateRaw:jS,ungzip:US,constants:qS},be=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Se=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ns=class{constructor(e,t){this.input=e,this.output=t}};be([w(),Se("design:type",String)],Ns.prototype,"input",void 0);be([w(),Se("design:type",String)],Ns.prototype,"output",void 0);Ns=be([Qe(),Se("design:paramtypes",[String,String])],Ns);var Ds=class{constructor(e,t){this.input=e,this.output=t}};be([w(),Se("design:type",String)],Ds.prototype,"input",void 0);be([w(),Se("design:type",String)],Ds.prototype,"output",void 0);Ds=be([z(),Se("design:paramtypes",[String,String])],Ds);var Hr=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};be([w(),Se("design:type",String)],Hr.prototype,"name",void 0);be([w(),Se("design:type",String)],Hr.prototype,"modelId",void 0);be([w(),Se("design:type",String)],Hr.prototype,"systemPrompt",void 0);be([w(),Se("design:type",Array)],Hr.prototype,"promptExamples",void 0);be([w(),Se("design:type",String)],Hr.prototype,"metaData",void 0);Hr=be([Qe(),Se("design:paramtypes",[String,String,String,Array,String])],Hr);var sr=class{constructor(e,t,n,i,a,o,s,c){this.name=e,this.modelId=t,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};be([w(),Se("design:type",String)],sr.prototype,"name",void 0);be([w(),Se("design:type",String)],sr.prototype,"modelId",void 0);be([w(),Se("design:type",String)],sr.prototype,"taskId",void 0);be([w(),Se("design:type",String)],sr.prototype,"systemPrompt",void 0);be([w(),Se("design:type",Array)],sr.prototype,"promptExamples",void 0);be([w(),Se("design:type",String)],sr.prototype,"metaData",void 0);be([w(),Se("design:type",String)],sr.prototype,"createdAt",void 0);be([w(),Se("design:type",String)],sr.prototype,"updatedAt",void 0);sr=be([z(),Se("design:paramtypes",[String,String,String,String,Array,String,String,String])],sr);var $n=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};be([w(),Se("design:type",String)],$n.prototype,"model",void 0);be([w(),Se("design:type",String)],$n.prototype,"status",void 0);be([w(),Se("design:type",Number)],$n.prototype,"progress",void 0);be([w(),Se("design:type",Boolean)],$n.prototype,"downloaded",void 0);be([w(),Se("design:type",Boolean)],$n.prototype,"loaded",void 0);$n=be([z(),Se("design:paramtypes",[String,String,Number,Boolean,Boolean])],$n);var VS=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ue=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Me,us,Wu=class{constructor(e,t=!0){Me.set(this,void 0),us.set(this,new Map),VS(this,Me,e,"f")}async getModels(){let e=await Ue(this,Me,"f").query({query:x`
|
|
792
|
+
}`,variables:{url:e,interactionCall:t}}));return n}};yr=new WeakMap;var Bs={};Bs.byteLength=Vy;Bs.toByteArray=zy;Bs.fromByteArray=Hy;var Xt=[],At=[],By=typeof Uint8Array<"u"?Uint8Array:Array,lu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(dn=0,Np=lu.length;dn<Np;++dn)Xt[dn]=lu[dn],At[lu.charCodeAt(dn)]=dn;var dn,Np;At["-".charCodeAt(0)]=62;At["_".charCodeAt(0)]=63;function Zd(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function Vy(r){var e=Zd(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Qy(r,e,t){return(e+t)*3/4-t}function zy(r){var e,t=Zd(r),n=t[0],i=t[1],a=new By(Qy(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=At[r.charCodeAt(c)]<<18|At[r.charCodeAt(c+1)]<<12|At[r.charCodeAt(c+2)]<<6|At[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=At[r.charCodeAt(c)]<<2|At[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=At[r.charCodeAt(c)]<<10|At[r.charCodeAt(c+1)]<<4|At[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Wy(r){return Xt[r>>18&63]+Xt[r>>12&63]+Xt[r>>6&63]+Xt[r&63]}function Gy(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),i.push(Wy(n));return i.join("")}function Hy(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(Gy(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(Xt[e>>2]+Xt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Xt[e>>10]+Xt[e>>4&63]+Xt[e<<2&63]+"=")),i.join("")}var Ky=4,Dp=0,Rp=1,Jy=2;function Ci(r){let e=r.length;for(;--e>=0;)r[e]=0}var Yy=0,Xd=1,Zy=2,Xy=3,ev=258,tl=29,Ga=256,La=Ga+1+tl,Si=30,rl=19,eh=2*La+1,xn=15,fu=16,tv=7,nl=256,th=16,rh=17,nh=18,Mu=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),us=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),rv=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),ih=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),nv=512,vr=new Array((La+2)*2);Ci(vr);var Aa=new Array(Si*2);Ci(Aa);var $a=new Array(nv);Ci($a);var Fa=new Array(ev-Xy+1);Ci(Fa);var il=new Array(tl);Ci(il);var As=new Array(Si);Ci(As);function pu(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}var ah,oh,sh;function du(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var ch=r=>r<256?$a[r]:$a[256+(r>>>7)],Ma=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},dt=(r,e,t)=>{r.bi_valid>fu-t?(r.bi_buf|=e<<r.bi_valid&65535,Ma(r,r.bi_buf),r.bi_buf=e>>fu-r.bi_valid,r.bi_valid+=t-fu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},er=(r,e,t)=>{dt(r,t[e*2],t[e*2+1])},uh=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},iv=r=>{r.bi_valid===16?(Ma(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},av=(r,e)=>{let t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,p,d,f,m,h=0;for(d=0;d<=xn;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<eh;u++)l=r.heap[u],d=t[t[l*2+1]*2+1]+1,d>c&&(d=c,h++),t[l*2+1]=d,!(l>n)&&(r.bl_count[d]++,f=0,l>=s&&(f=o[l-s]),m=t[l*2],r.opt_len+=m*(d+f),a&&(r.static_len+=m*(i[l*2+1]+f)));if(h!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,h-=2}while(h>0);for(d=c;d!==0;d--)for(l=r.bl_count[d];l!==0;)p=r.heap[--u],!(p>n)&&(t[p*2+1]!==d&&(r.opt_len+=(d-t[p*2+1])*t[p*2],t[p*2+1]=d),l--)}},lh=(r,e,t)=>{let n=new Array(xn+1),i=0,a,o;for(a=1;a<=xn;a++)i=i+t[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=uh(n[s]++,s))}},ov=()=>{let r,e,t,n,i,a=new Array(xn+1);for(t=0,n=0;n<tl-1;n++)for(il[n]=t,r=0;r<1<<Mu[n];r++)Fa[t++]=n;for(Fa[t-1]=n,i=0,n=0;n<16;n++)for(As[n]=i,r=0;r<1<<us[n];r++)$a[i++]=n;for(i>>=7;n<Si;n++)for(As[n]=i<<7,r=0;r<1<<us[n]-7;r++)$a[256+i++]=n;for(e=0;e<=xn;e++)a[e]=0;for(r=0;r<=143;)vr[r*2+1]=8,r++,a[8]++;for(;r<=255;)vr[r*2+1]=9,r++,a[9]++;for(;r<=279;)vr[r*2+1]=7,r++,a[7]++;for(;r<=287;)vr[r*2+1]=8,r++,a[8]++;for(lh(vr,La+1,a),r=0;r<Si;r++)Aa[r*2+1]=5,Aa[r*2]=uh(r,5);ah=new pu(vr,Mu,Ga+1,La,xn),oh=new pu(Aa,us,0,Si,xn),sh=new pu(new Array(0),rv,0,rl,tv)},fh=r=>{let e;for(e=0;e<La;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Si;e++)r.dyn_dtree[e*2]=0;for(e=0;e<rl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[nl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},ph=r=>{r.bi_valid>8?Ma(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Cp=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},hu=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&Cp(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!Cp(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Pp=(r,e,t)=>{let n,i,a=0,o,s;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+a++]&255,n+=(r.pending_buf[r.sym_buf+a++]&255)<<8,i=r.pending_buf[r.sym_buf+a++],n===0?er(r,i,e):(o=Fa[i],er(r,o+Ga+1,e),s=Mu[o],s!==0&&(i-=il[o],dt(r,i,s)),n--,o=ch(n),er(r,o,t),s=us[o],s!==0&&(n-=As[o],dt(r,n,s)));while(a<r.sym_next);er(r,nl,e)},ju=(r,e)=>{let t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=eh,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,i&&(r.static_len-=n[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)hu(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],hu(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[u*2]=t[o*2]+t[s*2],r.depth[u]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=u,r.heap[1]=u++,hu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],av(r,e),lh(t,c,r.bl_count)},Lp=(r,e,t)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,n=0;n<=t;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==i&&r.bl_tree[a*2]++,r.bl_tree[th*2]++):s<=10?r.bl_tree[rh*2]++:r.bl_tree[nh*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},$p=(r,e,t)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),n=0;n<=t;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do er(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(er(r,a,r.bl_tree),s--),er(r,th,r.bl_tree),dt(r,s-3,2)):s<=10?(er(r,rh,r.bl_tree),dt(r,s-3,3)):(er(r,nh,r.bl_tree),dt(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},sv=r=>{let e;for(Lp(r,r.dyn_ltree,r.l_desc.max_code),Lp(r,r.dyn_dtree,r.d_desc.max_code),ju(r,r.bl_desc),e=rl-1;e>=3&&r.bl_tree[ih[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},cv=(r,e,t,n)=>{let i;for(dt(r,e-257,5),dt(r,t-1,5),dt(r,n-4,4),i=0;i<n;i++)dt(r,r.bl_tree[ih[i]*2+1],3);$p(r,r.dyn_ltree,e-1),$p(r,r.dyn_dtree,t-1)},uv=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Dp;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Rp;for(t=32;t<Ga;t++)if(r.dyn_ltree[t*2]!==0)return Rp;return Dp},Fp=!1,lv=r=>{Fp||(ov(),Fp=!0),r.l_desc=new du(r.dyn_ltree,ah),r.d_desc=new du(r.dyn_dtree,oh),r.bl_desc=new du(r.bl_tree,sh),r.bi_buf=0,r.bi_valid=0,fh(r)},dh=(r,e,t,n)=>{dt(r,(Yy<<1)+(n?1:0),3),ph(r),Ma(r,t),Ma(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},fv=r=>{dt(r,Xd<<1,3),er(r,nl,vr),iv(r)},pv=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===Jy&&(r.strm.data_type=uv(r)),ju(r,r.l_desc),ju(r,r.d_desc),o=sv(r),i=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=i&&(i=a)):i=a=t+5,t+4<=i&&e!==-1?dh(r,e,t,n):r.strategy===Ky||a===i?(dt(r,(Xd<<1)+(n?1:0),3),Pp(r,vr,Aa)):(dt(r,(Zy<<1)+(n?1:0),3),cv(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Pp(r,r.dyn_ltree,r.dyn_dtree)),fh(r),n&&ph(r)},dv=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(Fa[t]+Ga+1)*2]++,r.dyn_dtree[ch(e)*2]++),r.sym_next===r.sym_end),hv=lv,mv=dh,gv=pv,yv=dv,vv=fv,bv={_tr_init:hv,_tr_stored_block:mv,_tr_flush_block:gv,_tr_tally:yv,_tr_align:vv},Sv=(r,e,t,n)=>{let i=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},ja=Sv,wv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},_v=new Uint32Array(wv()),Ev=(r,e,t,n)=>{let i=_v,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},Be=Ev,Cn={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"},Bn={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:xv,_tr_stored_block:Uu,_tr_flush_block:Iv,_tr_tally:Qr,_tr_align:kv}=bv,{Z_NO_FLUSH:zr,Z_PARTIAL_FLUSH:Tv,Z_FULL_FLUSH:Av,Z_FINISH:Nt,Z_BLOCK:Mp,Z_OK:Ke,Z_STREAM_END:jp,Z_STREAM_ERROR:nr,Z_DATA_ERROR:Ov,Z_BUF_ERROR:mu,Z_DEFAULT_COMPRESSION:Nv,Z_FILTERED:Dv,Z_HUFFMAN_ONLY:Wo,Z_RLE:Rv,Z_FIXED:Cv,Z_DEFAULT_STRATEGY:Pv,Z_UNKNOWN:Lv,Z_DEFLATED:Vs}=Bn,$v=9,Fv=15,Mv=8,jv=29,Uv=256,qu=Uv+1+jv,qv=30,Bv=19,Vv=2*qu+1,Qv=15,ne=3,jr=258,ir=jr+ne+1,zv=32,Ii=42,al=57,Bu=69,Vu=73,Qu=91,zu=103,In=113,wa=666,at=1,Pi=2,Pn=3,Li=4,Wv=3,kn=(r,e)=>(r.msg=Cn[e],e),Up=r=>r*2-(r>4?9:0),Mr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Gv=r=>{let e,t,n,i=r.w_size;e=r.hash_size,n=e;do t=r.head[--n],r.head[n]=t>=i?t-i:0;while(--e);e=i,n=e;do t=r.prev[--n],r.prev[n]=t>=i?t-i:0;while(--e)},Hv=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,Wr=Hv,yt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},bt=(r,e)=>{Iv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,yt(r.strm)},pe=(r,e)=>{r.pending_buf[r.pending++]=e},oa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Wu=(r,e,t,n)=>{let i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,e.set(r.input.subarray(r.next_in,r.next_in+i),t),r.state.wrap===1?r.adler=ja(r.adler,e,i,t):r.state.wrap===2&&(r.adler=Be(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},hh=(r,e)=>{let t=r.max_chain_length,n=r.strstart,i,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-ir?r.strstart-(r.w_size-ir):0,u=r.window,l=r.w_mask,p=r.prev,d=r.strstart+jr,f=u[n+o-1],m=u[n+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(i=e,!(u[i+o]!==m||u[i+o-1]!==f||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&n<d);if(a=jr-(d-n),n=d-jr,a>o){if(r.match_start=e,o=a,a>=s)break;f=u[n+o-1],m=u[n+o]}}while((e=p[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},ki=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-ir)&&(r.window.set(r.window.subarray(e,e+e-n),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Gv(r),n+=e),r.strm.avail_in===0)break;if(t=Wu(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=ne)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=Wr(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=Wr(r,r.ins_h,r.window[i+ne-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert<ne)););}while(r.lookahead<ir&&r.strm.avail_in!==0)},mh=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,i,a,o=0,s=r.strm.avail_in;do{if(n=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,i=r.strstart-r.block_start,n>i+r.strm.avail_in&&(n=i+r.strm.avail_in),n>a&&(n=a),n<t&&(n===0&&e!==Nt||e===zr||n!==i+r.strm.avail_in)))break;o=e===Nt&&n===i+r.strm.avail_in?1:0,Uu(r,0,0,o),r.pending_buf[r.pending-4]=n,r.pending_buf[r.pending-3]=n>>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,yt(r.strm),i&&(i>n&&(i=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+i),r.strm.next_out),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i,r.block_start+=i,n-=i),n&&(Wu(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?Li:e!==zr&&e!==Nt&&r.strm.avail_in===0&&r.strstart===r.block_start?Pi:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Wu(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,i=r.strstart-r.block_start,(i>=t||(i||e===Nt)&&e!==zr&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Nt&&r.strm.avail_in===0&&n===i?1:0,Uu(r,r.block_start,n,o),r.block_start+=n,yt(r.strm)),o?Pn:at)},gu=(r,e)=>{let t,n;for(;;){if(r.lookahead<ir){if(ki(r),r.lookahead<ir&&e===zr)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=ne&&(r.ins_h=Wr(r,r.ins_h,r.window[r.strstart+ne-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-ir&&(r.match_length=hh(r,t)),r.match_length>=ne)if(n=Qr(r,r.strstart-r.match_start,r.match_length-ne),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ne){r.match_length--;do r.strstart++,r.ins_h=Wr(r,r.ins_h,r.window[r.strstart+ne-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Wr(r,r.ins_h,r.window[r.strstart+1]);else n=Qr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=r.strstart<ne-1?r.strstart:ne-1,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Li):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Pi},di=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<ir){if(ki(r),r.lookahead<ir&&e===zr)return at;if(r.lookahead===0)break}if(t=0,r.lookahead>=ne&&(r.ins_h=Wr(r,r.ins_h,r.window[r.strstart+ne-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ne-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-ir&&(r.match_length=hh(r,t),r.match_length<=5&&(r.strategy===Dv||r.match_length===ne&&r.strstart-r.match_start>4096)&&(r.match_length=ne-1)),r.prev_length>=ne&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-ne,n=Qr(r,r.strstart-1-r.prev_match,r.prev_length-ne),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=Wr(r,r.ins_h,r.window[r.strstart+ne-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ne-1,r.strstart++,n&&(bt(r,!1),r.strm.avail_out===0))return at}else if(r.match_available){if(n=Qr(r,0,r.window[r.strstart-1]),n&&bt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return at}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Qr(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ne-1?r.strstart:ne-1,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Li):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Pi},Kv=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=jr){if(ki(r),r.lookahead<=jr&&e===zr)return at;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ne&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+jr;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);r.match_length=jr-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ne?(t=Qr(r,1,r.match_length-ne),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Qr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Li):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Pi},Jv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(ki(r),r.lookahead===0)){if(e===zr)return at;break}if(r.match_length=0,t=Qr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(bt(r,!1),r.strm.avail_out===0))return at}return r.insert=0,e===Nt?(bt(r,!0),r.strm.avail_out===0?Pn:Li):r.sym_next&&(bt(r,!1),r.strm.avail_out===0)?at:Pi};function Ht(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}var _a=[new Ht(0,0,0,0,mh),new Ht(4,4,8,4,gu),new Ht(4,5,16,8,gu),new Ht(4,6,32,32,gu),new Ht(4,4,16,16,di),new Ht(8,16,32,32,di),new Ht(8,16,128,128,di),new Ht(8,32,128,256,di),new Ht(32,128,258,1024,di),new Ht(32,258,258,4096,di)],Yv=r=>{r.window_size=2*r.w_size,Mr(r.head),r.max_lazy_match=_a[r.level].max_lazy,r.good_match=_a[r.level].good_length,r.nice_match=_a[r.level].nice_length,r.max_chain_length=_a[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ne-1,r.match_available=0,r.ins_h=0};function Zv(){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=Vs,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(Vv*2),this.dyn_dtree=new Uint16Array((2*qv+1)*2),this.bl_tree=new Uint16Array((2*Bv+1)*2),Mr(this.dyn_ltree),Mr(this.dyn_dtree),Mr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Qv+1),this.heap=new Uint16Array(2*qu+1),Mr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*qu+1),Mr(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 Ha=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Ii&&e.status!==al&&e.status!==Bu&&e.status!==Vu&&e.status!==Qu&&e.status!==zu&&e.status!==In&&e.status!==wa?1:0},gh=r=>{if(Ha(r))return kn(r,nr);r.total_in=r.total_out=0,r.data_type=Lv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?al:e.wrap?Ii:In,r.adler=e.wrap===2?0:1,e.last_flush=-2,xv(e),Ke},yh=r=>{let e=gh(r);return e===Ke&&Yv(r.state),e},Xv=(r,e)=>Ha(r)||r.state.wrap!==2?nr:(r.state.gzhead=e,Ke),vh=(r,e,t,n,i,a)=>{if(!r)return nr;let o=1;if(e===Nv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>$v||t!==Vs||n<8||n>15||e<0||e>9||a<0||a>Cv||n===8&&o!==1)return kn(r,nr);n===8&&(n=9);let s=new Zv;return r.state=s,s.strm=r,s.status=Ii,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ne-1)/ne),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,yh(r)},eb=(r,e)=>vh(r,e,Vs,Fv,Mv,Pv),tb=(r,e)=>{if(Ha(r)||e>Mp||e<0)return r?kn(r,nr):nr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===wa&&e!==Nt)return kn(r,r.avail_out===0?mu:nr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(yt(r),r.avail_out===0)return t.last_flush=-1,Ke}else if(r.avail_in===0&&Up(e)<=Up(n)&&e!==Nt)return kn(r,mu);if(t.status===wa&&r.avail_in!==0)return kn(r,mu);if(t.status===Ii&&t.wrap===0&&(t.status=In),t.status===Ii){let i=Vs+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Wo||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=zv),i+=31-i%31,oa(t,i),t.strstart!==0&&(oa(t,r.adler>>>16),oa(t,r.adler&65535)),r.adler=1,t.status=In,yt(r),t.pending!==0)return t.last_flush=-1,Ke}if(t.status===al){if(r.adler=0,pe(t,31),pe(t,139),pe(t,8),t.gzhead)pe(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)),pe(t,t.gzhead.time&255),pe(t,t.gzhead.time>>8&255),pe(t,t.gzhead.time>>16&255),pe(t,t.gzhead.time>>24&255),pe(t,t.level===9?2:t.strategy>=Wo||t.level<2?4:0),pe(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(pe(t,t.gzhead.extra.length&255),pe(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Be(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Bu;else if(pe(t,0),pe(t,0),pe(t,0),pe(t,0),pe(t,0),pe(t,t.level===9?2:t.strategy>=Wo||t.level<2?4:0),pe(t,Wv),t.status=In,yt(r),t.pending!==0)return t.last_flush=-1,Ke}if(t.status===Bu){if(t.gzhead.extra){let i=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,yt(r),t.pending!==0)return t.last_flush=-1,Ke;i=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Vu}if(t.status===Vu){if(t.gzhead.name){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),yt(r),t.pending!==0)return t.last_flush=-1,Ke;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,pe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Qu}if(t.status===Qu){if(t.gzhead.comment){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i)),yt(r),t.pending!==0)return t.last_flush=-1,Ke;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,pe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Be(r.adler,t.pending_buf,t.pending-i,i))}t.status=zu}if(t.status===zu){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(yt(r),t.pending!==0))return t.last_flush=-1,Ke;pe(t,r.adler&255),pe(t,r.adler>>8&255),r.adler=0}if(t.status=In,yt(r),t.pending!==0)return t.last_flush=-1,Ke}if(r.avail_in!==0||t.lookahead!==0||e!==zr&&t.status!==wa){let i=t.level===0?mh(t,e):t.strategy===Wo?Jv(t,e):t.strategy===Rv?Kv(t,e):_a[t.level].func(t,e);if((i===Pn||i===Li)&&(t.status=wa),i===at||i===Pn)return r.avail_out===0&&(t.last_flush=-1),Ke;if(i===Pi&&(e===Tv?kv(t):e!==Mp&&(Uu(t,0,0,!1),e===Av&&(Mr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),yt(r),r.avail_out===0))return t.last_flush=-1,Ke}return e!==Nt?Ke:t.wrap<=0?jp:(t.wrap===2?(pe(t,r.adler&255),pe(t,r.adler>>8&255),pe(t,r.adler>>16&255),pe(t,r.adler>>24&255),pe(t,r.total_in&255),pe(t,r.total_in>>8&255),pe(t,r.total_in>>16&255),pe(t,r.total_in>>24&255)):(oa(t,r.adler>>>16),oa(t,r.adler&65535)),yt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Ke:jp)},rb=r=>{if(Ha(r))return nr;let e=r.state.status;return r.state=null,e===In?kn(r,Ov):Ke},nb=(r,e)=>{let t=e.length;if(Ha(r))return nr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==Ii||n.lookahead)return nr;if(i===1&&(r.adler=ja(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Mr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(t-n.w_size,t),0),e=c,t=n.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,ki(n);n.lookahead>=ne;){let c=n.strstart,u=n.lookahead-(ne-1);do n.ins_h=Wr(n,n.ins_h,n.window[c+ne-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--u);n.strstart=c,n.lookahead=ne-1,ki(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ne-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,Ke},ib=eb,ab=vh,ob=yh,sb=gh,cb=Xv,ub=tb,lb=rb,fb=nb,pb="pako deflate (from Nodeca project)",Oa={deflateInit:ib,deflateInit2:ab,deflateReset:ob,deflateResetKeep:sb,deflateSetHeader:cb,deflate:ub,deflateEnd:lb,deflateSetDictionary:fb,deflateInfo:pb},db=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),hb=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let n in t)db(t,n)&&(r[n]=t[n])}}return r},mb=r=>{let e=0;for(let n=0,i=r.length;n<i;n++)e+=r[n].length;let t=new Uint8Array(e);for(let n=0,i=0,a=r.length;n<a;n++){let o=r[n];t.set(o,i),i+=o.length}return t},Qs={assign:hb,flattenChunks:mb},bh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){bh=!1}var Ua=new Uint8Array(256);for(let r=0;r<256;r++)Ua[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Ua[254]=Ua[254]=1;var gb=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,n,i,a,o=r.length,s=0;for(i=0;i<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),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},yb=(r,e)=>{if(e<65534&&r.subarray&&bh)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(r[n]);return t},vb=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let n,i,a=new Array(t*2);for(i=0,n=0;n<t;){let o=r[n++];if(o<128){a[i++]=o;continue}let s=Ua[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<t;)o=o<<6|r[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return yb(a,i)},bb=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+Ua[r[t]]>e?t:e},qa={string2buf:gb,buf2string:vb,utf8border:bb};function Sb(){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 Sh=Sb,wh=Object.prototype.toString,{Z_NO_FLUSH:wb,Z_SYNC_FLUSH:_b,Z_FULL_FLUSH:Eb,Z_FINISH:xb,Z_OK:Os,Z_STREAM_END:Ib,Z_DEFAULT_COMPRESSION:kb,Z_DEFAULT_STRATEGY:Tb,Z_DEFLATED:Ab}=Bn;function Ka(r){this.options=Qs.assign({level:kb,method:Ab,chunkSize:16384,windowBits:15,memLevel:8,strategy:Tb},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Sh,this.strm.avail_out=0;let t=Oa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Os)throw new Error(Cn[t]);if(e.header&&Oa.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=qa.string2buf(e.dictionary):wh.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=Oa.deflateSetDictionary(this.strm,n),t!==Os)throw new Error(Cn[t]);this._dict_set=!0}}Ka.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?xb:wb,typeof r=="string"?t.input=qa.string2buf(r):wh.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),(a===_b||a===Eb)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=Oa.deflate(t,a),i===Ib)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Oa.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Os;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};Ka.prototype.onData=function(r){this.chunks.push(r)};Ka.prototype.onEnd=function(r){r===Os&&(this.result=Qs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ol(r,e){let t=new Ka(e);if(t.push(r,!0),t.err)throw t.msg||Cn[t.err];return t.result}function Ob(r,e){return e=e||{},e.raw=!0,ol(r,e)}function Nb(r,e){return e=e||{},e.gzip=!0,ol(r,e)}var Db=Ka,Rb=ol,Cb=Ob,Pb=Nb,Lb=Bn,$b={Deflate:Db,deflate:Rb,deflateRaw:Cb,gzip:Pb,constants:Lb},Go=16209,Fb=16191,Mb=function r(e,t){let n,i,a,o,s,c,u,l,p,d,f,m,h,g,b,v,S,y,k,N,T,C,$,P,M=e.state;n=e.next_in,$=e.input,i=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,p=M.wnext,d=M.window,f=M.hold,m=M.bits,h=M.lencode,g=M.distcode,b=(1<<M.lenbits)-1,v=(1<<M.distbits)-1;e:do{m<15&&(f+=$[n++]<<m,m+=8,f+=$[n++]<<m,m+=8),S=h[f&b];t:for(;;){if(y=S>>>24,f>>>=y,m-=y,y=S>>>16&255,y===0)P[a++]=S&65535;else if(y&16){k=S&65535,y&=15,y&&(m<y&&(f+=$[n++]<<m,m+=8),k+=f&(1<<y)-1,f>>>=y,m-=y),m<15&&(f+=$[n++]<<m,m+=8,f+=$[n++]<<m,m+=8),S=g[f&v];r:for(;;){if(y=S>>>24,f>>>=y,m-=y,y=S>>>16&255,y&16){if(N=S&65535,y&=15,m<y&&(f+=$[n++]<<m,m+=8,m<y&&(f+=$[n++]<<m,m+=8)),N+=f&(1<<y)-1,N>c){e.msg="invalid distance too far back",M.mode=Go;break e}if(f>>>=y,m-=y,y=a-o,N>y){if(y=N-y,y>l&&M.sane){e.msg="invalid distance too far back",M.mode=Go;break e}if(T=0,C=d,p===0){if(T+=u-y,y<k){k-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}}else if(p<y){if(T+=u+p-y,y-=p,y<k){k-=y;do P[a++]=d[T++];while(--y);if(T=0,p<k){y=p,k-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}}}else if(T+=p-y,y<k){k-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}for(;k>2;)P[a++]=C[T++],P[a++]=C[T++],P[a++]=C[T++],k-=3;k&&(P[a++]=C[T++],k>1&&(P[a++]=C[T++]))}else{T=a-N;do P[a++]=P[T++],P[a++]=P[T++],P[a++]=P[T++],k-=3;while(k>2);k&&(P[a++]=P[T++],k>1&&(P[a++]=P[T++]))}}else if((y&64)===0){S=g[(S&65535)+(f&(1<<y)-1)];continue r}else{e.msg="invalid distance code",M.mode=Go;break e}break}}else if((y&64)===0){S=h[(S&65535)+(f&(1<<y)-1)];continue t}else if(y&32){M.mode=Fb;break e}else{e.msg="invalid literal/length code",M.mode=Go;break e}break}}while(n<i&&a<s);k=m>>3,n-=k,m-=k<<3,f&=(1<<m)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),M.hold=f,M.bits=m},hi=15,qp=852,Bp=592,Vp=0,yu=1,Qp=2,jb=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]),Ub=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]),qb=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]),Bb=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]),Vb=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,p=0,d=0,f=0,m=0,h=0,g=0,b=0,v=0,S,y,k,N,T,C=null,$,P=new Uint16Array(hi+1),M=new Uint16Array(hi+1),we=null,ke,I,ge;for(u=0;u<=hi;u++)P[u]=0;for(l=0;l<n;l++)P[e[t+l]]++;for(f=c,d=hi;d>=1&&P[d]===0;d--);if(f>d&&(f=d),d===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(p=1;p<d&&P[p]===0;p++);for(f<p&&(f=p),g=1,u=1;u<=hi;u++)if(g<<=1,g-=P[u],g<0)return-1;if(g>0&&(r===Vp||d!==1))return-1;for(M[1]=0,u=1;u<hi;u++)M[u+1]=M[u]+P[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[M[e[t+l]]++]=l);if(r===Vp?(C=we=o,$=20):r===yu?(C=jb,we=Ub,$=257):(C=qb,we=Bb,$=0),v=0,l=0,u=p,T=a,m=f,h=0,k=-1,b=1<<f,N=b-1,r===yu&&b>qp||r===Qp&&b>Bp)return 1;for(;;){ke=u-h,o[l]+1<$?(I=0,ge=o[l]):o[l]>=$?(I=we[o[l]-$],ge=C[o[l]-$]):(I=32+64,ge=0),S=1<<u-h,y=1<<m,p=y;do y-=S,i[T+(v>>h)+y]=ke<<24|I<<16|ge|0;while(y!==0);for(S=1<<u-1;v&S;)S>>=1;if(S!==0?(v&=S-1,v+=S):v=0,l++,--P[u]===0){if(u===d)break;u=e[t+o[l]]}if(u>f&&(v&N)!==k){for(h===0&&(h=f),T+=p,m=u-h,g=1<<m;m+h<d&&(g-=P[m+h],!(g<=0));)m++,g<<=1;if(b+=1<<m,r===yu&&b>qp||r===Qp&&b>Bp)return 1;k=v&N,i[k]=f<<24|m<<16|T-a|0}}return v!==0&&(i[T+v]=u-h<<24|64<<16|0),s.bits=f,0},Na=Vb,Qb=0,_h=1,Eh=2,{Z_FINISH:zp,Z_BLOCK:zb,Z_TREES:Ho,Z_OK:Ln,Z_STREAM_END:Wb,Z_NEED_DICT:Gb,Z_STREAM_ERROR:Dt,Z_DATA_ERROR:xh,Z_MEM_ERROR:Ih,Z_BUF_ERROR:Hb,Z_DEFLATED:Wp}=Bn,zs=16180,Gp=16181,Hp=16182,Kp=16183,Jp=16184,Yp=16185,Zp=16186,Xp=16187,ed=16188,td=16189,Ns=16190,hr=16191,vu=16192,rd=16193,bu=16194,nd=16195,id=16196,ad=16197,od=16198,Ko=16199,Jo=16200,sd=16201,cd=16202,ud=16203,ld=16204,fd=16205,Su=16206,pd=16207,dd=16208,xe=16209,kh=16210,Th=16211,Kb=852,Jb=592,Yb=15,Zb=Yb,hd=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Xb(){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 Vn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<zs||e.mode>Th?1:0},Ah=r=>{if(Vn(r))return Dt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=zs,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(Kb),e.distcode=e.distdyn=new Int32Array(Jb),e.sane=1,e.back=-1,Ln},Oh=r=>{if(Vn(r))return Dt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Ah(r)},Nh=(r,e)=>{let t;if(Vn(r))return Dt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Dt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Oh(r))},Dh=(r,e)=>{if(!r)return Dt;let t=new Xb;r.state=t,t.strm=r,t.window=null,t.mode=zs;let n=Nh(r,e);return n!==Ln&&(r.state=null),n},eS=r=>Dh(r,Zb),md=!0,wu,_u,tS=r=>{if(md){wu=new Int32Array(512),_u=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(Na(_h,r.lens,0,288,wu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Na(Eh,r.lens,0,32,_u,0,r.work,{bits:5}),md=!1}r.lencode=wu,r.lenbits=9,r.distcode=_u,r.distbits=5},Rh=(r,e,t,n)=>{let i,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(t-n,t-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(t-n,t),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},rS=(r,e)=>{let t,n,i,a,o,s,c,u,l,p,d,f,m,h,g=0,b,v,S,y,k,N,T,C,$=new Uint8Array(4),P,M,we=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Vn(r)||!r.output||!r.input&&r.avail_in!==0)return Dt;t=r.state,t.mode===hr&&(t.mode=vu),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,p=s,d=c,C=Ln;e:for(;;)switch(t.mode){case zs:if(t.wrap===0){t.mode=vu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,$[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0),u=0,l=0,t.mode=Gp;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=xe;break}if((u&15)!==Wp){r.msg="unknown compression method",t.mode=xe;break}if(u>>>=4,l-=4,T=(u&15)+8,t.wbits===0&&(t.wbits=T),T>15||T>t.wbits){r.msg="invalid window size",t.mode=xe;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?td:hr,u=0,l=0;break;case Gp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Wp){r.msg="unknown compression method",t.mode=xe;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=xe;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0,t.mode=Hp;case Hp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,$[2]=u>>>16&255,$[3]=u>>>24&255,t.check=Be(t.check,$,4,0)),u=0,l=0,t.mode=Kp;case Kp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0,t.mode=Jp;case Jp:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Be(t.check,$,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=Yp;case Yp:if(t.flags&1024&&(f=t.length,f>s&&(f=s),f&&(t.head&&(T=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(a,a+f),T)),t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,t.length-=f),t.length))break e;t.length=0,t.mode=Zp;case Zp:if(t.flags&2048){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.name+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Xp;case Xp:if(t.flags&4096){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.comment+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Be(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.comment=null);t.mode=ed;case ed:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=xe;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=hr;break;case td:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=hd(u),u=0,l=0,t.mode=Ns;case Ns:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,Gb;r.adler=t.check=1,t.mode=hr;case hr:if(e===zb||e===Ho)break e;case vu:if(t.last){u>>>=l&7,l-=l&7,t.mode=Su;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=rd;break;case 1:if(tS(t),t.mode=Ko,e===Ho){u>>>=2,l-=2;break e}break;case 2:t.mode=id;break;case 3:r.msg="invalid block type",t.mode=xe}u>>>=2,l-=2;break;case rd:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=xe;break}if(t.length=u&65535,u=0,l=0,t.mode=bu,e===Ho)break e;case bu:t.mode=nd;case nd:if(f=t.length,f){if(f>s&&(f=s),f>c&&(f=c),f===0)break e;i.set(n.subarray(a,a+f),o),s-=f,a+=f,c-=f,o+=f,t.length-=f;break}t.mode=hr;break;case id:for(;l<14;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=xe;break}t.have=0,t.mode=ad;case ad:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.lens[we[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[we[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},C=Na(Qb,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid code lengths set",t.mode=xe;break}t.have=0,t.mode=od;case od:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[u&(1<<t.lenbits)-1],b=g>>>24,v=g>>>16&255,S=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S<16)u>>>=b,l-=b,t.lens[t.have++]=S;else{if(S===16){for(M=b+2;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=b,l-=b,t.have===0){r.msg="invalid bit length repeat",t.mode=xe;break}T=t.lens[t.have-1],f=3+(u&3),u>>>=2,l-=2}else if(S===17){for(M=b+3;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,T=0,f=3+(u&7),u>>>=3,l-=3}else{for(M=b+7;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,T=0,f=11+(u&127),u>>>=7,l-=7}if(t.have+f>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=xe;break}for(;f--;)t.lens[t.have++]=T}}if(t.mode===xe)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=xe;break}if(t.lenbits=9,P={bits:t.lenbits},C=Na(_h,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid literal/lengths set",t.mode=xe;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},C=Na(Eh,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,C){r.msg="invalid distances set",t.mode=xe;break}if(t.mode=Ko,e===Ho)break e;case Ko:t.mode=Jo;case Jo:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,Mb(r,d),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===hr&&(t.back=-1);break}for(t.back=0;g=t.lencode[u&(1<<t.lenbits)-1],b=g>>>24,v=g>>>16&255,S=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(v&&(v&240)===0){for(y=b,k=v,N=S;g=t.lencode[N+((u&(1<<y+k)-1)>>y)],b=g>>>24,v=g>>>16&255,S=g&65535,!(y+b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=b,l-=b,t.back+=b,t.length=S,v===0){t.mode=fd;break}if(v&32){t.back=-1,t.mode=hr;break}if(v&64){r.msg="invalid literal/length code",t.mode=xe;break}t.extra=v&15,t.mode=sd;case sd:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=cd;case cd:for(;g=t.distcode[u&(1<<t.distbits)-1],b=g>>>24,v=g>>>16&255,S=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((v&240)===0){for(y=b,k=v,N=S;g=t.distcode[N+((u&(1<<y+k)-1)>>y)],b=g>>>24,v=g>>>16&255,S=g&65535,!(y+b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=b,l-=b,t.back+=b,v&64){r.msg="invalid distance code",t.mode=xe;break}t.offset=S,t.extra=v&15,t.mode=ud;case ud:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=xe;break}t.mode=ld;case ld:if(c===0)break e;if(f=d-c,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=xe;break}f>t.wnext?(f-=t.wnext,m=t.wsize-f):m=t.wnext-f,f>t.length&&(f=t.length),h=t.window}else h=i,m=o-t.offset,f=t.length;f>c&&(f=c),c-=f,t.length-=f;do i[o++]=h[m++];while(--f);t.length===0&&(t.mode=Jo);break;case fd:if(c===0)break e;i[o++]=t.length,c--,t.mode=Jo;break;case Su:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Be(t.check,i,d,o-d):ja(t.check,i,d,o-d)),d=c,t.wrap&4&&(t.flags?u:hd(u))!==t.check){r.msg="incorrect data check",t.mode=xe;break}u=0,l=0}t.mode=pd;case pd:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=xe;break}u=0,l=0}t.mode=dd;case dd:C=Wb;break e;case xe:C=xh;break e;case kh:return Ih;case Th:default:return Dt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||d!==r.avail_out&&t.mode<xe&&(t.mode<Su||e!==zp))&&Rh(r,r.output,r.next_out,d-r.avail_out),p-=r.avail_in,d-=r.avail_out,r.total_in+=p,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Be(t.check,i,d,r.next_out-d):ja(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===hr?128:0)+(t.mode===Ko||t.mode===bu?256:0),(p===0&&d===0||e===zp)&&C===Ln&&(C=Hb),C},nS=r=>{if(Vn(r))return Dt;let e=r.state;return e.window&&(e.window=null),r.state=null,Ln},iS=(r,e)=>{if(Vn(r))return Dt;let t=r.state;return(t.wrap&2)===0?Dt:(t.head=e,e.done=!1,Ln)},aS=(r,e)=>{let t=e.length,n,i,a;return Vn(r)||(n=r.state,n.wrap!==0&&n.mode!==Ns)?Dt:n.mode===Ns&&(i=1,i=ja(i,e,t,0),i!==n.check)?xh:(a=Rh(r,e,t,t),a?(n.mode=kh,Ih):(n.havedict=1,Ln))},oS=Oh,sS=Nh,cS=Ah,uS=eS,lS=Dh,fS=rS,pS=nS,dS=iS,hS=aS,mS="pako inflate (from Nodeca project)",br={inflateReset:oS,inflateReset2:sS,inflateResetKeep:cS,inflateInit:uS,inflateInit2:lS,inflate:fS,inflateEnd:pS,inflateGetHeader:dS,inflateSetDictionary:hS,inflateInfo:mS};function gS(){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 yS=gS,Ch=Object.prototype.toString,{Z_NO_FLUSH:vS,Z_FINISH:bS,Z_OK:Ba,Z_STREAM_END:Eu,Z_NEED_DICT:xu,Z_STREAM_ERROR:SS,Z_DATA_ERROR:gd,Z_MEM_ERROR:wS}=Bn;function Ja(r){this.options=Qs.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Sh,this.strm.avail_out=0;let t=br.inflateInit2(this.strm,e.windowBits);if(t!==Ba)throw new Error(Cn[t]);if(this.header=new yS,br.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=qa.string2buf(e.dictionary):Ch.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=br.inflateSetDictionary(this.strm,e.dictionary),t!==Ba)))throw new Error(Cn[t])}Ja.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?bS:vS,Ch.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(n),t.next_out=0,t.avail_out=n),a=br.inflate(t,o),a===xu&&i&&(a=br.inflateSetDictionary(t,i),a===Ba?a=br.inflate(t,o):a===gd&&(a=xu));t.avail_in>0&&a===Eu&&t.state.wrap>0&&r[t.next_in]!==0;)br.inflateReset(t),a=br.inflate(t,o);switch(a){case SS:case gd:case xu:case wS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Eu))if(this.options.to==="string"){let c=qa.utf8border(t.output,t.next_out),u=t.next_out-c,l=qa.buf2string(t.output,c);t.next_out=u,t.avail_out=n-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===Ba&&s===0)){if(a===Eu)return a=br.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Ja.prototype.onData=function(r){this.chunks.push(r)};Ja.prototype.onEnd=function(r){r===Ba&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Qs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function sl(r,e){let t=new Ja(e);if(t.push(r),t.err)throw t.msg||Cn[t.err];return t.result}function _S(r,e){return e=e||{},e.raw=!0,sl(r,e)}var ES=Ja,xS=sl,IS=_S,kS=sl,TS=Bn,AS={Inflate:ES,inflate:xS,inflateRaw:IS,ungzip:kS,constants:TS},{Deflate:OS,deflate:NS,deflateRaw:DS,gzip:RS}=$b,{Inflate:CS,inflate:PS,inflateRaw:LS,ungzip:$S}=AS,FS=OS,MS=NS,jS=DS,US=RS,qS=CS,BS=PS,VS=LS,QS=$S,zS=Bn,WS={Deflate:FS,deflate:MS,deflateRaw:jS,gzip:US,Inflate:qS,inflate:BS,inflateRaw:VS,ungzip:QS,constants:zS},be=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Se=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ds=class{constructor(e,t){this.input=e,this.output=t}};be([w(),Se("design:type",String)],Ds.prototype,"input",void 0);be([w(),Se("design:type",String)],Ds.prototype,"output",void 0);Ds=be([Qe(),Se("design:paramtypes",[String,String])],Ds);var Rs=class{constructor(e,t){this.input=e,this.output=t}};be([w(),Se("design:type",String)],Rs.prototype,"input",void 0);be([w(),Se("design:type",String)],Rs.prototype,"output",void 0);Rs=be([z(),Se("design:paramtypes",[String,String])],Rs);var Jr=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};be([w(),Se("design:type",String)],Jr.prototype,"name",void 0);be([w(),Se("design:type",String)],Jr.prototype,"modelId",void 0);be([w(),Se("design:type",String)],Jr.prototype,"systemPrompt",void 0);be([w(),Se("design:type",Array)],Jr.prototype,"promptExamples",void 0);be([w(),Se("design:type",String)],Jr.prototype,"metaData",void 0);Jr=be([Qe(),Se("design:paramtypes",[String,String,String,Array,String])],Jr);var sr=class{constructor(e,t,n,i,a,o,s,c){this.name=e,this.modelId=t,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};be([w(),Se("design:type",String)],sr.prototype,"name",void 0);be([w(),Se("design:type",String)],sr.prototype,"modelId",void 0);be([w(),Se("design:type",String)],sr.prototype,"taskId",void 0);be([w(),Se("design:type",String)],sr.prototype,"systemPrompt",void 0);be([w(),Se("design:type",Array)],sr.prototype,"promptExamples",void 0);be([w(),Se("design:type",String)],sr.prototype,"metaData",void 0);be([w(),Se("design:type",String)],sr.prototype,"createdAt",void 0);be([w(),Se("design:type",String)],sr.prototype,"updatedAt",void 0);sr=be([z(),Se("design:paramtypes",[String,String,String,String,Array,String,String,String])],sr);var $n=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};be([w(),Se("design:type",String)],$n.prototype,"model",void 0);be([w(),Se("design:type",String)],$n.prototype,"status",void 0);be([w(),Se("design:type",Number)],$n.prototype,"progress",void 0);be([w(),Se("design:type",Boolean)],$n.prototype,"downloaded",void 0);be([w(),Se("design:type",Boolean)],$n.prototype,"loaded",void 0);$n=be([z(),Se("design:paramtypes",[String,String,Number,Boolean,Boolean])],$n);var GS=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Ue=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Me,ls,Gu=class{constructor(e,t=!0){Me.set(this,void 0),ls.set(this,new Map),GS(this,Me,e,"f")}async getModels(){let e=await Ue(this,Me,"f").query({query:x`
|
|
793
793
|
query {
|
|
794
794
|
aiGetModels {
|
|
795
795
|
id
|
|
@@ -869,7 +869,7 @@ triggerMatch
|
|
|
869
869
|
updatedAt
|
|
870
870
|
}
|
|
871
871
|
}
|
|
872
|
-
`}));return e}async addTask(e,t,n,i,a){let o=new
|
|
872
|
+
`}));return e}async addTask(e,t,n,i,a){let o=new Jr(e,t,n,i,a),{aiAddTask:s}=A(await Ue(this,Me,"f").mutate({mutation:x`
|
|
873
873
|
mutation AiAddTask($task: AITaskInput!) {
|
|
874
874
|
aiAddTask(task: $task) {
|
|
875
875
|
name
|
|
@@ -935,21 +935,21 @@ triggerMatch
|
|
|
935
935
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
936
936
|
aiEmbed(modelId: $modelId, text: $text)
|
|
937
937
|
}
|
|
938
|
-
`,variables:{modelId:e,text:t}})),i=
|
|
938
|
+
`,variables:{modelId:e,text:t}})),i=Bs.toByteArray(n);return JSON.parse(WS.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=A(await Ue(this,Me,"f").mutate({mutation:x`
|
|
939
939
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
940
940
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
941
941
|
}
|
|
942
942
|
`,variables:{modelId:e,params:n}})),a=Ue(this,Me,"f").subscribe({query:x` subscription {
|
|
943
943
|
aiTranscriptionText(streamId: "${i}")
|
|
944
|
-
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Ue(this,
|
|
944
|
+
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Ue(this,ls,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=A(await Ue(this,Me,"f").mutate({mutation:x`
|
|
945
945
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
946
946
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
947
947
|
}
|
|
948
|
-
`,variables:{streamId:e}})),n=Ue(this,
|
|
948
|
+
`,variables:{streamId:e}})),n=Ue(this,ls,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=A(await Ue(this,Me,"f").mutate({mutation:x`
|
|
949
949
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
950
950
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
951
951
|
}
|
|
952
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Me=new WeakMap,us=new WeakMap;var Lr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Yt,ls,_a,fs,Ea,Sn,ps,xa,Ba=class{constructor(e,t=!0){Yt.set(this,void 0),ls.set(this,void 0),_a.set(this,void 0),fs.set(this,void 0),Ea.set(this,void 0),Sn.set(this,void 0),ps.set(this,void 0),xa.set(this,void 0),Lr(this,Yt,e,"f"),Lr(this,ls,new Ca(Fe(this,Yt,"f"),t),"f"),Lr(this,_a,new $u(Fe(this,Yt,"f")),"f"),Lr(this,fs,new Cu(Fe(this,Yt,"f")),"f"),Lr(this,Ea,new Pu(Fe(this,Yt,"f")),"f"),Lr(this,xa,new Wu(Fe(this,Yt,"f"),t),"f"),Lr(this,Sn,new Ts(Fe(this,Yt,"f"),t),"f"),Fe(this,Sn,"f").setExpressionClient(Fe(this,_a,"f")),Fe(this,Sn,"f").setNeighbourhoodClient(Fe(this,Ea,"f")),Fe(this,Sn,"f").setAIClient(Fe(this,xa,"f")),Lr(this,ps,new Lu(Fe(this,Yt,"f"),t),"f")}get agent(){return Fe(this,ls,"f")}get expression(){return Fe(this,_a,"f")}get languages(){return Fe(this,fs,"f")}get neighbourhood(){return Fe(this,Ea,"f")}get perspective(){return Fe(this,Sn,"f")}get runtime(){return Fe(this,ps,"f")}get ai(){return Fe(this,xa,"f")}};Yt=new WeakMap,ls=new WeakMap,_a=new WeakMap,fs=new WeakMap,Ea=new WeakMap,Sn=new WeakMap,ps=new WeakMap,xa=new WeakMap;var Gu;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Gu||(Gu={}));var sl=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},cl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},kn=class{constructor(e,t){this.language=e,this.expression=t}};sl([w(),cl("design:type",tr)],kn.prototype,"language",void 0);sl([w(),cl("design:type",String)],kn.prototype,"expression",void 0);kn=sl([z(),cl("design:paramtypes",[tr,String])],kn);function Ak(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function Ok(r){if(r.startsWith("literal://")){let a=new tr;a.address="literal",a.name="literal";let o=r.substring(10);return new kn(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new tr;return s.address=a,new kn(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new tr;return a.address="did",new kn(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Et=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},cr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Rs=class{};Et([w(),cr("design:type",String)],Rs.prototype,"name",void 0);Et([w(),cr("design:type",String)],Rs.prototype,"type",void 0);Rs=Et([z()],Rs);var Va=class{};Et([w(),cr("design:type",String)],Va.prototype,"label",void 0);Et([w(),cr("design:type",String)],Va.prototype,"name",void 0);Et([w(),cr("design:type",Array)],Va.prototype,"parameters",void 0);Va=Et([z()],Va);var Cs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Et([w(),cr("design:type",String)],Cs.prototype,"name",void 0);Et([w(),cr("design:type",String)],Cs.prototype,"parametersStringified",void 0);Cs=Et([Qe(),cr("design:paramtypes",[String,Object])],Cs);var Ps=class{};Et([w(),cr("design:type",String)],Ps.prototype,"did",void 0);Et([w(),cr("design:type",Dn)],Ps.prototype,"status",void 0);Ps=Et([z()],Ps);var gd=class{},Qn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Li=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Jr=class{};Qn([w(),Li("design:type",String)],Jr.prototype,"name",void 0);Qn([w(),Li("design:type",String)],Jr.prototype,"address",void 0);Qn([w(),Li("design:type",String)],Jr.prototype,"settings",void 0);Qn([w(),Li("design:type",On)],Jr.prototype,"icon",void 0);Qn([w(),Li("design:type",On)],Jr.prototype,"constructorIcon",void 0);Qn([w(),Li("design:type",On)],Jr.prototype,"settingsIcon",void 0);Jr=Qn([z()],Jr);var ot=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ht=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qt=class{};ot([w(),ht("design:type",String)],qt.prototype,"name",void 0);ot([w(),ht("design:type",String)],qt.prototype,"address",void 0);ot([w(),ht("design:type",String)],qt.prototype,"description",void 0);ot([w(),ht("design:type",String)],qt.prototype,"author",void 0);ot([w(),ht("design:type",Boolean)],qt.prototype,"templated",void 0);ot([w(),ht("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ot([w(),ht("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ot([w(),ht("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ot([w(),ht("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ot([z()],qt);var Ti=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ot([w(),ht("design:type",String)],Ti.prototype,"name",void 0);ot([w(),ht("design:type",String)],Ti.prototype,"description",void 0);ot([w(),ht("design:type",Array)],Ti.prototype,"possibleTemplateParams",void 0);ot([w(),ht("design:type",String)],Ti.prototype,"sourceCodeLink",void 0);Ti=ot([Qe(),ht("design:paramtypes",[String,String])],Ti);var yd=class{},vd=class extends Xr(){},bd=class{},zs=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ul=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ls=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};zs([w(),ul("design:type",String)],Ls.prototype,"linkLanguage",void 0);zs([w(),ul("design:type",ar)],Ls.prototype,"meta",void 0);Ls=zs([z(),ul("design:paramtypes",[String,ar])],Ls);var Ku=class extends Xr(){};Ku=zs([z()],Ku);var zn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Wn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hu;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Hu||(Hu={}));var Yr=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Hu.Private}};zn([w(),Wn("design:type",String)],Yr.prototype,"uuid",void 0);zn([w(),Wn("design:type",String)],Yr.prototype,"name",void 0);zn([w(),Wn("design:type",String)],Yr.prototype,"state",void 0);zn([w(),Wn("design:type",String)],Yr.prototype,"sharedUrl",void 0);zn([w(),Wn("design:type",Ku)],Yr.prototype,"neighbourhood",void 0);zn([w(),Wn("design:type",Array)],Yr.prototype,"owners",void 0);Yr=zn([z(),Wn("design:paramtypes",[String,String,String])],Yr);var Ws=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Dh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$s=class{};Ws([w(),Dh("design:type",Array)],$s.prototype,"additions",void 0);Ws([w(),Dh("design:type",Array)],$s.prototype,"removals",void 0);$s=Ws([z()],$s);var Sd=class extends Xr(){};Sd=Ws([z()],Sd);var wd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ia,wn,Jo="smart_literal://content";function QS(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}var Qa=class{constructor(e,t){Ia.set(this,void 0),wn.set(this,void 0),wd(this,Ia,e,"f"),wd(this,wn,t,"f")}get base(){return mi(this,wn,"f")}static async create(e,t){let n=ve.from(QS(10)).toUrl(),i=new Qa(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new le({source:t,predicate:Jo}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new le({predicate:Jo}))).map(n=>new Qa(e,n.data.source))}async get(){let e=await mi(this,Ia,"f").getSingleTarget(new le({source:mi(this,wn,"f"),predicate:Jo}));if(!e)throw`No content for smart literal ${mi(this,wn,"f")}`;return ve.fromUrl(e).get()}async set(e){let t=ve.from(e);await mi(this,Ia,"f").setSingleTarget(new pt({source:mi(this,wn,"f"),predicate:Jo,target:t.toUrl()}))}};Ia=new WeakMap,wn=new WeakMap;var Bk=`
|
|
952
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Me=new WeakMap,ls=new WeakMap;var Lr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Fe=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Yt,fs,Ea,ps,xa,wn,ds,Ia,Va=class{constructor(e,t=!0){Yt.set(this,void 0),fs.set(this,void 0),Ea.set(this,void 0),ps.set(this,void 0),xa.set(this,void 0),wn.set(this,void 0),ds.set(this,void 0),Ia.set(this,void 0),Lr(this,Yt,e,"f"),Lr(this,fs,new Pa(Fe(this,Yt,"f"),t),"f"),Lr(this,Ea,new Fu(Fe(this,Yt,"f")),"f"),Lr(this,ps,new Pu(Fe(this,Yt,"f")),"f"),Lr(this,xa,new Lu(Fe(this,Yt,"f")),"f"),Lr(this,Ia,new Gu(Fe(this,Yt,"f"),t),"f"),Lr(this,wn,new Ts(Fe(this,Yt,"f"),t),"f"),Fe(this,wn,"f").setExpressionClient(Fe(this,Ea,"f")),Fe(this,wn,"f").setNeighbourhoodClient(Fe(this,xa,"f")),Fe(this,wn,"f").setAIClient(Fe(this,Ia,"f")),Lr(this,ds,new $u(Fe(this,Yt,"f"),t),"f")}get agent(){return Fe(this,fs,"f")}get expression(){return Fe(this,Ea,"f")}get languages(){return Fe(this,ps,"f")}get neighbourhood(){return Fe(this,xa,"f")}get perspective(){return Fe(this,wn,"f")}get runtime(){return Fe(this,ds,"f")}get ai(){return Fe(this,Ia,"f")}};Yt=new WeakMap,fs=new WeakMap,Ea=new WeakMap,ps=new WeakMap,xa=new WeakMap,wn=new WeakMap,ds=new WeakMap,Ia=new WeakMap;var Hu;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Hu||(Hu={}));var cl=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ul=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Tn=class{constructor(e,t){this.language=e,this.expression=t}};cl([w(),ul("design:type",tr)],Tn.prototype,"language",void 0);cl([w(),ul("design:type",String)],Tn.prototype,"expression",void 0);Tn=cl([z(),ul("design:paramtypes",[tr,String])],Tn);function RT(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function CT(r){if(r.startsWith("literal://")){let a=new tr;a.address="literal",a.name="literal";let o=r.substring(10);return new Tn(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new tr;return s.address=a,new Tn(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new tr;return a.address="did",new Tn(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Et=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},cr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Cs=class{};Et([w(),cr("design:type",String)],Cs.prototype,"name",void 0);Et([w(),cr("design:type",String)],Cs.prototype,"type",void 0);Cs=Et([z()],Cs);var Qa=class{};Et([w(),cr("design:type",String)],Qa.prototype,"label",void 0);Et([w(),cr("design:type",String)],Qa.prototype,"name",void 0);Et([w(),cr("design:type",Array)],Qa.prototype,"parameters",void 0);Qa=Et([z()],Qa);var Ps=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Et([w(),cr("design:type",String)],Ps.prototype,"name",void 0);Et([w(),cr("design:type",String)],Ps.prototype,"parametersStringified",void 0);Ps=Et([Qe(),cr("design:paramtypes",[String,Object])],Ps);var Ls=class{};Et([w(),cr("design:type",String)],Ls.prototype,"did",void 0);Et([w(),cr("design:type",Dn)],Ls.prototype,"status",void 0);Ls=Et([z()],Ls);var yd=class{},Qn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},$i=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Yr=class{};Qn([w(),$i("design:type",String)],Yr.prototype,"name",void 0);Qn([w(),$i("design:type",String)],Yr.prototype,"address",void 0);Qn([w(),$i("design:type",String)],Yr.prototype,"settings",void 0);Qn([w(),$i("design:type",On)],Yr.prototype,"icon",void 0);Qn([w(),$i("design:type",On)],Yr.prototype,"constructorIcon",void 0);Qn([w(),$i("design:type",On)],Yr.prototype,"settingsIcon",void 0);Yr=Qn([z()],Yr);var ot=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ht=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qt=class{};ot([w(),ht("design:type",String)],qt.prototype,"name",void 0);ot([w(),ht("design:type",String)],qt.prototype,"address",void 0);ot([w(),ht("design:type",String)],qt.prototype,"description",void 0);ot([w(),ht("design:type",String)],qt.prototype,"author",void 0);ot([w(),ht("design:type",Boolean)],qt.prototype,"templated",void 0);ot([w(),ht("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ot([w(),ht("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ot([w(),ht("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ot([w(),ht("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ot([z()],qt);var Ti=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ot([w(),ht("design:type",String)],Ti.prototype,"name",void 0);ot([w(),ht("design:type",String)],Ti.prototype,"description",void 0);ot([w(),ht("design:type",Array)],Ti.prototype,"possibleTemplateParams",void 0);ot([w(),ht("design:type",String)],Ti.prototype,"sourceCodeLink",void 0);Ti=ot([Qe(),ht("design:paramtypes",[String,String])],Ti);var vd=class{},bd=class extends en(){},Sd=class{},Ws=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ll=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$s=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Ws([w(),ll("design:type",String)],$s.prototype,"linkLanguage",void 0);Ws([w(),ll("design:type",ar)],$s.prototype,"meta",void 0);$s=Ws([z(),ll("design:paramtypes",[String,ar])],$s);var Ku=class extends en(){};Ku=Ws([z()],Ku);var zn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Wn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ju;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Ju||(Ju={}));var Zr=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Ju.Private}};zn([w(),Wn("design:type",String)],Zr.prototype,"uuid",void 0);zn([w(),Wn("design:type",String)],Zr.prototype,"name",void 0);zn([w(),Wn("design:type",String)],Zr.prototype,"state",void 0);zn([w(),Wn("design:type",String)],Zr.prototype,"sharedUrl",void 0);zn([w(),Wn("design:type",Ku)],Zr.prototype,"neighbourhood",void 0);zn([w(),Wn("design:type",Array)],Zr.prototype,"owners",void 0);Zr=zn([z(),Wn("design:paramtypes",[String,String,String])],Zr);var Gs=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Ph=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Fs=class{};Gs([w(),Ph("design:type",Array)],Fs.prototype,"additions",void 0);Gs([w(),Ph("design:type",Array)],Fs.prototype,"removals",void 0);Fs=Gs([z()],Fs);var wd=class extends en(){};wd=Gs([z()],wd);var _d=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},mi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ka,_n,Yo="smart_literal://content";function HS(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}var za=class{constructor(e,t){ka.set(this,void 0),_n.set(this,void 0),_d(this,ka,e,"f"),_d(this,_n,t,"f")}get base(){return mi(this,_n,"f")}static async create(e,t){let n=ve.from(HS(10)).toUrl(),i=new za(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new le({source:t,predicate:Yo}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new le({predicate:Yo}))).map(n=>new za(e,n.data.source))}async get(){let e=await mi(this,ka,"f").getSingleTarget(new le({source:mi(this,_n,"f"),predicate:Yo}));if(!e)throw`No content for smart literal ${mi(this,_n,"f")}`;return ve.fromUrl(e).get()}async set(e){let t=ve.from(e);await mi(this,ka,"f").setSingleTarget(new pt({source:mi(this,_n,"f"),predicate:Yo,target:t.toUrl()}))}};ka=new WeakMap,_n=new WeakMap;var WT=`
|
|
953
953
|
type AIModelLoadingStatus {
|
|
954
954
|
downloaded: Boolean!
|
|
955
955
|
loaded: Boolean!
|
|
@@ -1535,7 +1535,7 @@ input VoiceActivityParamsInput {
|
|
|
1535
1535
|
startWindow: Float
|
|
1536
1536
|
timeBeforeSpeech: Float
|
|
1537
1537
|
}
|
|
1538
|
-
`,D=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},_=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},H=function(r,e){return function(t,n){e(t,n,r)}},Ja=new Wr;Ja.author="did:ad4m:test";Ja.timestamp=Date.now();Ja.data={source:"root",target:"neighbourhood://Qm12345"};Ja.proof={signature:"",key:"",valid:!0};var Ur=new Dn;Ur.author="did:ad4m:test";Ur.timestamp=Date.now().toString();Ur.proof=new Sr("","");Ur.data=new ar([Ja]);var Fs=class{};D([w(),_("design:type",String)],Fs.prototype,"recipient",void 0);D([w(),_("design:type",Dn)],Fs.prototype,"message",void 0);Fs=D([z()],Fs);var ki=class{};D([w(),_("design:type",String)],ki.prototype,"ad4mExecutorVersion",void 0);D([w(),_("design:type",Boolean)],ki.prototype,"isInitialized",void 0);D([w(),_("design:type",Boolean)],ki.prototype,"isUnlocked",void 0);ki=D([z()],ki);var Fn=class{};D([w(),_("design:type",String)],Fn.prototype,"title",void 0);D([w(),_("design:type",String)],Fn.prototype,"message",void 0);D([w(),_("design:type",String)],Fn.prototype,"type",void 0);D([w(),_("design:type",String)],Fn.prototype,"addon",void 0);Fn=D([z()],Fn);var Rt=class{};D([w(),_("design:type",String)],Rt.prototype,"description",void 0);D([w(),_("design:type",String)],Rt.prototype,"appName",void 0);D([w(),_("design:type",String)],Rt.prototype,"appUrl",void 0);D([w(),_("design:type",String)],Rt.prototype,"appIconPath",void 0);D([w(),_("design:type",String)],Rt.prototype,"trigger",void 0);D([w(),_("design:type",Array)],Rt.prototype,"perspectiveIds",void 0);D([w(),_("design:type",String)],Rt.prototype,"webhookUrl",void 0);D([w(),_("design:type",String)],Rt.prototype,"webhookAuth",void 0);Rt=D([Qe()],Rt);var St=class{};D([w(),_("design:type",String)],St.prototype,"id",void 0);D([w(),_("design:type",Boolean)],St.prototype,"granted",void 0);D([w(),_("design:type",String)],St.prototype,"description",void 0);D([w(),_("design:type",String)],St.prototype,"appName",void 0);D([w(),_("design:type",String)],St.prototype,"appUrl",void 0);D([w(),_("design:type",String)],St.prototype,"appIconPath",void 0);D([w(),_("design:type",String)],St.prototype,"trigger",void 0);D([w(),_("design:type",Array)],St.prototype,"perspectiveIds",void 0);D([w(),_("design:type",String)],St.prototype,"webhookUrl",void 0);D([w(),_("design:type",String)],St.prototype,"webhookAuth",void 0);St=D([z()],St);var Ai=class{};D([w(),_("design:type",St)],Ai.prototype,"notification",void 0);D([w(),_("design:type",String)],Ai.prototype,"perspectiveId",void 0);D([w(),_("design:type",String)],Ai.prototype,"triggerMatch",void 0);Ai=D([z()],Ai);var Ve=class{};D([w(),_("design:type",Number)],Ve.prototype,"total",void 0);D([w(),_("design:type",Number)],Ve.prototype,"imported",void 0);D([w(),_("design:type",Number)],Ve.prototype,"failed",void 0);D([w(),_("design:type",Number)],Ve.prototype,"omitted",void 0);D([w(),_("design:type",Array)],Ve.prototype,"errors",void 0);Ve=D([z()],Ve);var wt=class{};D([w(),_("design:type",Ve)],wt.prototype,"perspectives",void 0);D([w(),_("design:type",Ve)],wt.prototype,"links",void 0);D([w(),_("design:type",Ve)],wt.prototype,"expressions",void 0);D([w(),_("design:type",Ve)],wt.prototype,"perspectiveDiffs",void 0);D([w(),_("design:type",Ve)],wt.prototype,"notifications",void 0);D([w(),_("design:type",Ve)],wt.prototype,"models",void 0);D([w(),_("design:type",Ve)],wt.prototype,"defaultModels",void 0);D([w(),_("design:type",Ve)],wt.prototype,"tasks",void 0);D([w(),_("design:type",Ve)],wt.prototype,"friends",void 0);D([w(),_("design:type",Ve)],wt.prototype,"trustedAgents",void 0);D([w(),_("design:type",Ve)],wt.prototype,"knownLinkLanguages",void 0);wt=D([z()],wt);var Oi=class{};D([w(),_("design:type",String)],Oi.prototype,"email",void 0);D([w(),_("design:type",String)],Oi.prototype,"did",void 0);D([w(),_("design:type",String)],Oi.prototype,"lastSeen",void 0);D([w(),_("design:type",Number)],Oi.prototype,"perspectiveCount",void 0);Oi=D([z()],Oi);var Mn=class{};D([w(),_("design:type",Boolean)],Mn.prototype,"success",void 0);D([w(),_("design:type",String)],Mn.prototype,"message",void 0);D([w(),_("design:type",Boolean)],Mn.prototype,"requiresPassword",void 0);D([w(),_("design:type",Boolean)],Mn.prototype,"isExistingUser",void 0);Mn=D([z()],Mn);var U=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Ur}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Ur]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Ur}]}runtimeMessageReceived(){return Ur}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Gu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,n){return new Rn("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,n){return!0}};D([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ki)],U.prototype,"runtimeInfo",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"addTrustedAgents",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],U.prototype,"getTrustedAgents",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],U.prototype,"runtimeFriends",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);D([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);D([_t(),H(0,K()),H(1,K()),H(2,K()),H(3,K()),_("design:type",Function),_("design:paramtypes",[String,String,String,String]),_("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[ar]),_("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);D([_t(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Dn)],U.prototype,"runtimeFriendStatus",null);D([he(),H(0,K()),H(1,K()),_("design:type",Function),_("design:paramtypes",[String,Ss]),_("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);D([_t(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);D([_t(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);D([Yu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Dn)],U.prototype,"runtimeMessageReceived",null);D([Yu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Fn)],U.prototype,"exceptionOccurred",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Rt]),_("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],U.prototype,"runtimeNotifications",null);D([he(),H(0,K()),H(1,K()),_("design:type",Function),_("design:paramtypes",[String,Rt]),_("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);D([Yu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Ai)],U.prototype,"runtimeNotificationTriggered",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);D([he(),H(0,K()),H(1,K()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[Boolean]),_("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);D([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],U.prototype,"runtimeListUsers",null);D([he(),H(0,K()),H(1,K()),_("design:type",Function),_("design:paramtypes",[String,or]),_("design:returntype",Mn)],U.prototype,"runtimeRequestLoginVerification",null);D([he(),H(0,K()),H(1,K()),H(2,K()),_("design:type",Function),_("design:paramtypes",[String,String,String]),_("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);D([he(),H(0,K()),H(1,K()),H(2,K()),_("design:type",Function),_("design:paramtypes",[String,String,or]),_("design:returntype",Rn)],U.prototype,"runtimeCreateUser",null);D([he(),H(0,K()),H(1,K()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",String)],U.prototype,"runtimeLoginUser",null);D([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);D([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);D([he(),H(0,K()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);D([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);D([he(),H(0,K()),H(1,K()),H(2,K()),_("design:type",Function),_("design:paramtypes",[String,String,Number]),_("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);U=D([Ey()],U);function ds(r){return r.charAt(0).toUpperCase()+r.slice(1)}function oa(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=Zt(t);if(r.field){let i=n[r.field];if(!i)throw new Error(`parent(): field "${r.field}" is not a registered relation on ${t.name}`);return i.predicate}for(let[,i]of Object.entries(n))if(i.target&&i.target()===e)return i.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function _d(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function Ed(){return`
|
|
1538
|
+
`,R=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},_=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},K=function(r,e){return function(t,n){e(t,n,r)}},Ya=new Gr;Ya.author="did:ad4m:test";Ya.timestamp=Date.now();Ya.data={source:"root",target:"neighbourhood://Qm12345"};Ya.proof={signature:"",key:"",valid:!0};var Ur=new Dn;Ur.author="did:ad4m:test";Ur.timestamp=Date.now().toString();Ur.proof=new Sr("","");Ur.data=new ar([Ya]);var Ms=class{};R([w(),_("design:type",String)],Ms.prototype,"recipient",void 0);R([w(),_("design:type",Dn)],Ms.prototype,"message",void 0);Ms=R([z()],Ms);var Ai=class{};R([w(),_("design:type",String)],Ai.prototype,"ad4mExecutorVersion",void 0);R([w(),_("design:type",Boolean)],Ai.prototype,"isInitialized",void 0);R([w(),_("design:type",Boolean)],Ai.prototype,"isUnlocked",void 0);Ai=R([z()],Ai);var Fn=class{};R([w(),_("design:type",String)],Fn.prototype,"title",void 0);R([w(),_("design:type",String)],Fn.prototype,"message",void 0);R([w(),_("design:type",String)],Fn.prototype,"type",void 0);R([w(),_("design:type",String)],Fn.prototype,"addon",void 0);Fn=R([z()],Fn);var Rt=class{};R([w(),_("design:type",String)],Rt.prototype,"description",void 0);R([w(),_("design:type",String)],Rt.prototype,"appName",void 0);R([w(),_("design:type",String)],Rt.prototype,"appUrl",void 0);R([w(),_("design:type",String)],Rt.prototype,"appIconPath",void 0);R([w(),_("design:type",String)],Rt.prototype,"trigger",void 0);R([w(),_("design:type",Array)],Rt.prototype,"perspectiveIds",void 0);R([w(),_("design:type",String)],Rt.prototype,"webhookUrl",void 0);R([w(),_("design:type",String)],Rt.prototype,"webhookAuth",void 0);Rt=R([Qe()],Rt);var St=class{};R([w(),_("design:type",String)],St.prototype,"id",void 0);R([w(),_("design:type",Boolean)],St.prototype,"granted",void 0);R([w(),_("design:type",String)],St.prototype,"description",void 0);R([w(),_("design:type",String)],St.prototype,"appName",void 0);R([w(),_("design:type",String)],St.prototype,"appUrl",void 0);R([w(),_("design:type",String)],St.prototype,"appIconPath",void 0);R([w(),_("design:type",String)],St.prototype,"trigger",void 0);R([w(),_("design:type",Array)],St.prototype,"perspectiveIds",void 0);R([w(),_("design:type",String)],St.prototype,"webhookUrl",void 0);R([w(),_("design:type",String)],St.prototype,"webhookAuth",void 0);St=R([z()],St);var Oi=class{};R([w(),_("design:type",St)],Oi.prototype,"notification",void 0);R([w(),_("design:type",String)],Oi.prototype,"perspectiveId",void 0);R([w(),_("design:type",String)],Oi.prototype,"triggerMatch",void 0);Oi=R([z()],Oi);var Ve=class{};R([w(),_("design:type",Number)],Ve.prototype,"total",void 0);R([w(),_("design:type",Number)],Ve.prototype,"imported",void 0);R([w(),_("design:type",Number)],Ve.prototype,"failed",void 0);R([w(),_("design:type",Number)],Ve.prototype,"omitted",void 0);R([w(),_("design:type",Array)],Ve.prototype,"errors",void 0);Ve=R([z()],Ve);var wt=class{};R([w(),_("design:type",Ve)],wt.prototype,"perspectives",void 0);R([w(),_("design:type",Ve)],wt.prototype,"links",void 0);R([w(),_("design:type",Ve)],wt.prototype,"expressions",void 0);R([w(),_("design:type",Ve)],wt.prototype,"perspectiveDiffs",void 0);R([w(),_("design:type",Ve)],wt.prototype,"notifications",void 0);R([w(),_("design:type",Ve)],wt.prototype,"models",void 0);R([w(),_("design:type",Ve)],wt.prototype,"defaultModels",void 0);R([w(),_("design:type",Ve)],wt.prototype,"tasks",void 0);R([w(),_("design:type",Ve)],wt.prototype,"friends",void 0);R([w(),_("design:type",Ve)],wt.prototype,"trustedAgents",void 0);R([w(),_("design:type",Ve)],wt.prototype,"knownLinkLanguages",void 0);wt=R([z()],wt);var Ni=class{};R([w(),_("design:type",String)],Ni.prototype,"email",void 0);R([w(),_("design:type",String)],Ni.prototype,"did",void 0);R([w(),_("design:type",String)],Ni.prototype,"lastSeen",void 0);R([w(),_("design:type",Number)],Ni.prototype,"perspectiveCount",void 0);Ni=R([z()],Ni);var Mn=class{};R([w(),_("design:type",Boolean)],Mn.prototype,"success",void 0);R([w(),_("design:type",String)],Mn.prototype,"message",void 0);R([w(),_("design:type",Boolean)],Mn.prototype,"requiresPassword",void 0);R([w(),_("design:type",Boolean)],Mn.prototype,"isExistingUser",void 0);Mn=R([z()],Mn);var q=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Ur}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Ur]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Ur}]}runtimeMessageReceived(){return Ur}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Hu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,n){return new Rn("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,n){return!0}};R([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeQuit",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeOpenLink",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Ai)],q.prototype,"runtimeInfo",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"addTrustedAgents",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"deleteTrustedAgents",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"getTrustedAgents",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeKnownLinkLanguageTemplates",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeFriends",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeAddFriends",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeRemoveFriends",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],q.prototype,"runtimeHcAgentInfos",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],q.prototype,"runtimeGetNetworkMetrics",null);R([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeRestartHolochain",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",Boolean)],q.prototype,"runtimeHcAddAgentInfos",null);R([_t(),K(0,H()),K(1,H()),K(2,H()),K(3,H()),_("design:type",Function),_("design:paramtypes",[String,String,String,String]),_("design:returntype",void 0)],q.prototype,"runtimeVerifyStringSignedByDid",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[ar]),_("design:returntype",Boolean)],q.prototype,"runtimeSetStatus",null);R([_t(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Dn)],q.prototype,"runtimeFriendStatus",null);R([he(),K(0,H()),K(1,H()),_("design:type",Function),_("design:paramtypes",[String,ws]),_("design:returntype",Boolean)],q.prototype,"runtimeFriendSendMessage",null);R([_t(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],q.prototype,"runtimeMessageInbox",null);R([_t(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],q.prototype,"runtimeMessageOutbox",null);R([Zu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Dn)],q.prototype,"runtimeMessageReceived",null);R([Zu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Fn)],q.prototype,"exceptionOccurred",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Rt]),_("design:returntype",String)],q.prototype,"runtimeRequestInstallNotification",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeNotifications",null);R([he(),K(0,H()),K(1,H()),_("design:type",Function),_("design:paramtypes",[String,Rt]),_("design:returntype",Boolean)],q.prototype,"runtimeUpdateNotification",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeRemoveNotification",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeGrantNotification",null);R([Zu(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Oi)],q.prototype,"runtimeNotificationTriggered",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeExportDb",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeImportDb",null);R([he(),K(0,H()),K(1,H()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",Boolean)],q.prototype,"runtimeExportPerspective",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeImportPerspective",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeMultiUserEnabled",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[Boolean]),_("design:returntype",Boolean)],q.prototype,"runtimeSetMultiUserEnabled",null);R([_t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeListUsers",null);R([he(),K(0,H()),K(1,H()),_("design:type",Function),_("design:paramtypes",[String,or]),_("design:returntype",Mn)],q.prototype,"runtimeRequestLoginVerification",null);R([he(),K(0,H()),K(1,H()),K(2,H()),_("design:type",Function),_("design:paramtypes",[String,String,String]),_("design:returntype",String)],q.prototype,"runtimeVerifyEmailCode",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeTestEmail",null);R([he(),K(0,H()),K(1,H()),K(2,H()),_("design:type",Function),_("design:paramtypes",[String,String,or]),_("design:returntype",Rn)],q.prototype,"runtimeCreateUser",null);R([he(),K(0,H()),K(1,H()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",String)],q.prototype,"runtimeLoginUser",null);R([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeEnable",null);R([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeDisable",null);R([he(),K(0,H()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",String)],q.prototype,"runtimeEmailTestGetCode",null);R([he(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestClearCodes",null);R([he(),K(0,H()),K(1,H()),K(2,H()),_("design:type",Function),_("design:paramtypes",[String,String,Number]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestSetExpiry",null);q=R([ky()],q);function hs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function sa(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=Zt(t);if(r.field){let i=n[r.field];if(!i)throw new Error(`parent(): field "${r.field}" is not a registered relation on ${t.name}`);return i.predicate}for(let[,i]of Object.entries(n))if(i.target&&i.target()===e)return i.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function Ed(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function xd(){return`
|
|
1539
1539
|
findall(
|
|
1540
1540
|
[T, A],
|
|
1541
1541
|
link(Base, _, _, T, A),
|
|
@@ -1543,26 +1543,26 @@ input VoiceActivityParamsInput {
|
|
|
1543
1543
|
),
|
|
1544
1544
|
sort(AllLinks, SortedLinks),
|
|
1545
1545
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1546
|
-
`}function
|
|
1546
|
+
`}function KS(r){return`
|
|
1547
1547
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1548
1548
|
% Constrain to specified properties if provided
|
|
1549
1549
|
${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1550
1550
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1551
1551
|
), Properties)
|
|
1552
|
-
`}function
|
|
1553
|
-
`)}function
|
|
1552
|
+
`}function Id(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,n])=>{let i=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=t==="id"?"Base":hs(t);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:p,gte:d}=n;if(s!==void 0)if(Array.isArray(s)){let m=s.map(h=>e(h)).join(", ");return i?`\\+ member(${o}, [${m}])`:`${a}, \\+ member(Value${t}, [${m}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:p,symbol:">"},{value:d,symbol:">="}];for(let{value:m,symbol:h}of f)if(m!==void 0)return i?`${o} ${h} ${m}`:`${a}, Value${t} ${h} ${m}`}return i?`${o} = ${e(n)}`:`${a}, Value${t} = ${e(n)}`}).join(", ")}function kd(r){return r?"length(UnsortedInstances, TotalCount)":""}function Td(r){if(!r)return"SortedInstances = UnsortedInstances";let e=Object.entries(r);if(e.length===1){let[n,i]=e[0];return`sort_instances(UnsortedInstances, "${n}", "${i}", SortedInstances)`}let t=[];for(let n=e.length-1;n>=0;n--){let[i,a]=e[n],o=n===e.length-1?"UnsortedInstances":`MultiSortIntermediate${n+1}`,s=n===0?"SortedInstances":`MultiSortIntermediate${n}`;t.push(`sort_instances(${o}, "${i}", "${a}", ${s})`)}return t.join(`,
|
|
1553
|
+
`)}function Ad(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Od(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Nd(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function fl(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function Lh(r,e){return fl(r.type)===e}function Dd(r){return Lh(r,"array")}function Rd(r){return Lh(r,"object")}function JS(r){let e=fl(r.type);return e==="number"||e==="integer"}var jt=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===jt)return await e.stringOrTemplateObjectToSubjectClassName(this);let n=this.classNamesByClass.get(this);n||(n={},this.classNamesByClass.set(this,n));let i=e.uuid;return n[i]||(n[i]=await e.stringOrTemplateObjectToSubjectClassName(this)),n[i]}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,n={},i=Vr(this);for(let[p,d]of Object.entries(i)){let f=d;n[p]={name:p,predicate:f.through||"",required:f.required||!1,readOnly:!(f.writable??!1),...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.prologGetter!==void 0&&{prologGetter:f.prologGetter},...f.getter!==void 0&&{getter:f.getter},...f.prologSetter!==void 0&&{prologSetter:f.prologSetter},...f.local!==void 0&&{local:f.local},...f.transform!==void 0&&{transform:f.transform},...f.flag!==void 0&&{flag:f.flag}}}let a={},o=Zt(this),s=Object.fromEntries(Object.entries(o).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let[p,d]of Object.entries(s)){let f=d;a[p]={name:p,predicate:f.predicate||"",...f.local!==void 0&&{local:f.local},...f.getter!==void 0&&{getter:f.getter},direction:f.kind==="belongsToMany"||f.kind==="belongsToOne"?"reverse":"forward",...f.target!==void 0&&{target:f.target},...f.filter!==void 0&&{filter:f.filter},...f.where!==void 0&&{where:f.where}}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let p=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(p.properties)for(let[f,m]of Object.entries(p.properties)){let h=Dd(m),g=this.determinePredicate(p,f,m,this.determineNamespace(p,d),d);if(h)a[f]={name:f,predicate:g,...m["x-ad4m"]?.local!==void 0&&{local:m["x-ad4m"].local}};else{let b=p.required?.includes(f)||!1;n[f]={name:f,predicate:g,required:b,readOnly:m["x-ad4m"]?.writable===!1,...m["x-ad4m"]?.resolveLanguage&&{resolveLanguage:m["x-ad4m"].resolveLanguage},...m["x-ad4m"]?.initial&&{initial:m["x-ad4m"].initial},...m["x-ad4m"]?.local!==void 0&&{local:m["x-ad4m"].local}}}}}return{className:t,properties:n,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||ve.from(Kd(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 Vr(t)[e]}getRelationOptions(e){let t=this.constructor;return Zt(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 n=this.getRelationOptions(e);if(!n)throw new Error(`Relation "${e}" has no metadata defined`);if(!n.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:n.predicate,target:"value",...n.local&&{local:!0}}]}static async hydratePropertyValue(e,t,n,i){let a=e;if(e!=null&&e!=="")if(t.resolveLanguage!=null&&t.resolveLanguage!=="literal"&&typeof e=="string"&&!e.startsWith("literal://"))try{let o=await n.getExpression(e);if(o)try{a=JSON.parse(o.data)}catch{a=o.data}}catch(o){console.warn(`hydratePropertyValue: failed to resolve expression for "${t.name}":`,o)}else if(t.resolveLanguage==="literal"&&typeof e=="string"&&e.startsWith("literal://"))try{let o=ve.fromUrl(e).get();a=o.data!==void 0?o.data:o}catch{}else typeof e=="string"&&i&&(i==="number"?a=Number(e):i==="boolean"&&(a=e==="true"||e==="1"));return t.transform&&typeof t.transform=="function"&&(a=t.transform(a)),a}static async hydrateFromLinks(e,t,n,i,a){if(!t||t.length===0)return;let o=null,s=null,c=null,u=a&&a.length>0?new Set(a):null,l=new Map;for(let[h,g]of Object.entries(n.properties))g.getter||u&&!u.has(h)||l.set(g.predicate,[h,g]);let p=new Map,d=[];for(let[h,g]of Object.entries(n.relations))if(!g.getter){if(g.target&&g.filter!==!1){d.push([h,g]);continue}p.set(g.predicate,[h,g])}for(let[h,g]of d)p.has(g.predicate)||p.set(g.predicate,[h,g]);let f=new Map,m=new Map;for(let h=0;h<t.length;h++){let g=t[h],{predicate:b,target:v,author:S,timestamp:y}=g;if(v==="None"||v===void 0||v===null)continue;y!=null&&((o==null||y<o)&&(o=y,c=S??null),(s==null||y>s)&&(s=y));let k=l.get(b);if(k){f.get(k[0]),f.set(k[0],{target:v,timestamp:y});continue}let N=p.get(b);if(N){let[T]=N,C=m.get(T);C||(C=[],m.set(T,C)),C.push({target:v,timestamp:y??"",index:h})}}for(let[h,{target:g}]of f){let[,b]=l.get(n.properties[h].predicate),v=typeof e[h];e[h]=await this.hydratePropertyValue(g,b,i,v!=="undefined"?v:void 0)}for(let[h,g]of m)g.sort((b,v)=>{let S=String(b.timestamp).localeCompare(String(v.timestamp));return S!==0?S:b.index-v.index}),e[h]=g.map(b=>b.target).filter(b=>b!=null&&b!==""&&b!=="None");c&&(e.author=c),o!=null&&(e.createdAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o),s!=null&&(e.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}static async assignValuesToInstance(e,t,n){let i=Object.fromEntries(await Promise.all(n.map(async([o,s,c])=>{let u=s;if(!c&&typeof s=="string"){let d=Array.from(s,h=>h.codePointAt(0)),f=d.every(h=>h<=255),m=d.some(h=>h>=128);if(f&&m)try{let h=Uint8Array.from(d),g=new TextDecoder("utf-8",{fatal:!0}).decode(h);g!==s&&(u=g)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${o}"`,{value:s,error:h})}}if(c){let d=await e.getExpression(s);if(d)try{u=JSON.parse(d.data)}catch{u=d.data}}let p=Vr(t.constructor)[o]?.transform;return p&&typeof p=="function"&&(u=p(u)),[o,u]}))),a=Object.fromEntries(Object.entries(i).filter(([o])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),o);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(t,a)}static normalizeValue(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&typeof t.id=="string"?t.id:t):e}takeSnapshot(e){let n=this.constructor.getModelMetadata(),i={};for(let a of Object.keys(n.properties)){let o=this[a];i[a]=jt.normalizeValue(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(n.relations)){let o=this[a];i[a]=jt.normalizeValue(Array.isArray(o)?[...o]:o)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in n.relations){let o=this[a];i[a]=jt.normalizeValue(Array.isArray(o)?[...o]:o)}}this._snapshot=i}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 n=[],i=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of i){if(!(a in this._snapshot))continue;let o=jt.normalizeValue(this[a]),s=this._snapshot[a];if(Array.isArray(o)||Array.isArray(s)){let c=Array.isArray(o)?[...o].sort():[],u=Array.isArray(s)?[...s].sort():[];(c.length!==u.length||c.some((l,p)=>l!==u[p]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
|
|
1554
1554
|
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1555
1555
|
FROM link
|
|
1556
1556
|
WHERE in.uri = ${t.formatSurrealValue(this._baseExpression)}
|
|
1557
1557
|
ORDER BY timestamp ASC
|
|
1558
|
-
`,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let
|
|
1558
|
+
`,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await t.hydrateFromLinks(this,o,n,this._perspective,l)}let s=Zt(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,p]of Object.entries(s)){if(p.kind!=="belongsToOne"&&p.kind!=="belongsToMany"||c&&!c.has(l))continue;let f=(await this._perspective.get(new le({predicate:p.predicate,target:this._baseExpression}))).filter(m=>m.data.target===this._baseExpression).map(m=>m.data.source);p.kind==="belongsToOne"?this[l]=f.length>0?f[f.length-1]:null:this[l]=f}let u=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await t.evaluateCustomGettersForInstance(this,this._perspective,n,u),e?.include&&await t.hydrateRelations([this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,n){let{properties:i,where:a,order:o,offset:s,limit:c,count:u}=t,l=n||await this.getClassName(e),p=t.parent?sa(t.parent,this):void 0,d=[xd(),Ed(t.parent,p),KS(i),Id(a)],f=[kd(u),Td(o),Ad(s),Od(c)];return`
|
|
1559
1559
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1560
1560
|
subject_class("${l}", SubjectClass),
|
|
1561
1561
|
instance(SubjectClass, Base),
|
|
1562
|
-
${
|
|
1562
|
+
${d.filter(h=>h).join(", ")}
|
|
1563
1563
|
), UnsortedInstances),
|
|
1564
|
-
${f.filter(
|
|
1565
|
-
`}static async evaluateCustomGettersForInstance(e,t,n){let
|
|
1564
|
+
${f.filter(h=>h).join(", ")}
|
|
1565
|
+
`}static buildConformanceGetter(e,t){let n=Hd(e,t);if(!n){let i=t?.prototype?.className||t?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${i}".`);return}return n.getter}static async evaluateCustomGettersForInstance(e,t,n,i){let a=this.formatSurrealValue(e.id),s=i?.requestedProperties&&i.requestedProperties.length>0?new Set(i.requestedProperties):null;for(let[c,u]of Object.entries(n.properties))if(!(s&&!s.has(c))&&u.getter)try{let l=u.getter.replace(/Base/g,a),p=await t.querySurrealDB(`SELECT (${l}) AS value FROM node WHERE uri = ${a}`);p&&p.length>0&&p[0].value!==void 0&&p[0].value!==null&&p[0].value!=="None"&&p[0].value!==""&&(e[c]=p[0].value)}catch(l){console.warn(`Failed to evaluate getter for ${c}:`,l)}for(let[c,u]of Object.entries(n.relations)){if(s&&!s.has(c)&&!(i?.include&&c in i.include))continue;let l=u,p=l.getter;if(!p&&l.where&&l.direction!=="reverse")try{let d=l.target?.(),f=d?d.getModelMetadata?.()??null:null,m=Gd(l.where,f);m.length>0&&(p=`(->link[WHERE predicate = '${Y(l.predicate)}'].out[WHERE ${m.join(" AND ")}].uri)`)}catch{}if(!p&&l.target&&l.filter!==!1&&l.direction!=="reverse")try{let d=l.target();p=this.buildConformanceGetter(l.predicate,d),p||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${c}" (predicate: "${l.predicate}")`)}catch(d){console.warn(`[Ad4mModel] auto-generation failed for relation "${c}":`,d)}if(p)try{let f=`SELECT (${p.replace(/Base/g,a)}) AS value FROM node WHERE uri = ${a}`,m=await t.querySurrealDB(f);if(m&&m.length>0&&m[0].value!==void 0&&m[0].value!==null){let h=m[0].value;e[c]=Array.isArray(h)?h.filter(g=>g!=null&&g!==""&&g!=="None"):h}}catch(d){console.warn(`Failed to evaluate getter for ${c}:`,d)}}}static async hydrateRelations(e,t,n){if(!n||Object.keys(n).length===0)return;let i=Zt(this);for(let[a,o]of Object.entries(n)){let s=i[a];if(!s){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=s.target(),u=typeof o=="object"&&o!==null?o:void 0,l=u?.include;if(s.kind==="belongsToOne"||s.kind==="belongsToMany"){for(let b of e){let S=(await t.get(new le({predicate:s.predicate,target:b.id}))).filter(y=>y.data.target===b.id).map(y=>y.data.source);if(s.kind==="belongsToOne"){if(S.length===0){b[a]=null;continue}let y=S[S.length-1];try{let k=new c(t,y);await k.get(),b[a]=k}catch{b[a]=null}}else{let y=[];if(u&&(u.where||u.order||u.properties)){let k={id:S,...u.where??{}};y=await c.findAll(t,{where:k,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(S.map(async k=>{try{let N=new c(t,k);await N.get(u?.properties?{properties:u.properties}:void 0),y.push(N)}catch{}}));if(u?.order&&!(u.where||u.properties)){let k=Object.entries(u.order);y=y.sort((N,T)=>{for(let[C,$]of k){let P=String(N[C]??""),M=String(T[C]??""),we=P.localeCompare(M);if(we!==0)return $==="DESC"?-we:we}return 0})}if(u?.offset!=null||u?.limit!=null){let k=u.offset??0,N=u.limit!=null?k+u.limit:void 0;y=y.slice(k,N)}b[a]=y,l&&y.length>0&&await c.hydrateRelations(y,t,l)}}continue}let p=new Set,d=new Map;for(let b of e){let v=b[a];if(d.set(b,Array.isArray(v)?[...v]:v),v!=null)if(Array.isArray(v))for(let S of v)typeof S=="string"?p.add(S):S&&typeof S=="object"&&typeof S.id=="string"&&p.add(S.id);else typeof v=="string"?p.add(v):v&&typeof v=="object"&&typeof v.id=="string"&&p.add(v.id)}if(p.size===0)continue;let f=new Map,h={where:{id:Array.from(p),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},g=await c.findAll(t,h);for(let b of g)f.set(b.id,b);for(let b of e){let v=d.get(b);if(v!=null)if(Array.isArray(v)){let S=v.map(y=>typeof y=="string"?f.has(y)?f.get(y):null:y&&typeof y=="object"&&typeof y.id=="string"?f.has(y.id)?f.get(y.id):y:null).filter(y=>y!==null);if(u?.order){let y=Object.entries(u.order);S=S.sort((k,N)=>{for(let[T,C]of y){let $=String(k[T]??""),P=String(N[T]??""),M=$.localeCompare(P);if(M!==0)return C==="DESC"?-M:M}return 0})}if(u?.offset!=null||u?.limit!=null){let y=u.offset??0,k=u.limit!=null?y+u.limit:void 0;S=S.slice(y,k)}s.maxCount===1?(S.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${S.length} values found; keeping the last`),b[a]=S.length>0?S[S.length-1]:null):b[a]=S}else typeof v=="string"&&f.has(v)?b[a]=f.get(v):v&&typeof v=="object"&&typeof v.id=="string"&&(b[a]=f.has(v.id)?f.get(v.id):v)}if(l){let b=Array.from(f.values());await c.hydrateRelations(b,t,l)}}}static async queryToSurrealQL(e,t){let n=this.getModelMetadata(),{where:i,order:a,offset:o,limit:s}=t,c=[];if(t.parent){let d=sa(t.parent,this);c.push(`count(<-link[WHERE in.uri = ${this.formatSurrealValue(t.parent.id)} AND predicate = '${Y(d)}']) > 0`)}for(let[d,f]of Object.entries(n.properties))if(f.required){if(f.getter)continue;f.flag&&f.initial?c.push(`count(->link[WHERE predicate = '${Y(f.predicate)}' AND out.uri = '${Y(f.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${Y(f.predicate)}']) > 0`)}if(c.length===0){for(let[d,f]of Object.entries(n.properties))if(f.initial){f.flag?c.push(`count(->link[WHERE predicate = '${Y(f.predicate)}' AND out.uri = '${Y(f.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${Y(f.predicate)}']) > 0`);break}}if(c.length===0){let d=[];for(let[,f]of Object.entries(n.properties))f.predicate&&d.push(`predicate = '${Y(f.predicate)}'`);if(n.relations)for(let[,f]of Object.entries(n.relations))f.predicate&&d.push(`predicate = '${Y(f.predicate)}'`);d.length>0&&c.push(`count(->link[WHERE (${d.join(" OR ")})]) > 0`)}let u=this.buildGraphTraversalWhereClause(n,i),l=[];return l.push(...c),u&&l.push(u),l.push("count(->link) > 0"),`
|
|
1566
1566
|
SELECT
|
|
1567
1567
|
id AS source,
|
|
1568
1568
|
uri AS source_uri,
|
|
@@ -1570,25 +1570,25 @@ SELECT
|
|
|
1570
1570
|
FROM node
|
|
1571
1571
|
WHERE ${l.join(" AND ")}
|
|
1572
1572
|
FETCH links
|
|
1573
|
-
`.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let c=Zt(this)[i],u=c?.kind==="belongsToOne"||c?.kind==="belongsToMany";if(c){let f=
|
|
1574
|
-
`)}static buildSurrealSelectFieldsWithAggregation(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=
|
|
1575
|
-
`)}static formatSurrealValue(e){return
|
|
1573
|
+
`.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let c=Zt(this)[i],u=c?.kind==="belongsToOne"||c?.kind==="belongsToMany";if(c){let f=Y(c.predicate);if(Array.isArray(a)){let m=a.map(h=>this.formatSurrealValue(h)).join(", ");u?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri IN [${m}]]) > 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri IN [${m}]]) > 0`)}else if(typeof a=="object"&&a!==null){let m=a;if(m.not!==void 0)if(Array.isArray(m.not)){let h=m.not.map(g=>this.formatSurrealValue(g)).join(", ");u?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri IN [${h}]]) = 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri IN [${h}]]) = 0`)}else u?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri = ${this.formatSurrealValue(m.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri = ${this.formatSurrealValue(m.not)}]) = 0`)}else u?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri = ${this.formatSurrealValue(a)}]) > 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri = ${this.formatSurrealValue(a)}]) > 0`);continue}let l=e.properties[i];if(!l)continue;let p=Y(l.predicate),d=l.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let f=a.map(m=>this.formatSurrealValue(m)).join(", ");n.push(`count(->link[WHERE predicate = '${p}' AND ${d} IN [${f}]]) > 0`)}else if(typeof a=="object"&&a!==null){let f=a;if(f.not!==void 0)if(Array.isArray(f.not)){let h=f.not.map(g=>this.formatSurrealValue(g)).join(", ");n.push(`count(->link[WHERE predicate = '${p}' AND ${d} IN [${h}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${p}' AND ${d} = ${this.formatSurrealValue(f.not)}]) = 0`);(f.gt!==void 0||f.gte!==void 0||f.lt!==void 0||f.lte!==void 0||f.between!==void 0||f.contains!==void 0)&&n.push(`count(->link[WHERE predicate = '${p}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${p}' AND ${d} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=Y(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(p=>this.formatSurrealValue(p)).join(", ");n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${l}])`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let d=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${d}])`)}else n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)})`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return n.join(" AND ")}static buildSurrealSelectFields(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=Y(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=n||Object.keys(e.relations);for(let s of o){let c=e.relations[s];if(!c)continue;let u=Y(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return i.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),i.join(`,
|
|
1574
|
+
`)}static buildSurrealSelectFieldsWithAggregation(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=Y(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.relations);for(let s of o){let c=e.relations[s];if(!c)continue;let u=Y(c.predicate);i.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS createdAt"),i.push("array::last(timestamp) AS updatedAt"),i.join(`,
|
|
1575
|
+
`)}static formatSurrealValue(e){return vi(e)}static async instancesFromPrologResult(e,t,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=t?.properties||[],o=(await Promise.all(n[0].AllInstances.map(async([c,u,l,p,d])=>{try{let f=new this(e,c);i.length&&Object.keys(f).forEach(h=>{!i.includes(h)&&h!=="createdAt"&&h!=="updatedAt"&&h!=="author"&&h!=="id"&&h!=="baseExpression"&&delete f[h]});let m=[...u,...l,["createdAt",p],["author",d]];return await jt.assignValuesToInstance(e,f,m),f}catch(f){return console.error(`Failed to process instance ${c}:`,f),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await this.hydrateRelations(o,e,t.include);let s=t.include;for(let c of o)c.takeSnapshot(s);return{results:o,totalCount:n[0].TotalCount}}static async instancesFromSurrealResult(e,t,n){if(!n||n.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),a=t?.properties||[],o=[];for(let h of n){let g;try{if(g=h.source_uri,!g)continue;let b=h.links||[],v=new this(e,g);if(await this.hydrateFromLinks(v,b,i,e,a.length>0?a:void 0),a.length>0){let S=new Set(a);for(let y of Object.keys(i.properties))S.has(y)||delete v[y];for(let y of Object.keys(i.relations))!S.has(y)&&!(t.include&&y in t.include)&&delete v[y];for(let y of["author","createdAt","updatedAt"])S.has(y)||delete v[y]}o.push(v)}catch(b){console.error(`Failed to process SurrealDB instance ${g}:`,b)}}let s=Zt(this),c=Object.entries(s).filter(([h,g])=>(g.kind==="belongsToOne"||g.kind==="belongsToMany")&&(a.length===0||a.includes(h)));c.length>0&&o.length>0&&await Promise.all(o.map(async h=>{for(let[g,b]of c){let S=(await e.get(new le({predicate:b.predicate,target:h.id}))).filter(y=>y.data.target===h.id).map(y=>y.data.source);b.kind==="belongsToOne"?h[g]=S.length>0?S[S.length-1]:null:h[g]=S}}));let u=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let h of o)await this.evaluateCustomGettersForInstance(h,e,i,u);let l=o;t.where&&(l=o.filter(h=>{for(let[g,b]of Object.entries(t.where))if(g!=="base"){if(g==="author"||g==="timestamp"){if(!this.matchesCondition(h[g],b))return!1;continue}if(typeof b=="object"&&b!==null&&!Array.isArray(b)){let v=b;if((v.gt!==void 0||v.gte!==void 0||v.lt!==void 0||v.lte!==void 0||v.between!==void 0||v.contains!==void 0)&&!this.matchesCondition(h[g],b))return!1}}return!0}));let p=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(p){let h=Object.entries(p);l.sort((g,b)=>{for(let[v,S]of h){let y=g[v],k=b[v];if(y===void 0&&k===void 0)continue;if(y===void 0)return S==="ASC"?1:-1;if(k===void 0)return S==="ASC"?-1:1;let N=0;if(typeof y=="number"&&typeof k=="number"?N=y-k:typeof y=="string"&&typeof k=="string"?N=y.localeCompare(k):N=String(y).localeCompare(String(k)),N!==0)return S==="DESC"?-N:N}return 0})}let d=l.length,f=l;if(t.offset!==void 0||t.limit!==void 0){let h=t.offset||0,g=t.limit?h+t.limit:void 0;f=l.slice(h,g)}t.include&&f.length>0&&await this.hydrateRelations(f,e,t.include);let m=t.include;for(let h of f)h.takeSnapshot(m);return{results:f,totalCount:d}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let n=t;if(n.not!==void 0)return Array.isArray(n.not)?!n.not.includes(e):e!==n.not;if(n.between!==void 0&&Array.isArray(n.between)&&n.between.length===2)return e>=n.between[0]&&e<=n.between[1];let i=!0;return n.gt!==void 0&&(i=i&&e>n.gt),n.gte!==void 0&&(i=i&&e>=n.gte),n.lt!==void 0&&(i=i&&e<n.lt),n.lte!==void 0&&(i=i&&e<=n.lte),n.contains!==void 0&&(typeof e=="string"?i=i&&e.includes(String(n.contains)):Array.isArray(e)?i=i&&e.includes(n.contains):i=!1),i}return e===t}static async findAll(e,t={},n=!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(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let i=await this.queryToProlog(e,t),a=await e.infer(i),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findOne(e,t={},n=!0){let i={...t,limit:1};return(await this.findAll(e,i,n))[0]??null}static async findAllAndCount(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i);return await this.instancesFromSurrealResult(e,t,a)}else{let i=await this.queryToProlog(e,t),a=await e.infer(i);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,n,i,a=!0){let o={...i||{},limit:t,offset:t*(n-1),count:!0};if(a){let s=await this.queryToSurrealQL(e,o),c=await e.querySurrealDB(s),{results:u,totalCount:l}=await this.instancesFromSurrealResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:n}}else{let s=await this.queryToProlog(e,o),c=await e.infer(s),{results:u,totalCount:l}=await this.instancesFromPrologResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:n}}}static async countQueryToProlog(e,t={},n){let{where:i}=t,a=n||await this.getClassName(e),o=t.parent?sa(t.parent,this):void 0,s=[xd(),Ed(t.parent,o),Id(i)],c=[kd(!0),Td(),Ad(),Od()];return`
|
|
1576
1576
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1577
1577
|
subject_class("${a}", SubjectClass),
|
|
1578
1578
|
instance(SubjectClass, Base),
|
|
1579
1579
|
${s.filter(l=>l).join(", ")}
|
|
1580
1580
|
), UnsortedInstances),
|
|
1581
1581
|
${c.filter(l=>l).join(", ")}
|
|
1582
|
-
`}static async countQueryToSurrealQL(e,t){let n={...t};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,n){let i=this.getPropertyMetadata(e);if(!i){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,i),o=i.resolveLanguage;t==null||t===""||(o&&(t=await this._perspective.createExpression(t,o)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],n))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,n){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(o=>({name:"value",value:this.resolveRelationId(o)})),n):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async addRelationValue(e,t,n){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(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async removeRelationValue(e,t,n){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(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}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 n=this.constructor.getModelMetadata(),i=Object.values(n.properties).some(
|
|
1582
|
+
`}static async countQueryToSurrealQL(e,t){let n={...t};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,n){let i=this.getPropertyMetadata(e);if(!i){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,i),o=i.resolveLanguage;t==null||t===""||(o&&(t=await this._perspective.createExpression(t,o)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],n))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,n){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(o=>({name:"value",value:this.resolveRelationId(o)})),n):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async addRelationValue(e,t,n){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(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async removeRelationValue(e,t,n){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(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}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 n=this.constructor.getModelMetadata(),i=Object.values(n.properties).some(o=>o.required||o.flag||o.initial!==void 0),a=[];if(i){let o={};for(let[c,u]of Object.entries(this))if(u!=null&&!(Array.isArray(u)&&u.length>0)&&!u?.action){let l=n.properties[c];if(l?.resolveLanguage&&l.resolveLanguage!=="literal"&&typeof u=="object"){a.push(c);continue}o[c]=u}let s=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(s,this._baseExpression,o,e)}await this.innerUpdate(!i,e);for(let o of a){let s=this[o];s!=null&&await this.setProperty(o,s,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),n={},i=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of i){let o=this[a];o!=null&&a!=="author"&&a!=="timestamp"&&(n[a]=o)}return n}async innerUpdate(e=!0,t){let n=this.constructor;this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy());let i=this._snapshot?new Set(this.changedFields()):null,a=n.getModelMetadata(),o=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),s=Object.entries(this);for(let[c,u]of s){if(!o.has(c)||i&&!i.has(c))continue;let l=a.relations[c];if(!(l&&(l.getter||l.target&&l.filter!==!1&&Object.entries(a.relations).some(([d,f])=>d!==c&&f.predicate===l.predicate)))&&u!=null){if(u?.action)switch(u.action){case"setter":await this.setRelationValues(c,u.value,t);break;case"adder":await this.addRelationValue(c,u.value,t);break;case"remover":await this.removeRelationValue(c,u.value,t);break;default:await this.setRelationValues(c,u.value,t);break}else if(Array.isArray(u))await this.setRelationValues(c,u,t);else if(u!=null&&u!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,u,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(i=>i.required||i.flag||i.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let i=new Set;for(let s of Object.values(t.properties))s.predicate&&i.add(s.predicate);for(let s of Object.values(t.relations))s.predicate&&i.add(s.predicate);let o=(await this._perspective.get(new le({source:this._baseExpression}))).filter(s=>s.data.predicate&&i.has(s.data.predicate));o.length>0&&await this._perspective.removeLinks(o,e)}catch(i){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,i)}try{let i=await this._perspective.get(new le({target:this._baseExpression}));i.length>0&&await this._perspective.removeLinks(i,e)}catch(i){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,i)}}static async create(e,t={},n){let i=new this(e);if(Object.assign(i,t),n?.parent&&!n?.batchId){let a=await e.createBatch();await i.save(a);let o=sa(n.parent,this),s=new pt({source:n.parent.id,predicate:o,target:i.id});return await e.add(s,"shared",a),await e.commitBatch(a),await i.get(),i}if(await i.save(n?.batchId),n?.parent){let a=sa(n.parent,this),o=new pt({source:n.parent.id,predicate:a,target:i.id});await e.add(o,"shared",n?.batchId)}return i}static async update(e,t,n){let i=new this(e,t);return await i.get(),Object.assign(i,n),await i.save(),i}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 n=await e.createBatch(),i=await t({batchId:n});return await e.commitBatch(n),i}static query(e,t){return new Yu(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let n=this.determineNamespace(e,t),i=class extends jt{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=t.name,i.prototype.className=t.name;let a={},o={};if(e.properties)for(let[c,u]of Object.entries(e.properties)){let l=this.determinePredicate(e,c,u,n,t),p=e.required?.includes(c)||!1,d=fl(u.type);if(Dd(u)){o[c]={through:l,local:this.getPropertyOption(c,u,t,"local")},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:[]});let m=`add${hs(c)}`,h=`remove${hs(c)}`,g=`set${hs(c)}`;i.prototype[m]=function(){},i.prototype[h]=function(){},i.prototype[g]=function(){}}else{let m=this.getPropertyOption(c,u,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let h=this.getPropertyOption(c,u,t,"local"),g=this.getPropertyOption(c,u,t,"readOnly");if(g===void 0){let S=u["x-ad4m"]?.writable;g=S!==void 0?!S:!1}let b=!g,v=this.getPropertyOption(c,u,t,"initial");if(Rd(u)&&!m&&(m="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&JS(u)&&(m="literal"),m==null&&(m="literal"),p&&!v&&(Rd(u)?v="literal://json:{}":v="ad4m://undefined"),a[c]={through:l,required:p,writable:b,...m&&{resolveLanguage:m},...h!==void 0&&{local:h},...v&&{initial:v}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),b){let S=Is(c);i.prototype[S]=function(){}}}}for(let[c,u]of Object.entries(a))Ry(i,c,u);for(let[c,u]of Object.entries(o))Cy(i,c,{predicate:u.through||"",kind:"hasMany",...u.getter!==void 0&&{getter:u.getter},...u.local!==void 0&&{local:u.local}});return i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=t,Py({name:t.name})(i),i}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let i=new URL(e.$id).pathname.split("/").filter(a=>a);if(i.length>0)return`${i[i.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
|
|
1583
1583
|
- options.namespace
|
|
1584
1584
|
- schema["x-ad4m"].namespace
|
|
1585
1585
|
- schema.title
|
|
1586
|
-
- valid schema.$id`)}static determinePredicate(e,t,n,i,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=
|
|
1586
|
+
- valid schema.$id`)}static determinePredicate(e,t,n,i,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=Nd(i),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=Nd(i);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:t["x-ad4m"]?.[i]!==void 0?t["x-ad4m"][i]:n[i]!==void 0?n[i]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};jt.classNamesByClass=new WeakMap;var Yu=class{constructor(e,t,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,n&&(this.queryParams=n)}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,n){let i=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 o=e.constructor;return this.queryParams.parent={id:i,model:o,field:t.field},this}let a=n?.field;if(typeof t=="string")this.queryParams.parent={id:i,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:i,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:i,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),n=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,n))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),n=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,n))}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 n=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(n);let i=async o=>{let{results:s}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let n=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(n);let i=async o=>{let{results:s}=await t.instancesFromPrologResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);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:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return n}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 n=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(i),i}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let n=async a=>{let o=a?.[0]?.TotalCount||0;e(o)};this.currentSubscription.onResult(n);let i=this.currentSubscription.result?.[0]?.TotalCount||0;return e(i),i}}async paginate(e,t){let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let i=await this.ctor.queryToSurrealQL(this.perspective,n),a=await this.perspective.querySurrealDB(i),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let i=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName),a=await this.perspective.infer(i),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,i);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:p,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:p,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}}};function pl(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function YS(r,e){let t=e.properties,n=Object.values(t).filter(o=>o.flag&&o.predicate&&o.initial);if(n.length>0){let o=n.map(s=>`triple(X, '${s.predicate}', '${s.initial}')`).join(`,
|
|
1587
1587
|
`);return`${r}(X) :-
|
|
1588
1588
|
${o}.`}let i=Object.values(t).filter(o=>o.required&&o.predicate&&!o.flag);if(i.length>0){let o=i.map(s=>`triple(X, '${s.predicate}', _)`).join(`,
|
|
1589
1589
|
`);return`${r}(X) :-
|
|
1590
1590
|
${o}.`}let a=Object.values(t).filter(o=>o.predicate).map(o=>o.predicate);if(e.relations)for(let o of Object.values(e.relations))o.predicate&&a.push(o.predicate);if(a.length>0){let o=a.map(s=>`triple(X, '${s}', _)`).join(` ;
|
|
1591
1591
|
`);return`${r}(X) :-
|
|
1592
|
-
(${o}).`}return null}function
|
|
1593
|
-
`)}var
|
|
1592
|
+
(${o}).`}return null}function ZS(r,e){return e.flag||!e.predicate?null:`${`${r}_${pl(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function XS(r,e){if(!e.predicate)return null;let t=`${r}_${pl(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 iA(r){let e=r.getModelMetadata(),t=pl(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=YS(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>ZS(t,s)).filter(s=>s!==null);a.length>0&&(n.push(""),n.push("% Field getters"),n.push(...a));let o=Object.values(e.relations).map(s=>XS(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
|
|
1593
|
+
`)}var ew=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function dl(r,{include:e,exclude:t}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):t?!t.some(a):!0};for(let[i,a]of ew(r.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var tw=12e3,hl=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;dl(this),this.options=t,this.port=t.port||parseInt(Mo("ad4m-port"))||tw,this.url=t.url||Mo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Mo("ad4m-token")||"",this.embedded=fp(),this.embedded&&this.initializeEmbeddedMode()}connect(){return _e(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,n)=>{let i=setTimeout(()=>{n(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(i),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(i),n(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(i),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(i),n(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield pp(this.url),dr("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return _e(this,null,function*(){return this.notifyConnectionChange("connecting"),this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=iu({url:this.url,connectionParams:()=>_e(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:t=>_e(this,null,function*(){if(!(t.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(n){console.error("[Ad4m Connect] Reconnection failed:",n),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new Va(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new ru({link:new lp(t),cache:new Do({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return _e(this,null,function*(){let i=iu({url:t,connectionParams:()=>_e(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new Va(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return _e(this,null,function*(){try{return console.log("[Ad4m Connect] Checking authentication status..."),(yield this.ad4mClient.agent.isLocked())?(console.log("[Ad4m Connect] Agent wallet is locked"),this.notifyAuthChange("locked")):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){console.error("[Ad4m Connect] Authentication check failed:",t);let n="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===n?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",na("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return _e(this,null,function*(){console.log("[Ad4m Connect] Disconnecting..."),this.wsClient&&(this.wsClient.dispose(),this.wsClient=null),this.apolloClient&&(this.apolloClient.stop(),this.apolloClient=null),this.ad4mClient=void 0,this.token="",na("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>_e(this,null,function*(){var n;if(((n=t.data)==null?void 0:n.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:i,token:a}=t.data;if(i==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(i,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${i} (must be a positive integer)`);console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let s=a!=null&&typeof a=="string"?a:"";try{this.port=o,this.token=s,this.url=`ws://localhost:${o}/graphql`,dr("ad4m-port",o.toString()),s?dr("ad4m-token",s):na("ad4m-token"),dr("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return _e(this,null,function*(){return t&&(this.token="",na("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return _e(this,null,function*(){if(!this.requestId)return console.error("[Ad4m Connect] Cannot verify code: requestId is missing. Call requestCapability() first to obtain a requestId."),!1;try{let n=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=n,dr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return _e(this,null,function*(){try{return yield this.withTempClient(this.url,t=>_e(this,null,function*(){return yield t.runtime.info()})),!0}catch(t){return console.error("[Ad4m Connect] Failed to verify AD4M API:",t),!1}})}isMultiUser(){return _e(this,null,function*(){try{return yield this.withTempClient(this.url,t=>_e(this,null,function*(){return yield t.runtime.multiUserEnabled()}))}catch(t){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",t),!1}})}submitEmail(t){return _e(this,null,function*(){try{return yield this.withTempClient(this.url,n=>_e(this,null,function*(){return yield n.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(n){return{success:!1,message:n.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,n){return _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(this,null,function*(){return yield a.agent.verifyEmailCode(t,n,"login")}));return this.token=i,dr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Email code verification failed:",i),!1}})}loginWithPassword(t,n){return _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(this,null,function*(){return yield a.agent.loginUser(t,n)}));return this.token=i,dr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(t,n){return _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(this,null,function*(){let o=yield a.agent.createUser(t,n);if(o.success)return yield a.agent.loginUser(t,n);throw new Error(o.error||"Failed to create account")}));return this.token=i,dr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Account creation error:",i),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let n=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(n))}}notifyConfigChange(t,n){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:n}}))}};export{hl as default};
|
|
1594
1594
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|