@coasys/ad4m-connect 0.11.2-dev.4 → 0.11.2-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 CHANGED
@@ -1,31 +1,31 @@
1
- var Se=(t,e,r)=>new Promise((n,i)=>{var a=c=>{try{s(r.next(c))}catch(u){i(u)}},o=c=>{try{s(r.throw(c))}catch(u){i(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);s((r=r.apply(t,e)).next())});var zs=function(t,e){return zs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},zs(t,e)};function ke(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var E=function(){return E=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},E.apply(this,arguments)};function Qt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Lt(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(t,e||[])).next())})}function Ft(t,e){var r={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]&&(r=0)),r;)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 r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}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 Sr(t,e,r){if(r||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 t.concat(a||Array.prototype.slice.call(e))}var Ws="Invariant Violation",dl=Object.setPrototypeOf,Dh=dl===void 0?function(t,e){return t.__proto__=e,t}:dl,K=function(t){ke(e,t);function e(r){r===void 0&&(r=Ws);var n=t.call(this,typeof r=="number"?Ws+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Ws,Dh(n,e.prototype),n}return e}(Error);function P(t,e){if(!t)throw new K(e)}var Ya=["debug","log","warn","error","silent"],Gs=Ya.indexOf("log");function Ja(t){return function(){if(Ya.indexOf(t)>=Gs){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Ja("debug"),t.log=Ja("log"),t.warn=Ja("warn"),t.error=Ja("error")})(P||(P={}));function hl(t){var e=Ya[Gs];return Gs=Math.max(0,Ya.indexOf(t)),e}function qe(t){try{return t()}catch{}}var Za=qe(function(){return globalThis})||qe(function(){return window})||qe(function(){return self})||qe(function(){return global})||qe(function(){return qe.constructor("return this")()});var ml="__",yl=[ml,ml].join("DEV");function Nh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Za,yl,{value:qe(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Za[yl]}}var Zr=Nh();function wr(t){try{return t()}catch{}}var Ks=wr(function(){return globalThis})||wr(function(){return window})||wr(function(){return self})||wr(function(){return global})||wr(function(){return wr.constructor("return this")()}),Hs=!1;function Ch(){Ks&&!wr(function(){return"production"})&&!wr(function(){return process})&&(Object.defineProperty(Ks,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Hs=!0)}Ch();function Js(){Hs&&(delete Ks.process,Hs=!1)}var iS=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",aS=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",gl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Re=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 Ys(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Rh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Fi=Rh;function Xa(t){var e=t.prototype.toJSON;typeof e=="function"||Ys(0),t.prototype.inspect=e,Fi&&(t.prototype[Fi]=e)}var vl=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Xa(vl);var bl=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Xa(bl);function Zs(t){return t!=null&&typeof t.kind=="string"}function eo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?eo=function(r){return typeof r}:eo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},eo(t)}var Ph=10,_l=2;function $i(t){return to(t,[])}function to(t,e){switch(eo(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Lh(t,e);default:return String(t)}}function Lh(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Mh(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:to(i,r)}else if(Array.isArray(t))return $h(t,r);return Fh(t,r)}function Fh(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>_l)return"["+jh(t)+"]";var n=r.map(function(i){var a=to(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function $h(t,e){if(t.length===0)return"[]";if(e.length>_l)return"[Array]";for(var r=Math.min(Ph,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(to(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Mh(t){var e=t[String(Fi)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function jh(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function Mi(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function Sl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Uh(t,e,r){return e&&Sl(t.prototype,e),r&&Sl(t,r),t}var ro=function(){function t(e){var r=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"||Mi(0,"Body must be a string. Received: ".concat($i(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Mi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Mi(0,"column in locationOffset is 1-indexed and must be positive.")}return Uh(t,[{key:gl,get:function(){return"Source"}}]),t}();function wl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
1
+ var Se=(t,e,r)=>new Promise((n,i)=>{var a=c=>{try{s(r.next(c))}catch(u){i(u)}},o=c=>{try{s(r.throw(c))}catch(u){i(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);s((r=r.apply(t,e)).next())});var zs=function(t,e){return zs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},zs(t,e)};function Ae(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var T=function(){return T=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},T.apply(this,arguments)};function Qt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Ft(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(t,e||[])).next())})}function Lt(t,e){var r={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]&&(r=0)),r;)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 r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}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 Sr(t,e,r){if(r||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 t.concat(a||Array.prototype.slice.call(e))}var Gs="Invariant Violation",dl=Object.setPrototypeOf,Dh=dl===void 0?function(t,e){return t.__proto__=e,t}:dl,K=function(t){Ae(e,t);function e(r){r===void 0&&(r=Gs);var n=t.call(this,typeof r=="number"?Gs+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Gs,Dh(n,e.prototype),n}return e}(Error);function L(t,e){if(!t)throw new K(e)}var Za=["debug","log","warn","error","silent"],Ws=Za.indexOf("log");function Ya(t){return function(){if(Za.indexOf(t)>=Ws){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Ya("debug"),t.log=Ya("log"),t.warn=Ya("warn"),t.error=Ya("error")})(L||(L={}));function hl(t){var e=Za[Ws];return Ws=Math.max(0,Za.indexOf(t)),e}function Be(t){try{return t()}catch{}}var Xa=Be(function(){return globalThis})||Be(function(){return window})||Be(function(){return self})||Be(function(){return global})||Be(function(){return Be.constructor("return this")()});var ml="__",yl=[ml,ml].join("DEV");function Nh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Xa,yl,{value:Be(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Xa[yl]}}var Zr=Nh();function wr(t){try{return t()}catch{}}var Ks=wr(function(){return globalThis})||wr(function(){return window})||wr(function(){return self})||wr(function(){return global})||wr(function(){return wr.constructor("return this")()}),Hs=!1;function Ch(){Ks&&!wr(function(){return"production"})&&!wr(function(){return process})&&(Object.defineProperty(Ks,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Hs=!0)}Ch();function Js(){Hs&&(delete Ks.process,Hs=!1)}var iS=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",aS=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",gl=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 Ys(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Rh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Li=Rh;function eo(t){var e=t.prototype.toJSON;typeof e=="function"||Ys(0),t.prototype.inspect=e,Li&&(t.prototype[Li]=e)}var vl=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();eo(vl);var bl=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();eo(bl);function Zs(t){return t!=null&&typeof t.kind=="string"}function to(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?to=function(r){return typeof r}:to=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},to(t)}var Ph=10,_l=2;function $i(t){return ro(t,[])}function ro(t,e){switch(to(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Fh(t,e);default:return String(t)}}function Fh(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Mh(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:ro(i,r)}else if(Array.isArray(t))return $h(t,r);return Lh(t,r)}function Lh(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>_l)return"["+jh(t)+"]";var n=r.map(function(i){var a=ro(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function $h(t,e){if(t.length===0)return"[]";if(e.length>_l)return"[Array]";for(var r=Math.min(Ph,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(ro(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Mh(t){var e=t[String(Li)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function jh(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function Mi(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function Sl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Uh(t,e,r){return e&&Sl(t.prototype,e),r&&Sl(t,r),t}var no=function(){function t(e){var r=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"||Mi(0,"Body must be a string. Received: ".concat($i(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Mi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Mi(0,"column in locationOffset is 1-indexed and must be positive.")}return Uh(t,[{key:gl,get:function(){return"Source"}}]),t}();function wl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
2
2
  `)===-1,i=t[0]===" "||t[0]===" ",a=t[t.length-1]==='"',o=t[t.length-1]==="\\",s=!n||a||o||r,c="";return s&&!(n&&i)&&(c+=`
3
3
  `+e),c+=e?t.replace(/\n/g,`
4
4
  `+e):t,s&&(c+=`
5
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var qh={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"]},Xr=Object.freeze({});function et(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qh,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],p=[],f=t;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=p.length===0?void 0:d[d.length-1],c=l,l=p.pop(),m){if(i)c=c.slice();else{for(var g={},w=0,b=Object.keys(c);w<b.length;w++){var S=b[w];g[S]=c[S]}c=g}for(var _=0,A=0;A<s.length;A++){var R=s[A][0],I=s[A][1];i&&(R-=_),i&&I===null?(c.splice(R,1),_++):c[R]=I}}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&&d.push(u)}var C=void 0;if(!Array.isArray(c)){if(!Zs(c))throw new Error("Invalid AST Node: ".concat($i(c),"."));var F=Xs(e,c.kind,h);if(F){if(C=F.call(e,c,u,l,d,p),C===Xr)break;if(C===!1){if(!h){d.pop();continue}}else if(C!==void 0&&(s.push([u,C]),!h))if(Zs(C))c=C;else{d.pop();continue}}}if(C===void 0&&m&&s.push([u,c]),h)d.pop();else{var L;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(L=r[c.kind])!==null&&L!==void 0?L:[],o=-1,s=[],l&&p.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function Xs(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var a=r?t.leave:t.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Gn(t){return et(t,{leave:Vh})}var Bh=80,Vh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return $(e.definitions,`
5
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var qh={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"]},Xr=Object.freeze({});function et(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qh,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],p=[],f=t;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=p.length===0?void 0:d[d.length-1],c=l,l=p.pop(),m){if(i)c=c.slice();else{for(var g={},_=0,S=Object.keys(c);_<S.length;_++){var w=S[_];g[w]=c[w]}c=g}for(var b=0,A=0;A<s.length;A++){var R=s[A][0],E=s[A][1];i&&(R-=b),i&&E===null?(c.splice(R,1),b++):c[R]=E}}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&&d.push(u)}var C=void 0;if(!Array.isArray(c)){if(!Zs(c))throw new Error("Invalid AST Node: ".concat($i(c),"."));var F=Xs(e,c.kind,h);if(F){if(C=F.call(e,c,u,l,d,p),C===Xr)break;if(C===!1){if(!h){d.pop();continue}}else if(C!==void 0&&(s.push([u,C]),!h))if(Zs(C))c=C;else{d.pop();continue}}}if(C===void 0&&m&&s.push([u,c]),h)d.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(P=r[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&p.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function Xs(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var a=r?t.leave:t.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Wn(t){return et(t,{leave:Vh})}var Bh=80,Vh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return $(e.definitions,`
6
6
 
7
7
  `)+`
8
- `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=Ie("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:$([r,$([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+Ie(" = ",i)+Ie(" ",$(a," "))},SelectionSet:function(e){var r=e.selections;return Mt(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ie("",r,": ")+n,c=s+Ie("(",$(i,", "),")");return c.length>Bh&&(c=s+Ie(`(
9
- `,no($(i,`
8
+ `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=ke("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:$([r,$([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+ke(" = ",i)+ke(" ",$(a," "))},SelectionSet:function(e){var r=e.selections;return Mt(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=ke("",r,": ")+n,c=s+ke("(",$(i,", "),")");return c.length>Bh&&(c=s+ke(`(
9
+ `,io($(i,`
10
10
  `)),`
11
- )`)),$([c,$(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+Ie(" ",$(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",Ie("on ",r),$(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(Ie("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(Ie("",$(a," ")," "))+o},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?wl(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+$(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+$(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+Ie("(",$(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:$t(function(t){var e=t.directives,r=t.operationTypes;return $(["schema",$(e," "),Mt(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:$t(function(t){var e=t.name,r=t.directives;return $(["scalar",e,$(r," ")]," ")}),ObjectTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["type",e,Ie("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),FieldDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(El(r)?Ie(`(
12
- `,no($(r,`
11
+ )`)),$([c,$(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+ke(" ",$(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",ke("on ",r),$(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(ke("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(ke("",$(a," ")," "))+o},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?wl(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+$(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+$(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+ke("(",$(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:$t(function(t){var e=t.directives,r=t.operationTypes;return $(["schema",$(e," "),Mt(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:$t(function(t){var e=t.name,r=t.directives;return $(["scalar",e,$(r," ")]," ")}),ObjectTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["type",e,ke("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),FieldDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(El(r)?ke(`(
12
+ `,io($(r,`
13
13
  `)),`
14
- )`):Ie("(",$(r,", "),")"))+": "+n+Ie(" ",$(i," "))}),InputValueDefinition:$t(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return $([e+": "+r,Ie("= ",n),$(i," ")]," ")}),InterfaceTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["interface",e,Ie("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),UnionTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.types;return $(["union",e,$(r," "),n&&n.length!==0?"= "+$(n," | "):""]," ")}),EnumTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.values;return $(["enum",e,$(r," "),Mt(n)]," ")}),EnumValueDefinition:$t(function(t){var e=t.name,r=t.directives;return $([e,$(r," ")]," ")}),InputObjectTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.fields;return $(["input",e,$(r," "),Mt(n)]," ")}),DirectiveDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(El(r)?Ie(`(
15
- `,no($(r,`
14
+ )`):ke("(",$(r,", "),")"))+": "+n+ke(" ",$(i," "))}),InputValueDefinition:$t(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return $([e+": "+r,ke("= ",n),$(i," ")]," ")}),InterfaceTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["interface",e,ke("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),UnionTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.types;return $(["union",e,$(r," "),n&&n.length!==0?"= "+$(n," | "):""]," ")}),EnumTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.values;return $(["enum",e,$(r," "),Mt(n)]," ")}),EnumValueDefinition:$t(function(t){var e=t.name,r=t.directives;return $([e,$(r," ")]," ")}),InputObjectTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.fields;return $(["input",e,$(r," "),Mt(n)]," ")}),DirectiveDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(El(r)?ke(`(
15
+ `,io($(r,`
16
16
  `)),`
17
- )`):Ie("(",$(r,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return $(["extend schema",$(r," "),Mt(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return $(["extend scalar",r,$(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend type",r,Ie("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend interface",r,Ie("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return $(["extend union",r,$(n," "),i&&i.length!==0?"= "+$(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return $(["extend enum",r,$(n," "),Mt(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return $(["extend input",r,$(n," "),Mt(i)]," ")}};function $t(t){return function(e){return $([e.description,t(e)],`
18
- `)}}function $(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function Mt(t){return Ie(`{
19
- `,no($(t,`
17
+ )`):ke("(",$(r,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return $(["extend schema",$(r," "),Mt(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return $(["extend scalar",r,$(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend type",r,ke("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend interface",r,ke("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return $(["extend union",r,$(n," "),i&&i.length!==0?"= "+$(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return $(["extend enum",r,$(n," "),Mt(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return $(["extend input",r,$(n," "),Mt(i)]," ")}};function $t(t){return function(e){return $([e.description,t(e)],`
18
+ `)}}function $(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function Mt(t){return ke(`{
19
+ `,io($(t,`
20
20
  `)),`
21
- }`)}function Ie(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function no(t){return Ie(" ",t.replace(/\n/g,`
21
+ }`)}function ke(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function io(t){return ke(" ",t.replace(/\n/g,`
22
22
  `))}function Qh(t){return t.indexOf(`
23
- `)!==-1}function El(t){return t!=null&&t.some(Qh)}function ji(t){return t.kind===Re.FIELD||t.kind===Re.FRAGMENT_SPREAD||t.kind===Re.INLINE_FRAGMENT}function xl(){return typeof ro=="function"?Js():Js()}function em(){__DEV__?P(typeof Zr=="boolean",Zr):P(typeof Zr=="boolean",39)}xl();em();function sr(t,e){var r=t.directives;return!r||!r.length?!0:Tl(r).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__?P(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):P(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Kn(t,e,r){var n=new Set(t),i=n.size;return et(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return Xr}}),r?!n.size:n.size<i}function ec(t){return t&&Kn(["client","export"],t,!0)}function tm(t){var e=t.name.value;return e==="skip"||e==="include"}function Tl(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!tm(r)){var n=r.arguments,i=r.name.value;__DEV__?P(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):P(n&&n.length===1,41);var a=n[0];__DEV__?P(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):P(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:r,ifArgument:a})}}),e}function tc(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new K("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 K(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?P(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):P(n.length===1,45),r=n[0].name.value);var i=E(E({},t),{definitions:Sr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function en(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function tn(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return __DEV__?P(n,"No fragment named ".concat(r)):P(n,46),n||null}default:return null}}function oe(t){return t!==null&&typeof t=="object"}function zt(t){return{__ref:String(t)}}function te(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function rc(t){return oe(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function rm(t){return t.kind==="StringValue"}function nm(t){return t.kind==="BooleanValue"}function im(t){return t.kind==="IntValue"}function am(t){return t.kind==="FloatValue"}function om(t){return t.kind==="Variable"}function sm(t){return t.kind==="ObjectValue"}function cm(t){return t.kind==="ListValue"}function um(t){return t.kind==="EnumValue"}function lm(t){return t.kind==="NullValue"}function Er(t,e,r,n){if(im(r)||am(r))t[e.value]=Number(r.value);else if(nm(r)||rm(r))t[e.value]=r.value;else if(sm(r)){var i={};r.fields.map(function(o){return Er(i,o.name,o.value,n)}),t[e.value]=i}else if(om(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(cm(r))t[e.value]=r.values.map(function(o){var s={};return Er(s,e,o,n),s[e.value]});else if(um(r))t[e.value]=r.value;else if(lm(r))t[e.value]=null;else throw __DEV__?new K('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new K(55)}function nc(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Er(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return Er(n,a,o,e)})),qi(t.name.value,n,r)}var fm=["connection","include","skip","client","rest","export"],qi=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(Ui(i),")")}else return r.connection.key;var a=t;if(e){var o=Ui(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){fm.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Ui(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Ui;return Ui=t,e}}),Ui=function(e){return JSON.stringify(e,pm)};function pm(t,e){return oe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function cr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return Er(r,i,a,e)}),r}return null}function It(t){return t.alias?t.alias.value:t.name.value}function Bi(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(gt(a)){if(a.name.value==="__typename")return t[It(a)]}else{var o=Bi(t,tn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function gt(t){return t.kind==="Field"}function ic(t){return t.kind==="InlineFragment"}function Hn(t){__DEV__?P(t&&t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):P(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new K('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new K(48);return r});return __DEV__?P(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):P(e.length<=1,49),t}function Wt(t){return Hn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Jn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function rn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Vi(t){var e=Wt(t);return __DEV__?P(e&&e.operation==="query","Must contain a query definition."):P(e&&e.operation==="query",50),e}function ac(t){__DEV__?P(t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):P(t.kind==="Document",51),__DEV__?P(t.definitions.length<=1,"Fragment must have exactly one definition."):P(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?P(e.kind==="FragmentDefinition","Must be a fragment definition."):P(e.kind==="FragmentDefinition",53),e}function nn(t){Hn(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];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 K("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new K(54)}function an(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Er(e,n.variable.name,n.defaultValue)}),e}var me=Array.isArray;function Fe(t){return Array.isArray(t)&&t.length>0}var Il={kind:Re.FIELD,name:{kind:Re.NAME,value:"__typename"}};function Al(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Re.FRAGMENT_SPREAD&&Al(e[r.name.value],e)})}function dm(t){return Al(Wt(t)||ac(t),en(rn(t)))?null:t}function hm(t){var e=new Set,r=[];return t.forEach(function(n){n.name?e.add(n.name):n.test&&r.push(n.test)}),function(n){return e.has(n.name.value)||r.some(function(i){return i(n)})}}function kl(t){var e=new Map;return function(n){n===void 0&&(n=t);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function oc(t,e){for(var r=kl(""),n=kl(""),i=function(b){for(var S=0,_=void 0;S<b.length&&(_=b[S]);++S)if(!me(_)){if(_.kind===Re.OPERATION_DEFINITION)return r(_.name&&_.name.value);if(_.kind===Re.FRAGMENT_DEFINITION)return n(_.name.value)}return __DEV__&&P.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Re.OPERATION_DEFINITION&&++a;var s=hm(t),c=t.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=et(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,S,_,A,R){var I=i(R);I&&I.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,S,_,A,R){if(u(b.directives))return d=!0,null;var I=i(R);I&&I.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,S,_,A){l.set(JSON.stringify(A),b)},leave:function(b,S,_,A){var R=l.get(JSON.stringify(A));if(b===R)return b;if(a>0&&b.selectionSet.selections.every(function(I){return I.kind===Re.FIELD&&I.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(S){h(n(S)).transitiveVars.forEach(function(_){b.transitiveVars.add(_)})})),b},m=new Set;f.definitions.forEach(function(b){b.kind===Re.OPERATION_DEFINITION?h(r(b.name&&b.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):b.kind===Re.FRAGMENT_DEFINITION&&a===0&&!n(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(n(b)).fragmentSpreads.forEach(function(S){m.add(S)})});var g=function(b){return!!(!m.has(b)||n(b).removed)},w={enter:function(b){if(g(b.name.value))return null}};return dm(et(f,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var S=h(r(b.name&&b.name.value)).transitiveVars;if(S.size<b.variableDefinitions.length)return E(E({},b),{variableDefinitions:b.variableDefinitions.filter(function(_){return S.has(_.variable.name.value)})})}}}}))}var on=Object.assign(function(t){return et(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Re.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return gt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(gt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Sr(Sr([],i,!0),[Il],!1)})}}}}}})},{added:function(t){return t===Il}}),mm={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&P.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 sc(t){return oc([mm],Hn(t))}function cc(t){var e=nn(t),r=e.operation;if(r==="query")return t;var n=et(t,{OperationDefinition:{enter:function(i){return E(E({},i),{operation:"query"})}}});return n}function uc(t){Hn(t);var e=oc([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var ym=Object.prototype.hasOwnProperty;function lc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qi(t)}function Qi(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new lt,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var gm=function(t,e,r){return this.merge(t[r],e[r])},lt=function(){function t(e){e===void 0&&(e=gm),this.reconciler=e,this.isObject=oe,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return oe(r)&&oe(e)?(Object.keys(r).forEach(function(o){if(ym.call(e,o)){var s=e[o];if(r[o]!==s){var c=n.reconciler.apply(n,Sr([e,r,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.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},t}();function vm(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=bm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[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 bm(t,e){if(!!t){if(typeof t=="string")return Ol(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ol(t,e)}}function Ol(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Dl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function hc(t,e,r){return e&&Dl(t.prototype,e),r&&Dl(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var mc=function(){return typeof Symbol=="function"},yc=function(t){return mc()&&Boolean(Symbol[t])},gc=function(t){return yc(t)?Symbol[t]:"@@"+t};mc()&&!yc("observable")&&(Symbol.observable=Symbol("observable"));var _m=gc("iterator"),pc=gc("observable"),Nl=gc("species");function ao(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function zi(t){var e=t.constructor;return e!==void 0&&(e=e[Nl],e===null&&(e=void 0)),e!==void 0?e:ee}function Sm(t){return t instanceof ee}function Yn(t){Yn.log?Yn.log(t):setTimeout(function(){throw t})}function io(t){Promise.resolve().then(function(){try{t()}catch(e){Yn(e)}})}function Cl(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=ao(e,"unsubscribe");r&&r.call(e)}}catch(n){Yn(n)}}function dc(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function wm(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Rl(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Rl(t,e,r){t._state="running";var n=t._observer;try{var i=ao(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(dc(t),i)i.call(n,r);else throw r;break;case"complete":dc(t),i&&i.call(n);break}}catch(a){Yn(a)}t._state==="closed"?Cl(t):t._state==="running"&&(t._state="ready")}function fc(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],io(function(){return wm(t)});return}Rl(t,e,r)}}var Em=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new xm(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(dc(this),Cl(this))},hc(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),xm=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){fc(this._subscription,"next",n)},e.error=function(n){fc(this._subscription,"error",n)},e.complete=function(){fc(this._subscription,"complete")},hc(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),ee=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Em(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[pc]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=ao(n,pc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Sm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(yc("iterator")&&(a=ao(n,_m),a))return new i(function(s){io(function(){if(!s.closed){for(var c=vm(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){io(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")},t.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:t;return new o(function(s){io(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},hc(t,null,[{key:Nl,get:function(){return this}}]),t}();mc()&&Object.defineProperty(ee,Symbol("extensions"),{value:{symbol:pc,hostReportError:Yn},configurable:!0});function vc(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var Zn;typeof self<"u"?Zn=self:typeof window<"u"?Zn=window:typeof global<"u"?Zn=global:typeof module<"u"?Zn=module:Zn=Function("return this")();var Cw=vc(Zn);var Pl=ee.prototype,Ll="@@observable";Pl[Ll]||(Pl[Ll]=function(){return this});var Tm=Object.prototype.toString;function oo(t){return bc(t)}function bc(t,e){switch(Tm.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(i,a){r[a]=bc(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=bc(t[i],e)}),n}default:return t}}function Im(t){var e=new Set([t]);return e.forEach(function(r){oe(r)&&km(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){oe(r[n])&&e.add(r[n])})}),t}function km(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Wi(t){return __DEV__&&Im(t),t}function sn(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function so(t,e,r){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(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(w){--s,i&&i.call(n,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(n,w)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(r,a),complete:function(){c=!0,s||o&&o.call(n)}},p=t.subscribe(d);return function(){return p.unsubscribe()}})}var kt=typeof WeakMap=="function"&&qe(function(){return navigator.product})!=="ReactNative",Fl=typeof WeakSet=="function",_c=typeof Symbol=="function"&&typeof Symbol.for=="function",xr=_c&&Symbol.asyncIterator,zw=typeof qe(function(){return window.document.createElement})=="function",Ww=qe(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function co(t){function e(r){Object.defineProperty(t,r,{value:ee})}return _c&&Symbol.species&&e(Symbol.species),e("@@species"),t}function $l(t){return t&&typeof t.then=="function"}var Xn=function(t){ke(e,t);function e(r){var n=t.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),sn(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),sn(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?$l(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"),sn(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 r=="function"&&(r=[new ee(r)]),$l(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,r(i,a))})},e}(ee);co(Xn);function Tr(t){return"incremental"in t}function Am(t){return"hasNext"in t&&"data"in t}function Ml(t){return Tr(t)||Am(t)}function uo(t,e){var r=t,n=new lt;return Tr(e)&&Fe(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}r=n.merge(r,a)}),r}function ei(t){var e=lo(t);return Fe(e)}function lo(t){var e=Fe(t.errors)?t.errors.slice(0):[];return Tr(t)&&Fe(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ir(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var jl=new Map;function Gi(t){var e=jl.get(t)||1;return jl.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ul(t){var e=Gi("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(t,e){return Ir(t,e,e.variables&&{variables:E(E({},t&&t.variables),e.variables)})}function fo(t){return new ee(function(e){e.error(t)})}var Hi=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function Sc(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new K("illegal argument: ".concat(i)):new K(27)}return t}function wc(t,e){var r=E({},t),n=function(a){typeof a=="function"?r=E(E({},r),a(r)):r=E(E({},r),a)},i=function(){return E({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function Ec(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Jn(e.query)||void 0:""),e}function ql(t,e){return e?e(t):ee.of()}function Ji(t){return typeof t=="function"?new At(t):t}function po(t){return t.request.length<=1}var Om=function(t){ke(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),At=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return ee.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Ji).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=Ji(r),a=Ji(n||new t(ql));return po(i)&&po(a)?new t(function(o){return e(o)?i.request(o)||ee.of():a.request(o)||ee.of()}):new t(function(o,s){return e(o)?i.request(o,s)||ee.of():a.request(o,s)||ee.of()})},t.execute=function(e,r){return e.request(wc(r.context,Ec(Sc(r))))||ee.of()},t.concat=function(e,r){var n=Ji(e);if(po(n))return __DEV__&&P.warn(new Om("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ji(r);return po(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||ee.of()})||ee.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||ee.of()})||ee.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(ql)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new K("request is not implemented"):new K(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var ti=At.execute;var Bl="3.7.10";function Vl(t){return!!t.body}function Ql(t){return!!t.getReader}function zl(t){return!!(xr&&t[Symbol.asyncIterator])}function Wl(t){return!!t.stream}function Gl(t){return!!t.arrayBuffer}function Kl(t){return!!t.pipe}function xc(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Tc(t){var e=null,r=null,n=!1,i=[],a=[];function o(d){if(!r){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){r=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,t.removeListener("data",o),t.removeListener("error",s),t.removeListener("end",c),t.removeListener("finish",c),t.removeListener("close",c)},t.on("data",o),t.on("error",s),t.on("end",c),t.on("finish",c),t.on("close",c);function u(){return new Promise(function(d,p){if(r)return p(r);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 xr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Ic(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){t.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return xr&&(r[Symbol.asyncIterator]=function(){return this}),r}function ho(t){var e={next:function(){return t.read()}};return xr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Hl(t){var e=t;if(Vl(t)&&(e=t.body),zl(e))return xc(e);if(Ql(e))return ho(e.getReader());if(Wl(e))return ho(e.stream().getReader());if(Gl(e))return Ic(e.arrayBuffer());if(Kl(e))return Tc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Jl=Object.prototype.hasOwnProperty;function Yl(t,e){var r,n,i;return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h,m,g,w,b,S,_,A,R,I,C;return Ft(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=Hl(t),p=!0,F.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=F.sent(),h=f.value,m=f.done,g=typeof h=="string"?h:a.decode(h),p=!m,l+=g,w=l.indexOf(u);w>-1;){if(b=void 0,C=[l.slice(0,w),l.slice(w+u.length)],b=C[0],l=C[1],b.trim()){if(S=b.indexOf(`\r
23
+ `)!==-1}function El(t){return t!=null&&t.some(Qh)}function ji(t){return t.kind===Pe.FIELD||t.kind===Pe.FRAGMENT_SPREAD||t.kind===Pe.INLINE_FRAGMENT}function xl(){return typeof no=="function"?Js():Js()}function em(){__DEV__?L(typeof Zr=="boolean",Zr):L(typeof Zr=="boolean",39)}xl();em();function sr(t,e){var r=t.directives;return!r||!r.length?!0:Tl(r).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(t,e,r){var n=new Set(t),i=n.size;return et(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return Xr}}),r?!n.size:n.size<i}function ec(t){return t&&Kn(["client","export"],t,!0)}function tm(t){var e=t.name.value;return e==="skip"||e==="include"}function Tl(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!tm(r)){var n=r.arguments,i=r.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:r,ifArgument:a})}}),e}function tc(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new K("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 K(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"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),r=n[0].name.value);var i=T(T({},t),{definitions:Sr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function en(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function tn(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return __DEV__?L(n,"No fragment named ".concat(r)):L(n,46),n||null}default:return null}}function se(t){return t!==null&&typeof t=="object"}function zt(t){return{__ref:String(t)}}function te(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function rc(t){return se(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function rm(t){return t.kind==="StringValue"}function nm(t){return t.kind==="BooleanValue"}function im(t){return t.kind==="IntValue"}function am(t){return t.kind==="FloatValue"}function om(t){return t.kind==="Variable"}function sm(t){return t.kind==="ObjectValue"}function cm(t){return t.kind==="ListValue"}function um(t){return t.kind==="EnumValue"}function lm(t){return t.kind==="NullValue"}function Er(t,e,r,n){if(im(r)||am(r))t[e.value]=Number(r.value);else if(nm(r)||rm(r))t[e.value]=r.value;else if(sm(r)){var i={};r.fields.map(function(o){return Er(i,o.name,o.value,n)}),t[e.value]=i}else if(om(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(cm(r))t[e.value]=r.values.map(function(o){var s={};return Er(s,e,o,n),s[e.value]});else if(um(r))t[e.value]=r.value;else if(lm(r))t[e.value]=null;else throw __DEV__?new K('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new K(55)}function nc(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Er(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return Er(n,a,o,e)})),qi(t.name.value,n,r)}var fm=["connection","include","skip","client","rest","export"],qi=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(Ui(i),")")}else return r.connection.key;var a=t;if(e){var o=Ui(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){fm.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Ui(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Ui;return Ui=t,e}}),Ui=function(e){return JSON.stringify(e,pm)};function pm(t,e){return se(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function cr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return Er(r,i,a,e)}),r}return null}function It(t){return t.alias?t.alias.value:t.name.value}function Bi(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(gt(a)){if(a.name.value==="__typename")return t[It(a)]}else{var o=Bi(t,tn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function gt(t){return t.kind==="Field"}function ic(t){return t.kind==="InlineFragment"}function Hn(t){__DEV__?L(t&&t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new K('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new K(48);return r});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),t}function Gt(t){return Hn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Jn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function rn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Vi(t){var e=Gt(t);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function ac(t){__DEV__?L(t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(t.kind==="Document",51),__DEV__?L(t.definitions.length<=1,"Fragment must have exactly one definition."):L(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function nn(t){Hn(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];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 K("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new K(54)}function an(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Er(e,n.variable.name,n.defaultValue)}),e}var ye=Array.isArray;function $e(t){return Array.isArray(t)&&t.length>0}var Il={kind:Pe.FIELD,name:{kind:Pe.NAME,value:"__typename"}};function Al(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Pe.FRAGMENT_SPREAD&&Al(e[r.name.value],e)})}function dm(t){return Al(Gt(t)||ac(t),en(rn(t)))?null:t}function hm(t){var e=new Set,r=[];return t.forEach(function(n){n.name?e.add(n.name):n.test&&r.push(n.test)}),function(n){return e.has(n.name.value)||r.some(function(i){return i(n)})}}function kl(t){var e=new Map;return function(n){n===void 0&&(n=t);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function oc(t,e){for(var r=kl(""),n=kl(""),i=function(S){for(var w=0,b=void 0;w<S.length&&(b=S[w]);++w)if(!ye(b)){if(b.kind===Pe.OPERATION_DEFINITION)return r(b.name&&b.name.value);if(b.kind===Pe.FRAGMENT_DEFINITION)return n(b.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=hm(t),c=t.some(function(S){return S.remove}),u=function(S){return c&&S&&S.some(s)},l=new Map,d=!1,p={enter:function(S){if(u(S.directives))return d=!0,null}},f=et(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,w,b,A,R){var E=i(R);E&&E.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,w,b,A,R){if(u(S.directives))return d=!0,null;var E=i(R);E&&E.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,w,b,A){l.set(JSON.stringify(A),S)},leave:function(S,w,b,A){var R=l.get(JSON.stringify(A));if(S===R)return S;if(a>0&&S.selectionSet.selections.every(function(E){return E.kind===Pe.FIELD&&E.name.value==="__typename"}))return n(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(s(S))return d=!0,null}}});if(!d)return e;var h=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(w){h(n(w)).transitiveVars.forEach(function(b){S.transitiveVars.add(b)})})),S},m=new Set;f.definitions.forEach(function(S){S.kind===Pe.OPERATION_DEFINITION?h(r(S.name&&S.name.value)).fragmentSpreads.forEach(function(w){m.add(w)}):S.kind===Pe.FRAGMENT_DEFINITION&&a===0&&!n(S.name.value).removed&&m.add(S.name.value)}),m.forEach(function(S){h(n(S)).fragmentSpreads.forEach(function(w){m.add(w)})});var g=function(S){return!!(!m.has(S)||n(S).removed)},_={enter:function(S){if(g(S.name.value))return null}};return dm(et(f,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var w=h(r(S.name&&S.name.value)).transitiveVars;if(w.size<S.variableDefinitions.length)return T(T({},S),{variableDefinitions:S.variableDefinitions.filter(function(b){return w.has(b.variable.name.value)})})}}}}))}var on=Object.assign(function(t){return et(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Pe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return gt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(gt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return T(T({},e),{selections:Sr(Sr([],i,!0),[Il],!1)})}}}}}})},{added:function(t){return t===Il}}),mm={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.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 sc(t){return oc([mm],Hn(t))}function cc(t){var e=nn(t),r=e.operation;if(r==="query")return t;var n=et(t,{OperationDefinition:{enter:function(i){return T(T({},i),{operation:"query"})}}});return n}function uc(t){Hn(t);var e=oc([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var ym=Object.prototype.hasOwnProperty;function lc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qi(t)}function Qi(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new lt,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var gm=function(t,e,r){return this.merge(t[r],e[r])},lt=function(){function t(e){e===void 0&&(e=gm),this.reconciler=e,this.isObject=se,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return se(r)&&se(e)?(Object.keys(r).forEach(function(o){if(ym.call(e,o)){var s=e[o];if(r[o]!==s){var c=n.reconciler.apply(n,Sr([e,r,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return se(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=T({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function vm(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=bm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[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 bm(t,e){if(!!t){if(typeof t=="string")return Ol(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ol(t,e)}}function Ol(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Dl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function hc(t,e,r){return e&&Dl(t.prototype,e),r&&Dl(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var mc=function(){return typeof Symbol=="function"},yc=function(t){return mc()&&Boolean(Symbol[t])},gc=function(t){return yc(t)?Symbol[t]:"@@"+t};mc()&&!yc("observable")&&(Symbol.observable=Symbol("observable"));var _m=gc("iterator"),pc=gc("observable"),Nl=gc("species");function oo(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function zi(t){var e=t.constructor;return e!==void 0&&(e=e[Nl],e===null&&(e=void 0)),e!==void 0?e:ee}function Sm(t){return t instanceof ee}function Yn(t){Yn.log?Yn.log(t):setTimeout(function(){throw t})}function ao(t){Promise.resolve().then(function(){try{t()}catch(e){Yn(e)}})}function Cl(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=oo(e,"unsubscribe");r&&r.call(e)}}catch(n){Yn(n)}}function dc(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function wm(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Rl(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Rl(t,e,r){t._state="running";var n=t._observer;try{var i=oo(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(dc(t),i)i.call(n,r);else throw r;break;case"complete":dc(t),i&&i.call(n);break}}catch(a){Yn(a)}t._state==="closed"?Cl(t):t._state==="running"&&(t._state="ready")}function fc(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],ao(function(){return wm(t)});return}Rl(t,e,r)}}var Em=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new xm(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(dc(this),Cl(this))},hc(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),xm=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){fc(this._subscription,"next",n)},e.error=function(n){fc(this._subscription,"error",n)},e.complete=function(){fc(this._subscription,"complete")},hc(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),ee=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Em(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[pc]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=oo(n,pc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Sm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(yc("iterator")&&(a=oo(n,_m),a))return new i(function(s){ao(function(){if(!s.closed){for(var c=vm(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){ao(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")},t.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:t;return new o(function(s){ao(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},hc(t,null,[{key:Nl,get:function(){return this}}]),t}();mc()&&Object.defineProperty(ee,Symbol("extensions"),{value:{symbol:pc,hostReportError:Yn},configurable:!0});function vc(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var Zn;typeof self<"u"?Zn=self:typeof window<"u"?Zn=window:typeof global<"u"?Zn=global:typeof module<"u"?Zn=module:Zn=Function("return this")();var Cw=vc(Zn);var Pl=ee.prototype,Fl="@@observable";Pl[Fl]||(Pl[Fl]=function(){return this});var Tm=Object.prototype.toString;function so(t){return bc(t)}function bc(t,e){switch(Tm.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(i,a){r[a]=bc(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=bc(t[i],e)}),n}default:return t}}function Im(t){var e=new Set([t]);return e.forEach(function(r){se(r)&&km(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){se(r[n])&&e.add(r[n])})}),t}function km(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Gi(t){return __DEV__&&Im(t),t}function sn(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function co(t,e,r){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(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,i&&i.call(n,_),c&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(r,a),complete:function(){c=!0,s||o&&o.call(n)}},p=t.subscribe(d);return function(){return p.unsubscribe()}})}var kt=typeof WeakMap=="function"&&Be(function(){return navigator.product})!=="ReactNative",Ll=typeof WeakSet=="function",_c=typeof Symbol=="function"&&typeof Symbol.for=="function",xr=_c&&Symbol.asyncIterator,zw=typeof Be(function(){return window.document.createElement})=="function",Gw=Be(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function uo(t){function e(r){Object.defineProperty(t,r,{value:ee})}return _c&&Symbol.species&&e(Symbol.species),e("@@species"),t}function $l(t){return t&&typeof t.then=="function"}var Xn=function(t){Ae(e,t);function e(r){var n=t.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),sn(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),sn(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?$l(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"),sn(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 r=="function"&&(r=[new ee(r)]),$l(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,r(i,a))})},e}(ee);uo(Xn);function Tr(t){return"incremental"in t}function Am(t){return"hasNext"in t&&"data"in t}function Ml(t){return Tr(t)||Am(t)}function lo(t,e){var r=t,n=new lt;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}r=n.merge(r,a)}),r}function ei(t){var e=fo(t);return $e(e)}function fo(t){var e=$e(t.errors)?t.errors.slice(0):[];return Tr(t)&&$e(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ir(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var jl=new Map;function Wi(t){var e=jl.get(t)||1;return jl.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ul(t){var e=Wi("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(t,e){return Ir(t,e,e.variables&&{variables:T(T({},t&&t.variables),e.variables)})}function po(t){return new ee(function(e){e.error(t)})}var Hi=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function Sc(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new K("illegal argument: ".concat(i)):new K(27)}return t}function wc(t,e){var r=T({},t),n=function(a){typeof a=="function"?r=T(T({},r),a(r)):r=T(T({},r),a)},i=function(){return T({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function Ec(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Jn(e.query)||void 0:""),e}function ql(t,e){return e?e(t):ee.of()}function Ji(t){return typeof t=="function"?new At(t):t}function ho(t){return t.request.length<=1}var Om=function(t){Ae(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),At=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return ee.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Ji).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=Ji(r),a=Ji(n||new t(ql));return ho(i)&&ho(a)?new t(function(o){return e(o)?i.request(o)||ee.of():a.request(o)||ee.of()}):new t(function(o,s){return e(o)?i.request(o,s)||ee.of():a.request(o,s)||ee.of()})},t.execute=function(e,r){return e.request(wc(r.context,Ec(Sc(r))))||ee.of()},t.concat=function(e,r){var n=Ji(e);if(ho(n))return __DEV__&&L.warn(new Om("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ji(r);return ho(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||ee.of()})||ee.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||ee.of()})||ee.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(ql)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new K("request is not implemented"):new K(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var ti=At.execute;var Bl="3.7.10";function Vl(t){return!!t.body}function Ql(t){return!!t.getReader}function zl(t){return!!(xr&&t[Symbol.asyncIterator])}function Gl(t){return!!t.stream}function Wl(t){return!!t.arrayBuffer}function Kl(t){return!!t.pipe}function xc(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Tc(t){var e=null,r=null,n=!1,i=[],a=[];function o(d){if(!r){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){r=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,t.removeListener("data",o),t.removeListener("error",s),t.removeListener("end",c),t.removeListener("finish",c),t.removeListener("close",c)},t.on("data",o),t.on("error",s),t.on("end",c),t.on("finish",c),t.on("close",c);function u(){return new Promise(function(d,p){if(r)return p(r);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 xr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Ic(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){t.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return xr&&(r[Symbol.asyncIterator]=function(){return this}),r}function mo(t){var e={next:function(){return t.read()}};return xr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Hl(t){var e=t;if(Vl(t)&&(e=t.body),zl(e))return xc(e);if(Ql(e))return mo(e.getReader());if(Gl(e))return mo(e.stream().getReader());if(Wl(e))return Ic(e.arrayBuffer());if(Kl(e))return Tc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Jl=Object.prototype.hasOwnProperty;function Yl(t,e){var r,n,i;return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h,m,g,_,S,w,b,A,R,E,C;return Lt(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=Hl(t),p=!0,F.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=F.sent(),h=f.value,m=f.done,g=typeof h=="string"?h:a.decode(h),p=!m,l+=g,_=l.indexOf(u);_>-1;){if(S=void 0,C=[l.slice(0,_),l.slice(_+u.length)],S=C[0],l=C[1],S.trim()){if(w=S.indexOf(`\r
25
25
  \r
26
- `),_=Dm(b.slice(0,S)),A=_["content-type"],A&&A.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=b.slice(S);try{I=Zl(t,R.replace(`\r
27
- `,"")),(Object.keys(I).length>1||"data"in I||"incremental"in I||"errors"in I)&&((n=e.next)===null||n===void 0||n.call(e,I))}catch(L){mo(L,e)}}w=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Dm(t){var e={};return t.split(`
28
- `).forEach(function(r){var n=r.indexOf(":");if(n>-1){var i=r.slice(0,n).trim().toLowerCase(),a=r.slice(n+1).trim();e[i]=a}}),e}function Zl(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};Hi(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function mo(t,e){var r,n;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(n=e.error)===null||n===void 0||n.call(e,t))}function Xl(t,e,r){Nm(e)(t).then(function(n){var i,a;(i=r.next)===null||i===void 0||i.call(r,n),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(n){return mo(n,r)})}function Nm(t){return function(e){return e.text().then(function(r){return Zl(e,r)}).then(function(r){return e.status>=300&&Hi(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Jl.call(r,"data")&&!Jl.call(r,"errors")&&Hi(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var Yi=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new K("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new K(24);throw n.parseError=i,n}return r};var Cm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Rm={accept:"*/*","content-type":"application/json"},Pm={method:"POST"},ef={http:Cm,headers:Rm,options:Pm},tf=function(t,e){return e(t)};function rf(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(d){i=E(E(E({},i),d.options),{headers:E(E({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=E(E({},a),d.http)}),i.headers&&(i.headers=Lm(i.headers,a.preserveHeaderCase));var o=t.operationName,s=t.extensions,c=t.variables,u=t.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,Gn)),{options:i,body:l}}function Lm(t,e){if(!e){var r=Object.create(null);return Object.keys(Object(t)).forEach(function(a){r[a.toLowerCase()]=t[a]}),r}var n=Object.create(null);Object.keys(Object(t)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:t[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var nf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new K(`
26
+ `),b=Dm(S.slice(0,w)),A=b["content-type"],A&&A.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=S.slice(w);try{E=Zl(t,R.replace(`\r
27
+ `,"")),(Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E)&&((n=e.next)===null||n===void 0||n.call(e,E))}catch(P){yo(P,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Dm(t){var e={};return t.split(`
28
+ `).forEach(function(r){var n=r.indexOf(":");if(n>-1){var i=r.slice(0,n).trim().toLowerCase(),a=r.slice(n+1).trim();e[i]=a}}),e}function Zl(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};Hi(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function yo(t,e){var r,n;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(n=e.error)===null||n===void 0||n.call(e,t))}function Xl(t,e,r){Nm(e)(t).then(function(n){var i,a;(i=r.next)===null||i===void 0||i.call(r,n),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(n){return yo(n,r)})}function Nm(t){return function(e){return e.text().then(function(r){return Zl(e,r)}).then(function(r){return e.status>=300&&Hi(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Jl.call(r,"data")&&!Jl.call(r,"errors")&&Hi(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var Yi=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new K("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new K(24);throw n.parseError=i,n}return r};var Cm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Rm={accept:"*/*","content-type":"application/json"},Pm={method:"POST"},ef={http:Cm,headers:Rm,options:Pm},tf=function(t,e){return e(t)};function rf(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(d){i=T(T(T({},i),d.options),{headers:T(T({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=T(T({},a),d.http)}),i.headers&&(i.headers=Fm(i.headers,a.preserveHeaderCase));var o=t.operationName,s=t.extensions,c=t.variables,u=t.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,Wn)),{options:i,body:l}}function Fm(t,e){if(!e){var r=Object.create(null);return Object.keys(Object(t)).forEach(function(a){r[a.toLowerCase()]=t[a]}),r}var n=Object.create(null);Object.keys(Object(t)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:t[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var nf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new K(`
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 K(23)};var af=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var of=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function sf(t,e){var r=[],n=function(d,p){r.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=t,c=t.indexOf("#");c!==-1&&(o=t.substr(c),s=t.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+r.join("&")+o;return{newURI:l}}var cf=qe(function(){return fetch}),uf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,i=t.print,a=i===void 0?tf:i,o=t.includeExtensions,s=t.preserveHeaderCase,c=t.useGETForQueries,u=t.includeUnusedVariables,l=u===void 0?!1:u,d=Qt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&nf(n||cf);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new At(function(f){var h=of(f,r),m=f.getContext(),g={};if(m.clientAwareness){var w=m.clientAwareness,b=w.name,S=w.version;b&&(g["apollographql-client-name"]=b),S&&(g["apollographql-client-version"]=S)}var _=E(E({},g),m.headers),A={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:_},R=rf(f,a,ef,p,A),I=R.options,C=R.body;if(C.variables&&!l){var F=new Set(Object.keys(C.variables));et(f.query,{Variable:function(ae,Bt,X){X&&X.kind!=="VariableDefinition"&&F.delete(ae.name.value)}}),F.size&&(C.variables=E({},C.variables),F.forEach(function(ae){delete C.variables[ae]}))}var L;if(!I.signal){var M=af(),le=M.controller,Le=M.signal;L=le,L&&(I.signal=Le)}var z=function(ae){return ae.kind==="OperationDefinition"&&ae.operation==="mutation"};if(c&&!f.query.definitions.some(z)&&(I.method="GET"),Kn(["defer"],f.query)&&(I.headers=I.headers||{},I.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),I.method==="GET"){var ge=sf(h,C),ve=ge.newURI,ie=ge.parseError;if(ie)return fo(ie);h=ve}else try{I.body=Yi(C,"Payload")}catch(ae){return fo(ae)}return new ee(function(ae){var Bt=n||qe(function(){return fetch})||cf;return Bt(h,I).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)?Yl(X,ae):Xl(X,f,ae)}).catch(function(X){return mo(X,ae)}),function(){L&&L.abort()}})})};var kc=function(t){ke(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,uf(r).request)||this;return n.options=r,n}return e}(At);var{toString:lf,hasOwnProperty:Fm}=Object.prototype,ff=Function.prototype.toString,Ac=new Map;function Ee(t,e){try{return Oc(t,e)}finally{Ac.clear()}}function Oc(t,e){if(t===e)return!0;let r=lf.call(t),n=lf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(df(t,e))return!0;let i=pf(t),a=pf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Fm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Oc(t[c],e[c]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(df(t,e))return!0;let i=t.entries(),a=r==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Oc(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]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=ff.call(t);return i!==ff.call(e)?!1:!jm(i,Mm)}}return!1}function pf(t){return Object.keys(t).filter($m,t)}function $m(t){return this[t]!==void 0}var Mm="{ [native code] }";function jm(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function df(t,e){let r=Ac.get(t);if(r){if(r.has(e))return!0}else Ac.set(t,r=new Set);return r.add(e),!1}var Um=function(){return Object.create(null)},hf=Array.prototype,qm=hf.forEach,Bm=hf.slice,Gt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Um),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return qm.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(Bm.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Vm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},t}();function Vm(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Ke=null,mf={},Qm=1,zm=()=>class{constructor(){this.id=["slot",Qm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ke;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===mf)break;return e!==Ke&&(Ke.slots[this.id]=r),!0}return Ke&&(Ke.slots[this.id]=mf),!1}getValue(){if(this.hasValue())return Ke.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=Ke;Ke={parent:o,slots:a};try{return r.apply(i,n)}finally{Ke=o}}static bind(e){let r=Ke;return function(){let n=Ke;try{return Ke=r,e.apply(this,arguments)}finally{Ke=n}}}static noContext(e,r,n){if(Ke){let i=Ke;try{return Ke=null,e.apply(n,r)}finally{Ke=i}}else return e.apply(n,r)}};function yf(t){try{return t()}catch{}}var Dc="@wry/context:Slot",Wm=yf(()=>globalThis)||yf(()=>global)||Object.create(null),gf=Wm,ri=gf[Dc]||Array[Dc]||function(t){try{Object.defineProperty(gf,Dc,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(zm());var{bind:Gm,noContext:Km}=ri;function Hm(){}var Jm=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Hm),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,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)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),go=new ri,Nc,Ym=Object.prototype.hasOwnProperty,Rc=(Nc=Array.from,Nc===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Nc);function yo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Zi=[],Zm=100;function ni(t,e){if(!t)throw new Error(e||"assertion failure")}function Xm(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function bf(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function ey(t){return t.slice(0)}var ty=function(){function t(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!kr(this))return vf(this),this.value[0]},t.prototype.recompute=function(e){return ni(!this.recomputing,"already recomputing"),vf(this),kr(this)?ry(this,e):bf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,_f(this),yo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),Tf(this),Pc(this,function(r,n){r.setDirty(),If(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Zi.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Rc(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Zi.push(this.deps),this.deps=null)},t.count=0,t}();function vf(t){var e=go.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),kr(t)?wf(e,t):Ef(e,t),e}function ry(t,e){return Tf(t),go.withValue(t,ny,[t,e]),ay(t,e)&&iy(t),bf(t.value)}function ny(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function kr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function iy(t){t.dirty=!1,!kr(t)&&Sf(t)}function _f(t){Pc(t,wf)}function Sf(t){Pc(t,Ef)}function Pc(t,e){var r=t.parents.size;if(r)for(var n=Rc(t.parents),i=0;i<r;++i)e(n[i],t)}function wf(t,e){ni(t.childValues.has(e)),ni(kr(e));var r=!kr(t);if(!t.dirtyChildren)t.dirtyChildren=Zi.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&_f(t)}function Ef(t,e){ni(t.childValues.has(e)),ni(!kr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,ey(e.value)):Xm(r,e.value)||t.setDirty(),xf(t,e),!kr(t)&&Sf(t)}function xf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Zi.length<Zm&&Zi.push(r),t.dirtyChildren=null))}function Tf(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){If(t,r)}),t.forgetDeps(),ni(t.dirtyChildren===null)}function If(t,e){e.parents.delete(t),t.childValues.delete(e),xf(t,e)}function ay(t,e){if(typeof t.subscribe=="function")try{yo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var oy={setDirty:!0,dispose:!0,forget:!0};function vo(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=go.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(yo(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Ym.call(oy,o)?o:"setDirty";Rc(s).forEach(function(u){return u[c]()}),e.delete(a),yo(s)}},n}function kf(){var t=new Gt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var kE=kf(),Cc=new Set;function cn(t,e){e===void 0&&(e=Object.create(null));var r=new Jm(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||kf(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return t.apply(null,arguments);var l=r.get(u);l||(r.set(u,l=new ty(t)),l.subscribe=e.subscribe,l.forget=function(){return r.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return r.set(u,l),Cc.add(r),go.hasValue()||(Cc.forEach(function(p){return p.clean()}),Cc.clear()),d};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(u){var l=r.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=r.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return r.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 Lc=function(){function t(){this.getFragmentDoc=cn(tc)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(E(E({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=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:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(E(E({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(E(E({},e),{data:a})),a)}})},t}();var Xi=function(t){ke(e,t);function e(r,n,i,a){var o,s=t.call(this,r)||this;if(s.message=r,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(t){return t==null}function _o(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=ea(n)?ea(i)?void 0:{_id:i}:{id:n}),ea(n)&&!ea(i)&&(n=i),!ea(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Af={dataIdFromObject:_o,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Of(t){return Ir(Af,t)}function So(t){var e=t.canonizeResults;return e===void 0?Af.canonizeResults:e}function Df(t,e){return te(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Fc=/^[_a-z][_0-9a-z]*/i;function jt(t){var e=t.match(Fc);return e?e[0]:t}function bo(t,e,r){return oe(e)?me(e)?e.every(function(n){return bo(t,n,r)}):t.selections.every(function(n){if(gt(n)&&sr(n,r)){var i=It(n);return Ae.call(e,i)&&(!n.selectionSet||bo(n.selectionSet,e[i],r))}return!0}):!1}function Ar(t){return oe(t)&&!te(t)&&!me(t)}function Nf(){return new lt}function wo(t,e){var r=en(rn(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Eo=Object.create(null),$c=function(){return Eo},Cf=Object.create(null),ii=function(){function t(e,r){var n=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Wi(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 t.prototype.toObject=function(){return E({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),Ae.call(this.data,e)){var n=this.data[e];if(n&&Ae.call(n,r))return n[r]}if(r==="__typename"&&Ae.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Ae.call(this.data,e))return this.data[e];if(this instanceof Or)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;te(e)&&(e=e.__ref),te(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?P(typeof i=="string","store.merge expects a string ID"):P(typeof i=="string",1);var s=new lt(cy).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=jt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Or)&&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)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:Eo,INVALIDATE:Cf,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=jt(u),d=i[u];if(d!==void 0){var p=typeof r=="function"?r:r[u]||r[l];if(p){var f=p===$c?Eo:p(Wi(d),E(E({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Cf?n.group.dirty(e,u):(f===Eo&&(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 Or?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=$c,i):$c)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Ae.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Ae.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Ae.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Or?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){Ae.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Ae.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){te(a)&&(r[a.__ref]=!0),oe(a)&&Object.keys(a).forEach(function(o){var s=a[o];oe(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var Rf=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?vo():null,this.keyMaker=new Gt(kt)},t.prototype.depend=function(e,r){if(this.d){this.d(Mc(e,r));var n=jt(r);n!==r&&this.d(Mc(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Mc(e,r),r==="__exists"?"forget":"setDirty")},t}();function Mc(t,e){return e+"#"+t}function jc(t,e){un(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){ke(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=r.call(this,a,new Rf(s))||this;return u.stump=new sy(u),u.storageTrie=new Gt(kt),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}(t);t.Root=e})(ii||(ii={}));var Or=function(t){ke(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===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(r){var n=this.parent.findChildRefIds(r);return Ae.call(this.data,r)?E(E({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(ii),sy=function(t){ke(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Rf(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Or);function cy(t,e,r){var n=t[r],i=e[r];return Ee(n,i)?n:i}function un(t){return!!(t instanceof ii&&t.group.caching)}function uy(t){return oe(t)?me(t)?t.slice(0):E({__proto__:Object.getPrototypeOf(t)},t):t}var xo=function(){function t(){this.known=new(Fl?WeakSet:Set),this.pool=new Gt(kt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return oe(e)&&this.known.has(e)},t.prototype.pass=function(e){if(oe(e)){var r=uy(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=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(r.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},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var vt=Object.assign(function(t){if(oe(t)){Uc===void 0&&Pf();var e=Uc.admit(t),r=qc.get(e);return r===void 0&&qc.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:Pf}),Uc,qc;function Pf(){Uc=new xo,qc=new(kt?WeakMap:Map)}function Lf(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var Ff=function(){function t(e){var r=this;this.knownResults=new(kt?WeakMap:Map),this.config=Ir(e,{addTypename:e.addTypename!==!1,canonizeResults:So(e)}),this.canon=e.canon||new xo,this.executeSelectionSet=cn(function(n){var i,a=n.context.canonizeResults,o=Lf(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?E(E({},s),{result:r.canon.admit(s.result)}):s:(jc(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Lf,makeCacheKey:function(n,i,a,o){if(un(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=cn(function(n){return jc(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(un(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new xo},t.prototype.diffQueryAgainstStore=function(e){var r=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({},an(Vi(n))),o);var p=zt(a),f=this.executeSelectionSet({selectionSet:nn(n).selectionSet,objectOrReference:p,enclosingRef:p,context:E({store:r,query:n,policies:d,variables:o,varString:vt(o),canonizeResults:l},wo(n,this.config.fragments))}),h;if(f.missing&&(h=[new Xi(ly(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(un(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=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"),d=[],p,f=new lt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,_){var A;return S.missing&&(p=f.merge(p,(A={},A[_]=S.missing,A))),S.result}var m=new Set(n.selections);m.forEach(function(S){var _,A;if(!!sr(S,s))if(gt(S)){var R=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),I=It(S);R===void 0?on.added(S)||(p=f.merge(p,(_={},_[I]="Can't find field '".concat(S.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),_))):me(R)?R=h(r.executeSubSelectedArray({field:S,array:R,enclosingRef:a,context:o}),I):S.selectionSet?R!=null&&(R=h(r.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:R,enclosingRef:te(R)?R:a,context:o}),I)):o.canonizeResults&&(R=r.canon.pass(R)),R!==void 0&&d.push((A={},A[I]=R,A))}else{var C=tn(S,o.lookupFragment);if(!C&&S.kind===Re.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(S.name.value)):new K(5);C&&c.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(m.add,m)}});var g=Qi(d),w={result:g,missing:p},b=o.canonizeResults?this.canon.admit(w):Wi(w);return b.result&&this.knownResults.set(b.result,n),b},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new lt;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(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),d):(__DEV__&&fy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function ly(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function fy(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){oe(i)&&(__DEV__?P(!te(i),"Missing selection set for object of type ".concat(Df(t,i)," returned for query field ").concat(e.name.value)):P(!te(i),6),Object.values(i).forEach(n.add,n))})}}var ai=new ri,$f=new WeakMap;function ta(t){var e=$f.get(t);return e||$f.set(t,e={vars:new Set,dep:vo()}),e}function Bc(t){ta(t).vars.forEach(function(e){return e.forgetCache(t)})}function Mf(t){ta(t).vars.forEach(function(e){return e.attachCache(t)})}function To(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(c){ta(c).dep.dirty(n),py(c)});var o=Array.from(r);r.clear(),o.forEach(function(c){return c(t)})}}else{var s=ai.getValue();s&&(i(s),ta(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.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 py(t){t.broadcastWatches&&t.broadcastWatches()}var jf=Object.create(null);function Vc(t){var e=JSON.stringify(t);return jf[e]||(jf[e]=Object.create(null))}function Qc(t){var e=Vc(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Wc(t,function(o){var s=oi(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Ae.call(r,o[0])&&(s=oi(r,o,qf)),__DEV__?P(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):P(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function zc(t){var e=Vc(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=Wc(t,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&Fe(i.directives)){var p=l.slice(1),f=i.directives.find(function(w){return w.name.value===p}),h=f&&cr(f,a);return h&&oi(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,oi(a,g)}return}if(r)return oi(r,u)}),c=JSON.stringify(s);return(r||c!=="{}")&&(o+=":"+c),o})}function Wc(t,e){var r=new lt;return Uf(t).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=r.merge(n,o)}return n},Object.create(null))}function Uf(t){var e=Vc(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){me(i)?(Uf(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),me(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function qf(t,e){return t[e]}function oi(t,e,r){return r=r||qf,Bf(e.reduce(function n(i,a){return me(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Bf(t){return oe(t)?me(t)?t.map(Bf):Wc(Object.keys(t).sort(),function(e){return oi(t,e)}):t}qi.setStringify(vt);function Gc(t){return t.args!==void 0?t.args:t.field?cr(t.field,t.variables):null}var dy=function(){},Vf=function(t,e){return e.fieldName},Qf=function(t,e,r){var n=r.mergeObjects;return n(t,e)},zf=function(t,e){return e},Gf=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=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 t.prototype.identify=function(e,r){var n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=E(E({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var p=Io(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=Qc(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},t.prototype.addTypePolicies=function(e){var r=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&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Ae.call(r.toBeAdded,n)?r.toBeAdded[n].push(c):r.toBeAdded[n]=[c]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Qf:u===!1?zf:c.merge}s(i,r.merge),i.keyFn=a===!1?dy:me(a)?Qc(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?Vf:me(d)?zc(d):typeof d=="function"?d:u.keyFn,typeof p=="function"&&(u.read=p),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Vf)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?P(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):P(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match(Fc);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=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=r.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){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),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__&&P.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&p===c.length-1&&bo(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var g=r.match(h);g&&g[0]===r&&u(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},c=Gc(e);o;){var u=o(c,s);if(me(u))o=zc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?nc(e.field,e.variables):qi(n,Gc(e))),a===!1?n:n===jt(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=jt(o),c=r.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=Wf(this,n,e,r,r.store.getStorage(te(n)?n.__ref:n,o));return ai.withValue(this.cache,l,[c,d])}return c}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===Qf?Kf(i.store)(e,r):c===zf?r:(i.overwrite&&(e=void 0),c(e,r,Wf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Wf(t,e,r,n,i){var a=t.getStoreFieldName(r),o=jt(a),s=r.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Gc(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:u,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(Io(arguments,e,s),n)},mergeObjects:Kf(n.store)}}function Io(t,e,r){var n=t[0],i=t[1],a=t.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__&&P.warn("Undefined 'from' passed to readField with arguments ".concat(Ul(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Kf(t){return function(r,n){if(me(r)||me(n))throw __DEV__?new K("Cannot automatically merge arrays"):new K(4);if(oe(r)&&oe(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(te(r)&&Ar(n))return t.merge(r.__ref,n),r;if(Ar(r)&&te(n))return t.merge(r,n.__ref),n;if(Ar(r)&&Ar(n))return E(E({},r),n)}return n}}function Kc(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:E(E({},t),{clientOnly:e,deferred:r})),i}var Zf=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,c=r.overwrite,u=Wt(i),l=Nf();s=E(E({},an(u)),s);var d=E(E({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:vt(s)},wo(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(!te(p))throw __DEV__?new K("Could not identify object ".concat(JSON.stringify(a))):new K(7);return d.incomingById.forEach(function(f,h){var m=f.storeObject,g=f.mergeTree,w=f.fieldNodeSet,b=zt(h);if(g&&g.map.size){var S=n.applyMerges(g,b,m,d);if(te(S))return;m=S}if(__DEV__&&!d.overwrite){var _=Object.create(null);w.forEach(function(I){I.selectionSet&&(_[I.name.value]=!0)});var A=function(I){return _[jt(I)]===!0},R=function(I){var C=g&&g.map.get(I);return Boolean(C&&C.info&&C.info.merge)};Object.keys(m).forEach(function(I){A(I)&&!R(I)&&hy(b,m,I,d.store)})}e.merge(h,m)}),e.retain(p.__ref),p},t.prototype.processSelectionSet=function(e){var r=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 S=Io(arguments,u,o.variables);if(te(S.from)){var _=o.incomingById.get(S.from.__ref);if(_){var A=c.readField(E(E({},S),{from:_.storeObject}),o);if(A!==void 0)return A}}return c.readField(S,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(S,_){var A,R=It(_),I=i[R];if(p.add(_),I!==void 0){var C=c.getStoreFieldName({typename:l,fieldName:_.name.value,field:_,variables:S.variables}),F=Hf(s,C),L=r.processFieldValue(I,_,_.selectionSet?Kc(S,!1,!1):S,F),M=void 0;_.selectionSet&&(te(L)||Ar(L))&&(M=d("__typename",L));var le=c.getMergeFunction(l,_.name.value,M);le?F.info={field:_,typename:l,merge:le}:Jf(s,C),u=S.merge(u,(A={},A[C]=L,A))}else __DEV__&&!S.clientOnly&&!S.deferred&&!on.added(_)&&!c.getReadFunction(l,_.name.value)&&__DEV__&&P.error("Missing field '".concat(It(_),"' 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(S){if(!n)throw S}if(typeof n=="string"){var g=zt(n),w=o.written[n]||(o.written[n]=[]);if(w.indexOf(a)>=0||(w.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=Hc(b.mergeTree,s),p.forEach(function(S){return b.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:u,mergeTree:ko(s)?void 0:s,fieldNodeSet:p}),g}return u},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?oo(e):e:me(e)?e.map(function(o,s){var c=a.processFieldValue(o,r,n,Hf(i,s));return Jf(i,s),c}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=Bi(r,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(!!sr(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&Fe(p.directives)&&p.directives.forEach(function(w){var b=w.name.value;if(b==="client"&&(f=!0),b==="defer"){var S=cr(w,n.variables);(!S||S.if!==!1)&&(h=!0)}}),gt(p)){var m=a.get(p);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(p,Kc(n,f,h))}else{var g=tn(p,n.lookupFragment);if(!g&&p.kind===Re.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(p.name.value)):new K(8);g&&o.fragmentMatches(g,i,r,n.variables)&&c(g.selectionSet,Kc(n,f,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var c=!me(n)&&(te(r)||Ar(r))?r:void 0,u=n;c&&!a&&(a=[te(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&&P(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(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Xf=[];function Hf(t,e){var r=t.map;return r.has(e)||r.set(e,Xf.pop()||{map:new Map}),r.get(e)}function Hc(t,e){if(t===e||!e||ko(e))return t;if(!t||ko(t))return e;var r=t.info&&e.info?E(E({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){var o=new Set(e.map.keys());t.map.forEach(function(s,c){a.map.set(c,Hc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Hc(e.map.get(s),t.map.get(s)))})}return a}function ko(t){return!t||!(t.info||t.map.size)}function Jf(t,e){var r=t.map,n=r.get(e);n&&ko(n)&&(Xf.push(n),r.delete(e))}var Yf=new Set;function hy(t,e,r,n){var i=function(d){var p=n.getFieldValue(d,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!te(a)&&!Ee(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),c=jt(r),u="".concat(s,".").concat(c);if(!Yf.has(u)){Yf.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__&&P.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
36
+ `):new K(23)};var af=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var of=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function sf(t,e){var r=[],n=function(d,p){r.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=t,c=t.indexOf("#");c!==-1&&(o=t.substr(c),s=t.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+r.join("&")+o;return{newURI:l}}var cf=Be(function(){return fetch}),uf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,i=t.print,a=i===void 0?tf:i,o=t.includeExtensions,s=t.preserveHeaderCase,c=t.useGETForQueries,u=t.includeUnusedVariables,l=u===void 0?!1:u,d=Qt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&nf(n||cf);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new At(function(f){var h=of(f,r),m=f.getContext(),g={};if(m.clientAwareness){var _=m.clientAwareness,S=_.name,w=_.version;S&&(g["apollographql-client-name"]=S),w&&(g["apollographql-client-version"]=w)}var b=T(T({},g),m.headers),A={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:b},R=rf(f,a,ef,p,A),E=R.options,C=R.body;if(C.variables&&!l){var F=new Set(Object.keys(C.variables));et(f.query,{Variable:function(oe,Bt,X){X&&X.kind!=="VariableDefinition"&&F.delete(oe.name.value)}}),F.size&&(C.variables=T({},C.variables),F.forEach(function(oe){delete C.variables[oe]}))}var P;if(!E.signal){var M=af(),Ee=M.controller,ne=M.signal;P=Ee,P&&(E.signal=ne)}var j=function(oe){return oe.kind==="OperationDefinition"&&oe.operation==="mutation"};if(c&&!f.query.definitions.some(j)&&(E.method="GET"),Kn(["defer"],f.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var ge=sf(h,C),ve=ge.newURI,ae=ge.parseError;if(ae)return po(ae);h=ve}else try{E.body=Yi(C,"Payload")}catch(oe){return po(oe)}return new ee(function(oe){var Bt=n||Be(function(){return fetch})||cf;return Bt(h,E).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)?Yl(X,oe):Xl(X,f,oe)}).catch(function(X){return yo(X,oe)}),function(){P&&P.abort()}})})};var kc=function(t){Ae(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,uf(r).request)||this;return n.options=r,n}return e}(At);var{toString:lf,hasOwnProperty:Lm}=Object.prototype,ff=Function.prototype.toString,Ac=new Map;function xe(t,e){try{return Oc(t,e)}finally{Ac.clear()}}function Oc(t,e){if(t===e)return!0;let r=lf.call(t),n=lf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(df(t,e))return!0;let i=pf(t),a=pf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Lm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Oc(t[c],e[c]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(df(t,e))return!0;let i=t.entries(),a=r==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Oc(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]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=ff.call(t);return i!==ff.call(e)?!1:!jm(i,Mm)}}return!1}function pf(t){return Object.keys(t).filter($m,t)}function $m(t){return this[t]!==void 0}var Mm="{ [native code] }";function jm(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function df(t,e){let r=Ac.get(t);if(r){if(r.has(e))return!0}else Ac.set(t,r=new Set);return r.add(e),!1}var Um=function(){return Object.create(null)},hf=Array.prototype,qm=hf.forEach,Bm=hf.slice,Wt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Um),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return qm.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(Bm.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Vm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},t}();function Vm(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Ke=null,mf={},Qm=1,zm=()=>class{constructor(){this.id=["slot",Qm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ke;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===mf)break;return e!==Ke&&(Ke.slots[this.id]=r),!0}return Ke&&(Ke.slots[this.id]=mf),!1}getValue(){if(this.hasValue())return Ke.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=Ke;Ke={parent:o,slots:a};try{return r.apply(i,n)}finally{Ke=o}}static bind(e){let r=Ke;return function(){let n=Ke;try{return Ke=r,e.apply(this,arguments)}finally{Ke=n}}}static noContext(e,r,n){if(Ke){let i=Ke;try{return Ke=null,e.apply(n,r)}finally{Ke=i}}else return e.apply(n,r)}};function yf(t){try{return t()}catch{}}var Dc="@wry/context:Slot",Gm=yf(()=>globalThis)||yf(()=>global)||Object.create(null),gf=Gm,ri=gf[Dc]||Array[Dc]||function(t){try{Object.defineProperty(gf,Dc,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(zm());var{bind:Wm,noContext:Km}=ri;function Hm(){}var Jm=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Hm),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,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)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),vo=new ri,Nc,Ym=Object.prototype.hasOwnProperty,Rc=(Nc=Array.from,Nc===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Nc);function go(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Zi=[],Zm=100;function ni(t,e){if(!t)throw new Error(e||"assertion failure")}function Xm(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function bf(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function ey(t){return t.slice(0)}var ty=function(){function t(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!kr(this))return vf(this),this.value[0]},t.prototype.recompute=function(e){return ni(!this.recomputing,"already recomputing"),vf(this),kr(this)?ry(this,e):bf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,_f(this),go(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),Tf(this),Pc(this,function(r,n){r.setDirty(),If(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Zi.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Rc(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Zi.push(this.deps),this.deps=null)},t.count=0,t}();function vf(t){var e=vo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),kr(t)?wf(e,t):Ef(e,t),e}function ry(t,e){return Tf(t),vo.withValue(t,ny,[t,e]),ay(t,e)&&iy(t),bf(t.value)}function ny(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function kr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function iy(t){t.dirty=!1,!kr(t)&&Sf(t)}function _f(t){Pc(t,wf)}function Sf(t){Pc(t,Ef)}function Pc(t,e){var r=t.parents.size;if(r)for(var n=Rc(t.parents),i=0;i<r;++i)e(n[i],t)}function wf(t,e){ni(t.childValues.has(e)),ni(kr(e));var r=!kr(t);if(!t.dirtyChildren)t.dirtyChildren=Zi.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&_f(t)}function Ef(t,e){ni(t.childValues.has(e)),ni(!kr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,ey(e.value)):Xm(r,e.value)||t.setDirty(),xf(t,e),!kr(t)&&Sf(t)}function xf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Zi.length<Zm&&Zi.push(r),t.dirtyChildren=null))}function Tf(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){If(t,r)}),t.forgetDeps(),ni(t.dirtyChildren===null)}function If(t,e){e.parents.delete(t),t.childValues.delete(e),xf(t,e)}function ay(t,e){if(typeof t.subscribe=="function")try{go(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var oy={setDirty:!0,dispose:!0,forget:!0};function bo(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=vo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(go(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Ym.call(oy,o)?o:"setDirty";Rc(s).forEach(function(u){return u[c]()}),e.delete(a),go(s)}},n}function kf(){var t=new Wt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var kE=kf(),Cc=new Set;function cn(t,e){e===void 0&&(e=Object.create(null));var r=new Jm(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||kf(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return t.apply(null,arguments);var l=r.get(u);l||(r.set(u,l=new ty(t)),l.subscribe=e.subscribe,l.forget=function(){return r.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return r.set(u,l),Cc.add(r),vo.hasValue()||(Cc.forEach(function(p){return p.clean()}),Cc.clear()),d};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(u){var l=r.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=r.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return r.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 t(){this.getFragmentDoc=cn(tc)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(T(T({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(T(T({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=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:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(T(T({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(T(T({},e),{data:a})),a)}})},t}();var Xi=function(t){Ae(e,t);function e(r,n,i,a){var o,s=t.call(this,r)||this;if(s.message=r,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 ea(t){return t==null}function So(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=ea(n)?ea(i)?void 0:{_id:i}:{id:n}),ea(n)&&!ea(i)&&(n=i),!ea(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Af={dataIdFromObject:So,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Of(t){return Ir(Af,t)}function wo(t){var e=t.canonizeResults;return e===void 0?Af.canonizeResults:e}function Df(t,e){return te(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Lc=/^[_a-z][_0-9a-z]*/i;function jt(t){var e=t.match(Lc);return e?e[0]:t}function _o(t,e,r){return se(e)?ye(e)?e.every(function(n){return _o(t,n,r)}):t.selections.every(function(n){if(gt(n)&&sr(n,r)){var i=It(n);return Oe.call(e,i)&&(!n.selectionSet||_o(n.selectionSet,e[i],r))}return!0}):!1}function Ar(t){return se(t)&&!te(t)&&!ye(t)}function Nf(){return new lt}function Eo(t,e){var r=en(rn(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var xo=Object.create(null),$c=function(){return xo},Cf=Object.create(null),ii=function(){function t(e,r){var n=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(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 t.prototype.toObject=function(){return T({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),Oe.call(this.data,e)){var n=this.data[e];if(n&&Oe.call(n,r))return n[r]}if(r==="__typename"&&Oe.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Oe.call(this.data,e))return this.data[e];if(this instanceof Or)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;te(e)&&(e=e.__ref),te(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new lt(cy).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=jt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Or)&&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)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:xo,INVALIDATE:Cf,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=jt(u),d=i[u];if(d!==void 0){var p=typeof r=="function"?r:r[u]||r[l];if(p){var f=p===$c?xo:p(Gi(d),T(T({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Cf?n.group.dirty(e,u):(f===xo&&(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 Or?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=$c,i):$c)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Oe.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Oe.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Oe.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Or?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){Oe.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Oe.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){te(a)&&(r[a.__ref]=!0),se(a)&&Object.keys(a).forEach(function(o){var s=a[o];se(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var Rf=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?bo():null,this.keyMaker=new Wt(kt)},t.prototype.depend=function(e,r){if(this.d){this.d(Mc(e,r));var n=jt(r);n!==r&&this.d(Mc(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Mc(e,r),r==="__exists"?"forget":"setDirty")},t}();function Mc(t,e){return e+"#"+t}function jc(t,e){un(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Ae(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=r.call(this,a,new Rf(s))||this;return u.stump=new sy(u),u.storageTrie=new Wt(kt),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}(t);t.Root=e})(ii||(ii={}));var Or=function(t){Ae(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===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){xe(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 T(T({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Oe.call(this.data,r)?T(T({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(ii),sy=function(t){Ae(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Rf(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Or);function cy(t,e,r){var n=t[r],i=e[r];return xe(n,i)?n:i}function un(t){return!!(t instanceof ii&&t.group.caching)}function uy(t){return se(t)?ye(t)?t.slice(0):T({__proto__:Object.getPrototypeOf(t)},t):t}var To=function(){function t(){this.known=new(Ll?WeakSet:Set),this.pool=new Wt(kt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return se(e)&&this.known.has(e)},t.prototype.pass=function(e){if(se(e)){var r=uy(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(se(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(r.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},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var vt=Object.assign(function(t){if(se(t)){Uc===void 0&&Pf();var e=Uc.admit(t),r=qc.get(e);return r===void 0&&qc.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:Pf}),Uc,qc;function Pf(){Uc=new To,qc=new(kt?WeakMap:Map)}function Ff(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var Lf=function(){function t(e){var r=this;this.knownResults=new(kt?WeakMap:Map),this.config=Ir(e,{addTypename:e.addTypename!==!1,canonizeResults:wo(e)}),this.canon=e.canon||new To,this.executeSelectionSet=cn(function(n){var i,a=n.context.canonizeResults,o=Ff(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?T(T({},s),{result:r.canon.admit(s.result)}):s:(jc(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Ff,makeCacheKey:function(n,i,a,o){if(un(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=cn(function(n){return jc(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(un(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new To},t.prototype.diffQueryAgainstStore=function(e){var r=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=T(T({},an(Vi(n))),o);var p=zt(a),f=this.executeSelectionSet({selectionSet:nn(n).selectionSet,objectOrReference:p,enclosingRef:p,context:T({store:r,query:n,policies:d,variables:o,varString:vt(o),canonizeResults:l},Eo(n,this.config.fragments))}),h;if(f.missing&&(h=[new Xi(ly(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(un(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=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"),d=[],p,f=new lt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(w,b){var A;return w.missing&&(p=f.merge(p,(A={},A[b]=w.missing,A))),w.result}var m=new Set(n.selections);m.forEach(function(w){var b,A;if(!!sr(w,s))if(gt(w)){var R=c.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),E=It(w);R===void 0?on.added(w)||(p=f.merge(p,(b={},b[E]="Can't find field '".concat(w.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),b))):ye(R)?R=h(r.executeSubSelectedArray({field:w,array:R,enclosingRef:a,context:o}),E):w.selectionSet?R!=null&&(R=h(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:R,enclosingRef:te(R)?R:a,context:o}),E)):o.canonizeResults&&(R=r.canon.pass(R)),R!==void 0&&d.push((A={},A[E]=R,A))}else{var C=tn(w,o.lookupFragment);if(!C&&w.kind===Pe.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(w.name.value)):new K(5);C&&c.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(m.add,m)}});var g=Qi(d),_={result:g,missing:p},S=o.canonizeResults?this.canon.admit(_):Gi(_);return S.result&&this.knownResults.set(S.result,n),S},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new lt;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:ye(l)?u(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),d):(__DEV__&&fy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function ly(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function fy(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){se(i)&&(__DEV__?L(!te(i),"Missing selection set for object of type ".concat(Df(t,i)," returned for query field ").concat(e.name.value)):L(!te(i),6),Object.values(i).forEach(n.add,n))})}}var ai=new ri,$f=new WeakMap;function ta(t){var e=$f.get(t);return e||$f.set(t,e={vars:new Set,dep:bo()}),e}function Bc(t){ta(t).vars.forEach(function(e){return e.forgetCache(t)})}function Mf(t){ta(t).vars.forEach(function(e){return e.attachCache(t)})}function Io(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(c){ta(c).dep.dirty(n),py(c)});var o=Array.from(r);r.clear(),o.forEach(function(c){return c(t)})}}else{var s=ai.getValue();s&&(i(s),ta(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.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 py(t){t.broadcastWatches&&t.broadcastWatches()}var jf=Object.create(null);function Vc(t){var e=JSON.stringify(t);return jf[e]||(jf[e]=Object.create(null))}function Qc(t){var e=Vc(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Gc(t,function(o){var s=oi(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Oe.call(r,o[0])&&(s=oi(r,o,qf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function zc(t){var e=Vc(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=Gc(t,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(_){return _.name.value===p}),h=f&&cr(f,a);return h&&oi(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Oe.call(a,m)){var g=u.slice(0);return g[0]=m,oi(a,g)}return}if(r)return oi(r,u)}),c=JSON.stringify(s);return(r||c!=="{}")&&(o+=":"+c),o})}function Gc(t,e){var r=new lt;return Uf(t).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=r.merge(n,o)}return n},Object.create(null))}function Uf(t){var e=Vc(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){ye(i)?(Uf(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),ye(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function qf(t,e){return t[e]}function oi(t,e,r){return r=r||qf,Bf(e.reduce(function n(i,a){return ye(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Bf(t){return se(t)?ye(t)?t.map(Bf):Gc(Object.keys(t).sort(),function(e){return oi(t,e)}):t}qi.setStringify(vt);function Wc(t){return t.args!==void 0?t.args:t.field?cr(t.field,t.variables):null}var dy=function(){},Vf=function(t,e){return e.fieldName},Qf=function(t,e,r){var n=r.mergeObjects;return n(t,e)},zf=function(t,e){return e},Wf=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=T({dataIdFromObject:So},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,r){var n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=T(T({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var p=ko(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(ye(d))l=Qc(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},t.prototype.addTypePolicies=function(e){var r=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&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Oe.call(r.toBeAdded,n)?r.toBeAdded[n].push(c):r.toBeAdded[n]=[c]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Qf:u===!1?zf:c.merge}s(i,r.merge),i.keyFn=a===!1?dy:ye(a)?Qc(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?Vf:ye(d)?zc(d):typeof d=="function"?d:u.keyFn,typeof p=="function"&&(u.read=p),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Vf)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==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[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match(Lc);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=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=r.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){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),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(r," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&p===c.length-1&&_o(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var g=r.match(h);g&&g[0]===r&&u(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},c=Wc(e);o;){var u=o(c,s);if(ye(u))o=zc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?nc(e.field,e.variables):qi(n,Wc(e))),a===!1?n:n===jt(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=jt(o),c=r.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=Gf(this,n,e,r,r.store.getStorage(te(n)?n.__ref:n,o));return ai.withValue(this.cache,l,[c,d])}return c}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===Qf?Kf(i.store)(e,r):c===zf?r:(i.overwrite&&(e=void 0),c(e,r,Gf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Gf(t,e,r,n,i){var a=t.getStoreFieldName(r),o=jt(a),s=r.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Wc(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:u,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(ko(arguments,e,s),n)},mergeObjects:Kf(n.store)}}function ko(t,e,r){var n=t[0],i=t[1],a=t.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=T({},n),Oe.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Ul(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Kf(t){return function(r,n){if(ye(r)||ye(n))throw __DEV__?new K("Cannot automatically merge arrays"):new K(4);if(se(r)&&se(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(te(r)&&Ar(n))return t.merge(r.__ref,n),r;if(Ar(r)&&te(n))return t.merge(r,n.__ref),n;if(Ar(r)&&Ar(n))return T(T({},r),n)}return n}}function Kc(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:T(T({},t),{clientOnly:e,deferred:r})),i}var Zf=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,c=r.overwrite,u=Gt(i),l=Nf();s=T(T({},an(u)),s);var d=T(T({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:vt(s)},Eo(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(!te(p))throw __DEV__?new K("Could not identify object ".concat(JSON.stringify(a))):new K(7);return d.incomingById.forEach(function(f,h){var m=f.storeObject,g=f.mergeTree,_=f.fieldNodeSet,S=zt(h);if(g&&g.map.size){var w=n.applyMerges(g,S,m,d);if(te(w))return;m=w}if(__DEV__&&!d.overwrite){var b=Object.create(null);_.forEach(function(E){E.selectionSet&&(b[E.name.value]=!0)});var A=function(E){return b[jt(E)]===!0},R=function(E){var C=g&&g.map.get(E);return Boolean(C&&C.info&&C.info.merge)};Object.keys(m).forEach(function(E){A(E)&&!R(E)&&hy(S,m,E,d.store)})}e.merge(h,m)}),e.retain(p.__ref),p},t.prototype.processSelectionSet=function(e){var r=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 w=ko(arguments,u,o.variables);if(te(w.from)){var b=o.incomingById.get(w.from.__ref);if(b){var A=c.readField(T(T({},w),{from:b.storeObject}),o);if(A!==void 0)return A}}return c.readField(w,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(w,b){var A,R=It(b),E=i[R];if(p.add(b),E!==void 0){var C=c.getStoreFieldName({typename:l,fieldName:b.name.value,field:b,variables:w.variables}),F=Hf(s,C),P=r.processFieldValue(E,b,b.selectionSet?Kc(w,!1,!1):w,F),M=void 0;b.selectionSet&&(te(P)||Ar(P))&&(M=d("__typename",P));var Ee=c.getMergeFunction(l,b.name.value,M);Ee?F.info={field:b,typename:l,merge:Ee}:Jf(s,C),u=w.merge(u,(A={},A[C]=P,A))}else __DEV__&&!w.clientOnly&&!w.deferred&&!on.added(b)&&!c.getReadFunction(l,b.name.value)&&__DEV__&&L.error("Missing field '".concat(It(b),"' 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(w){if(!n)throw w}if(typeof n=="string"){var g=zt(n),_=o.written[n]||(o.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var S=o.incomingById.get(n);return S?(S.storeObject=o.merge(S.storeObject,u),S.mergeTree=Hc(S.mergeTree,s),p.forEach(function(w){return S.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:u,mergeTree:Ao(s)?void 0:s,fieldNodeSet:p}),g}return u},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?so(e):e:ye(e)?e.map(function(o,s){var c=a.processFieldValue(o,r,n,Hf(i,s));return Jf(i,s),c}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=Bi(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Wt(!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(!!sr(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&$e(p.directives)&&p.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(f=!0),S==="defer"){var w=cr(_,n.variables);(!w||w.if!==!1)&&(h=!0)}}),gt(p)){var m=a.get(p);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(p,Kc(n,f,h))}else{var g=tn(p,n.lookupFragment);if(!g&&p.kind===Pe.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(p.name.value)):new K(8);g&&o.fragmentMatches(g,i,r,n.variables)&&c(g.selectionSet,Kc(n,f,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var c=!ye(n)&&(te(r)||Ar(r))?r:void 0,u=n;c&&!a&&(a=[te(c)?c.__ref:c]);var l,d=function(p,f){return ye(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=ye(u)?u.slice(0):T({},u),l.forEach(function(p,f){n[f]=p}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Xf=[];function Hf(t,e){var r=t.map;return r.has(e)||r.set(e,Xf.pop()||{map:new Map}),r.get(e)}function Hc(t,e){if(t===e||!e||Ao(e))return t;if(!t||Ao(t))return e;var r=t.info&&e.info?T(T({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){var o=new Set(e.map.keys());t.map.forEach(function(s,c){a.map.set(c,Hc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Hc(e.map.get(s),t.map.get(s)))})}return a}function Ao(t){return!t||!(t.info||t.map.size)}function Jf(t,e){var r=t.map,n=r.get(e);n&&Ao(n)&&(Xf.push(n),r.delete(e))}var Yf=new Set;function hy(t,e,r,n){var i=function(d){var p=n.getFieldValue(d,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!te(a)&&!xe(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),c=jt(r),u="".concat(s,".").concat(c);if(!Yf.has(u)){Yf.add(u);var l=[];!ye(a)&&!ye(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.
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 Ao=function(t){ke(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=To,n.txCount=0,n.config=Of(r),n.addTypename=!!n.config.addTypename,n.policies=new Gf({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new ii.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new Zf(this,this.storeReader=new Ff({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:So(this.config),canon:r?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=cn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(un(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,vt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(E(E({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Xi)return null;throw a}},e.prototype.write=function(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(Ae.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(E(E({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||Mf(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&Bc(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){vt.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(te(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&P.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Ae.call(r,"id"))return!1;r=E(E({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var n=this;return this.init(),vt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Bc(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,c=r.onWatchUpdated,u,l=function(p){var f=n,h=f.data,m=f.optimisticData;++n.txCount,p&&(n.data=n.optimisticData=p);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(E(E({},r),{onWatchUpdated:function(p){return d.add(p),!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&&d.size?(this.broadcastWatches(E(E({},r),{onWatchUpdated:function(p,f){var h=c.call(this,p,f);return h!==!1&&d.delete(p),h}})),d.size&&d.forEach(function(p){return n.maybeBroadcastWatch.dirty(p)})):this.broadcastWatches(r),u},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=on(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.transformForLink=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!Ee(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Lc);function ep(t){return t.hasOwnProperty("graphQLErrors")}var my=function(t){var e="";if(Fe(t.graphQLErrors)||Fe(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
47
+ `))}}}}var Oo=function(t){Ae(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=Io,n.txCount=0,n.config=Of(r),n.addTypename=!!n.config.addTypename,n.policies=new Wf({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new ii.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new Zf(this,this.storeReader=new Lf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:wo(this.config),canon:r?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=cn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(un(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,vt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(T(T({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Xi)return null;throw a}},e.prototype.write=function(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(Oe.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(T(T({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||Mf(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&Bc(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){vt.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(te(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&L.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Oe.call(r,"id"))return!1;r=T(T({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var n=this;return this.init(),vt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Bc(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,c=r.onWatchUpdated,u,l=function(p){var f=n,h=f.data,m=f.optimisticData;++n.txCount,p&&(n.data=n.optimisticData=p);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(T(T({},r),{onWatchUpdated:function(p){return d.add(p),!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&&d.size?(this.broadcastWatches(T(T({},r),{onWatchUpdated:function(p,f){var h=c.call(this,p,f);return h!==!1&&d.delete(p),h}})),d.size&&d.forEach(function(p){return n.maybeBroadcastWatch.dirty(p)})):this.broadcastWatches(r),u},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=on(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.transformForLink=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!xe(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Fc);function ep(t){return t.hasOwnProperty("graphQLErrors")}var my=function(t){var e="";if($e(t.graphQLErrors)||$e(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
48
48
  `)})}return t.networkError&&(e+="".concat(t.networkError.message,`
49
- `)),e=e.replace(/\n$/,""),e},ur=function(t){ke(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,c=t.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||my(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var fe;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(fe||(fe={}));function Dr(t){return t?t<7:!1}var yy=Object.assign,gy=Object.hasOwnProperty,Oo=function(t){ke(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(g){try{var w=g._subscription._observer;w&&!w.error&&(w.error=vy)}catch{}var b=!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),b&&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,d=a.fetchPolicy,p=d===void 0?l:d,f=a.initialFetchPolicy,h=f===void 0?p==="standby"?l:p:f;o.options=E(E({},a),{initialFetchPolicy:h,fetchPolicy:p}),o.queryId=i.queryId||n.generateQueryId();var m=Wt(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var r=this;return new Promise(function(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||fe.ready,a=E(E({},n),{loading:Dr(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&&Yc(c.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,n){return!this.last||!Ee(this.last.result,r)||n&&!Ee(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||Ee(i.variables,this.variables)))return i[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){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__&&r&&gy.call(r,"variables")){var o=Vi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&P.warn("Called refetch(".concat(JSON.stringify(r),") 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 r&&!Ee(this.options.variables,r)&&(i.variables=this.options.variables=E(E({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,fe.refetch)},e.prototype.fetchMore=function(r){var n=this,i=E(E({},r.query?r:E(E(E(E({},this.options),{query:this.query}),r),{variables:E(E({},this.options.variables),r.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=r.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)||Jc(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(r.onError){r.onError(a);return}__DEV__&&P.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return Ee(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},fe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,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:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=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__?P(a,"Attempted to start a polling query without a polling interval."):P(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Dr(r.queryInfo.networkStatus)?c():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},fe.poll).then(c,c))},c=function(){var u=r.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(r,n){return n===void 0&&(n=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?r:oo(r),variables:n}),Fe(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,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=Ir(this.options,r||{}),u=a?c:yy(this.options,c);a||(this.updatePolling(),r&&r.variables&&!Ee(r.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(r,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r,n))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),sn(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=E(E({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:fe.error,loading:!1});this.updateLastResult(i,n),sn(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ee);co(Oo);function Jc(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):r}}):t.reobserve()}function vy(t){__DEV__&&P.error("Unhandled error",t.message,t.stack)}function Yc(t){__DEV__&&t&&__DEV__&&P.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var Do=function(){function t(e){var r=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=lc(r.resolvers,n)}):this.resolvers=lc(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Lt(this,void 0,void 0,function(){return Ft(this,function(c){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(u){return E(E({},n),{data:u.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return uc(e)},t.prototype.prepareContext=function(e){var r=this.cache;return E(E({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),Lt(this,void 0,void 0,function(){return Ft(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return E(E({},r),a.exportedVariables)})]:[2,E({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return et(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return Xr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:cc(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,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),Lt(this,void 0,void 0,function(){var s,c,u,l,d,p,f,h,m,g,w;return Ft(this,function(b){return s=nn(e),c=rn(e),u=en(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},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,r,g).then(function(S){return{result:S,exportedVariables:g.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Ft(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(p){return Lt(l,void 0,void 0,function(){var f,h;return Ft(this,function(m){return!r&&!i.selectionsToResolve.has(p)?[2]:sr(p,s)?gt(p)?[2,this.resolveField(p,r,n,i).then(function(g){var w;typeof g<"u"&&c.push((w={},w[It(p)]=g,w))})]:(ic(p)?f=p:(f=a[p.name.value],__DEV__?P(f,"No fragment named ".concat(p.name.value)):P(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,r,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},t.prototype.resolveField=function(e,r,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h=this;return Ft(this,function(m){return n?(a=i.variables,o=e.name.value,s=It(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(ai.withValue(this.cache,f,[n,cr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var w,b;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(_){_.name.value==="export"&&_.arguments&&_.arguments.forEach(function(A){A.name.value==="as"&&A.value.kind==="StringValue"&&(i.exportedVariables[A.value.value]=g)})}),!e.selectionSet||g==null)return g;var S=(b=(w=e.directives)===null||w===void 0?void 0:w.some(function(_){return _.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,r||S,g,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||S,g,i)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,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,r,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,i)}))},t.prototype.collectSelectionsToResolve=function(e,r){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),et(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=r[c.name.value];__DEV__?P(f,"No fragment named ".concat(c.name.value)):P(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)},t}();var si=new(kt?WeakMap:Map);function Zc(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return si.set(t,(si.get(t)+1)%1e15),r.apply(this,arguments)})}function tp(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var No=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;si.has(n)||(si.set(n,0),Zc(n,"evict"),Zc(n,"modify"),Zc(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||fe.loading;return this.variables&&this.networkStatus!==fe.loading&&!Ee(this.variables,e.variables)&&(r=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:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){tp(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&Ee(r,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(r);return this.updateLastDiff(i,r),i},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,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 r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=r.getDiff();n.fromOptimisticTransaction?e.observe():Jc(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;tp(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Dr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!Ee(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===si.get(this.cache)&&Ee(r,n.variables)&&Ee(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new lt,s=Fe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Fe(e.incremental)){var c=uo(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&&(Co(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:si.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)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=fe.ready},t.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},t}();function Co(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!ei(t);return!n&&r&&t.data&&(n=!0),n}var by=Object.prototype.hasOwnProperty,rp=function(){function t(e){var r=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(kt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=p||new Do({cache:r}),this.ssrMode=u,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new K("QueryManager stopped while query was in flight"):new K(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,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?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,g=e.errorPolicy,w=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,b=e.keepRootFields,S=e.context;return Lt(this,void 0,void 0,function(){var _,A,R,I,C,F;return Ft(this,function(L){switch(L.label){case 0:return __DEV__?P(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):P(i,15),__DEV__?P(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."):P(m==="network-only"||m==="no-cache",16),_=this.generateMutationId(),A=this.transform(i),R=A.document,I=A.hasClientExports,i=this.cache.transformForLink(R),a=this.getVariables(i,a),I?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=L.sent(),L.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[_]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:_,document:i,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:p,keepRootFields:b}),this.broadcastQueries(),F=this,[2,new Promise(function(M,le){return so(F.getObservableFromLink(i,E(E({},S),{optimisticResponse:o}),a,!1),function(Le){if(ei(Le)&&w==="none")throw new ur({graphQLErrors:lo(Le)});C&&(C.loading=!1,C.error=null);var z=E({},Le);return typeof u=="function"&&(u=u(z)),w==="ignore"&&ei(z)&&delete z.errors,F.markMutationResult({mutationId:_,result:z,document:i,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?_:void 0,onQueryUpdated:f,keepRootFields:b})}).subscribe({next:function(Le){F.broadcastQueries(),(!("hasNext"in Le)||Le.hasNext===!1)&&M(Le)},error:function(Le){C&&(C.loading=!1,C.error=Le),o&&F.cache.removeOptimistic(_),F.broadcastQueries(),le(Le instanceof ur?Le:new ur({networkError:Le}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Co(i,e.errorPolicy)){if(Tr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Tr(i)&&Fe(i.incremental)){var s=r.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=uo(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||!by.call(u,h))){var m=u[h],g=n.queries.get(p),w=g.document,b=g.variables,S=r.diff({query:w,variables:b,returnPartialData:!0,optimistic:!1}),_=S.result,A=S.complete;if(A&&_){var R=m(_,{mutationResult:i,queryName:w&&Jn(w)||void 0,queryVariables:b});R&&a.push({result:R,dataId:"ROOT_QUERY",query:w,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var p=e.update,f=!Ml(i)||Tr(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 w=g.fieldName,b=g.DELETE;return w==="__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)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(E(E({},r),{result:{data:i}}),a)}catch(o){__DEV__&&P.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=sc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:ec(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:an(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&&!r.has(u)&&r.set(u,s)};c(e),c(n),c(a),c(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return E(E({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new No(this),n=new Oo({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=this;return r===void 0&&(r=this.generateQueryId()),__DEV__?P(e.query,"query option is required. You must specify your GraphQL document in the query option."):P(e.query,17),__DEV__?P(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):P(e.query.kind==="Document",18),__DEV__?P(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):P(!e.returnPartialData,19),__DEV__?P(!e.pollInterval,"pollInterval option only supported on watchQuery."):P(!e.pollInterval,20),this.fetchQuery(r,e).finally(function(){return n.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new K("Store reset while query was in flight (not completed in link chain)"):new K(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=fe.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):rc(o)?i.set(r.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,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=r.getQuery(s).init({document:o.query,variables:o.variables}),u=new Oo({queryManager:r,queryInfo:c,options:E(E({},o),{fetchPolicy:"network-only"})});P(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&P.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},t.prototype.reFetchObservableQueries=function(e){var r=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()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=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 r.getObservableFromLink(n,c,d).map(function(p){if(i!=="no-cache"&&(Co(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),ei(p))throw new ur({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ee(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)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,n,i){var a=this,o;i===void 0&&(i=(o=r?.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:Jn(c)||void 0,context:this.prepareContext(E(E({},r),{forceFetch:!i}))};if(r=p.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=vt(n);if(s=f.get(h),!s){var m=new Xn([ti(d,p)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new Xn([ti(d,p)])}else s=new Xn([ee.of({data:{}})]),r=this.prepareContext(r);var g=this.transform(e).clientQuery;return g&&(s=so(s,function(w){return a.localState.runResolvers({document:g,remoteResult:w,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return so(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=lo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new ur({graphQLErrors:s}));e.markResult(o,a,n,r),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=ep(o)?o:new ur({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=fe.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=r.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=r.errorPolicy,p=d===void 0?c&&c.errorPolicy||"none":d,f=r.returnPartialData,h=f===void 0?!1:f,m=r.notifyOnNetworkStatusChange,g=m===void 0?!1:m,w=r.context,b=w===void 0?{}:w,S=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:g,context:b}),_=function(I){S.variables=I;var C=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),C},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(I){A(),setTimeout(function(){return R.cancel(I)})});var R=new Xn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(_):_(S.variables));return R.promise.then(A,A),R},t.prototype.refetchQueries=function(e){var r=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:r.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 No&&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,w;if(u){if(!g){var b=h.queryInfo;b.reset(),g=b.getDiff()}w=u(h,g,m)}(!u||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),f.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),d},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,a=r.query,o=r.variables,s=r.fetchPolicy,c=r.refetchWritePolicy,u=r.errorPolicy,l=r.returnPartialData,d=r.context,p=r.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(_,A){A===void 0&&(A=e.networkStatus||fe.loading);var R=_.result;__DEV__&&!l&&!Ee(R,{})&&Yc(_.missing);var I=function(C){return ee.of(E({data:C,loading:Dr(A),networkStatus:A},_.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(C){return I(C.data||void 0)}):u==="none"&&A===fe.refetch&&Array.isArray(_.missing)?I(void 0):I(R)},g=s==="no-cache"?0:n===fe.refetch&&c!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},b=p&&typeof f=="number"&&f!==n&&Dr(n);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||b?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||l||b?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),w()]:[w()];case"no-cache":return b?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new No(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return E(E({},r),{clientAwareness:this.clientAwareness})},t}();var np=!1;var Xc=function(){function t(e){var r=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,w=g===void 0?!1:g,b=e.resolvers,S=e.typeDefs,_=e.fragmentMatcher,A=e.name,R=e.version,I=e.link;if(I||(I=n?new kc({uri:n,credentials:i,headers:a}):At.empty()),!o)throw __DEV__?new K(`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 K(9);if(this.link=I,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return r.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!np&&p&&__DEV__&&(np=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,F=C&&C.userAgent,L=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?L="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(L="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),L&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+L)}this.version=Bl,this.localState=new Do({cache:o,client:this,resolvers:b,fragmentMatcher:_}),this.queryManager=new rp({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:R},localState:this.localState,assumeImmutableResults:w,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=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)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?P(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."):P(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return ti(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.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__&&P.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();hl(Zr?"log":"silent");function rt(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function lr(t){return rt(t)==="object"}function ip(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function eu(t,e){return t.length<124?t:e}var ap="graphql-transport-ws";var ft;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ft||(ft={}));var Oe;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Oe||(Oe={}));function op(t){if(!lr(t))throw new Error(`Message is expected to be an object, but got ${rt(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${rt(t.type)}`);switch(t.type){case Oe.ConnectionInit:case Oe.ConnectionAck:case Oe.Ping:case Oe.Pong:{if(t.payload!=null&&!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Oe.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${rt(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${rt(t.payload.query)}`);if(t.payload.variables!=null&&!lr(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${rt(t.payload.variables)}`);if(t.payload.operationName!=null&&rt(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${rt(t.payload.operationName)}`);if(t.payload.extensions!=null&&!lr(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${rt(t.payload.extensions)}`);break}case Oe.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${rt(t.payload)}`);break}case Oe.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ip(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Oe.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function sp(t,e){return op(typeof t=="string"?JSON.parse(t,e):t)}function ci(t,e){return op(t),JSON.stringify(t,e)}function tu(t){let{url:e,connectionParams:r,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 ve=1e3;for(let ie=0;ie<ge;ie++)ve*=2;await new Promise(ie=>setTimeout(ie,ve+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Ro,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ge=>{let ve=Math.random()*16|0;return(ge=="x"?ve:ve&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:w}=t,b;if(h){if(!Sy(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=b,_=(()=>{let z=(()=>{let ve={};return{on(ie,ae){return ve[ie]=ae,()=>{delete ve[ie]}},emit(ie){var ae;"id"in ie&&((ae=ve[ie.id])===null||ae===void 0||ae.call(ve,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?[z.emit,f.message]:[z.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:z.on,on(ve,ie){let ae=ge[ve];return ae.push(ie),()=>{ae.splice(ae.indexOf(ie),1)}},emit(ve,...ie){for(let ae of[...ge[ve]])ae(...ie)}}})();function A(z){let ge=[_.on("error",ve=>{ge.forEach(ie=>ie()),z(ve)}),_.on("closed",ve=>{ge.forEach(ie=>ie()),z(ve)})]}let R,I=0,C,F=!1,L=0,M=!1;async function le(){clearTimeout(C);let[z,ge]=await(R??(R=new Promise((ae,Bt)=>(async()=>{if(F){if(await l(L),!I)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});L++}_.emit("connecting");let X=new S(typeof e=="function"?await e():e,ap),Vt,_r;function Ha(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{X.readyState===S.OPEN&&(X.send(ci({type:Oe.Ping})),_.emit("ping",!1,void 0))},o))}A(We=>{R=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(We),Ro(We)&&We.code===4499&&(X.close(4499,"Terminated"),X.onerror=null,X.onclose=null)}),X.onerror=We=>_.emit("error",We),X.onclose=We=>_.emit("closed",We),X.onopen=async()=>{try{_.emit("opened",X);let We=typeof r=="function"?await r():r;if(X.readyState!==S.OPEN)return;X.send(ci(We?{type:Oe.ConnectionInit,payload:We}:{type:Oe.ConnectionInit},g)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{X.close(ft.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ha()}catch(We){_.emit("error",We),X.close(ft.InternalClientError,eu(We instanceof Error?We.message:new Error(We).message,"Internal client error"))}};let Wn=!1;X.onmessage=({data:We})=>{try{let Ge=sp(We,w);if(_.emit("message",Ge),Ge.type==="ping"||Ge.type==="pong"){_.emit(Ge.type,!0,Ge.payload),Ge.type==="pong"?Ha():s||(X.send(ci(Ge.payload?{type:Oe.Pong,payload:Ge.payload}:{type:Oe.Pong})),_.emit("pong",!1,Ge.payload));return}if(Wn)return;if(Ge.type!==Oe.ConnectionAck)throw new Error(`First message cannot be of type ${Ge.type}`);clearTimeout(Vt),Wn=!0,_.emit("connected",X,Ge.payload),F=!1,L=0,ae([X,new Promise((W_,Oh)=>A(Oh))])}catch(Ge){X.onmessage=null,_.emit("error",Ge),X.close(ft.BadResponse,eu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Bad response"))}}})())));z.readyState===S.CLOSING&&await ge;let ve=()=>{},ie=new Promise(ae=>ve=ae);return[z,ve,Promise.race([ie.then(()=>{if(!I){let ae=()=>z.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{z.readyState===S.OPEN&&ae()},a):ae()}}),ge])]}function Le(z){if(Ro(z)&&(_y(z.code)||[ft.InternalServerError,ft.InternalClientError,ft.BadRequest,ft.BadResponse,ft.Unauthorized,ft.SubprotocolNotAcceptable,ft.SubscriberAlreadyExists,ft.TooManyInitialisationRequests].includes(z.code)))throw z;if(M)return!1;if(Ro(z)&&z.code===1e3)return I>0;if(!u||L>=u||!d(z)||p?.(z))throw z;return F=!0}return n||(async()=>{for(I++;;)try{let[,,z]=await le();await z}catch(z){try{if(!Le(z))return}catch(ge){return i?.(ge)}}})(),{on:_.on,subscribe(z,ge){let ve=m(z),ie=!1,ae=!1,Bt=()=>{I--,ie=!0};return(async()=>{for(I++;;)try{let[X,Vt,_r]=await le();if(ie)return Vt();let Ha=_.onMessage(ve,Wn=>{switch(Wn.type){case Oe.Next:{ge.next(Wn.payload);return}case Oe.Error:{ae=!0,ie=!0,ge.error(Wn.payload),Bt();return}case Oe.Complete:{ie=!0,Bt();return}}});X.send(ci({id:ve,type:Oe.Subscribe,payload:z},g)),Bt=()=>{!ie&&X.readyState===S.OPEN&&X.send(ci({id:ve,type:Oe.Complete},g)),I--,ie=!0,Vt()},await _r.finally(Ha);return}catch(X){if(!Le(X))return}})().then(()=>{ae||ge.complete()}).catch(X=>{ge.error(X)}),()=>{ie||Bt()}},async dispose(){if(M=!0,R){let[z]=await R;z.close(1e3,"Normal Closure")}},terminate(){R&&_.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Ro(t){return lr(t)&&"code"in t&&"reason"in t}function _y(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function Sy(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function wy(t){return oe(t)&&"code"in t&&"reason"in t}var cp=function(t){ke(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new ee(function(i){return n.client.subscribe(E(E({},r),{query:Gn(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):wy(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Po="0.11.2-dev";function up(){return typeof window!="undefined"&&window.self!==window.top}function ru(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function fr(t,e){ru()&&localStorage.setItem(`${Po}/${t}`,e)}function Lo(t){return ru()?localStorage.getItem(`${Po}/${t}`):null}function Fo(t){ru()&&localStorage.removeItem(`${Po}/${t}`)}function lp(t,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((r,n)=>{let i;try{i=new WebSocket(t,"graphql-transport-ws"),i.onopen=()=>{i.close(),r(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((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(r){return typeof r}:Jo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Jo(t)}function xy(t){return Jo(t)=="object"&&t!==null}var Ad=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wu(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Ty(t){return Od(t.source,wu(t.source,t.start))}function Od(t,e){var r=t.locationOffset.column-1,n=Yo(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,c=e.column+s,u="".concat(t.name,":").concat(o,":").concat(c,`
49
+ `)),e=e.replace(/\n$/,""),e},ur=function(t){Ae(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,c=t.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||my(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var fe;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(fe||(fe={}));function Dr(t){return t?t<7:!1}var yy=Object.assign,gy=Object.hasOwnProperty,Do=function(t){Ae(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(g){try{var _=g._subscription._observer;_&&!_.error&&(_.error=vy)}catch{}var S=!o.observers.size;o.observers.add(g);var w=o.last;return w&&w.error?g.error&&g.error(w.error):w&&w.result&&g.next&&g.next(w.result),S&&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,d=a.fetchPolicy,p=d===void 0?l:d,f=a.initialFetchPolicy,h=f===void 0?p==="standby"?l:p:f;o.options=T(T({},a),{initialFetchPolicy:h,fetchPolicy:p}),o.queryId=i.queryId||n.generateQueryId();var m=Gt(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var r=this;return new Promise(function(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||fe.ready,a=T(T({},n),{loading:Dr(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),xe(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&&Yc(c.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,n){return!this.last||!xe(this.last.result,r)||n&&!xe(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||xe(i.variables,this.variables)))return i[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){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__&&r&&gy.call(r,"variables")){var o=Vi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(r),") 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 r&&!xe(this.options.variables,r)&&(i.variables=this.options.variables=T(T({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,fe.refetch)},e.prototype.fetchMore=function(r){var n=this,i=T(T({},r.query?r:T(T(T(T({},this.options),{query:this.query}),r),{variables:T(T({},this.options.variables),r.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=r.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)||Jc(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(r.onError){r.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(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return xe(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},fe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,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:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=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(){r.pollingInfo&&(Dr(r.queryInfo.networkStatus)?c():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},fe.poll).then(c,c))},c=function(){var u=r.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(r,n){return n===void 0&&(n=this.variables),this.last=T(T({},this.last),{result:this.queryManager.assumeImmutableResults?r:so(r),variables:n}),$e(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,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=Ir(this.options,r||{}),u=a?c:yy(this.options,c);a||(this.updatePolling(),r&&r.variables&&!xe(r.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=fe.setVariables)));var l=u.variables&&T({},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(r,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r,n))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),sn(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=T(T({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:fe.error,loading:!1});this.updateLastResult(i,n),sn(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ee);uo(Do);function Jc(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):r}}):t.reobserve()}function vy(t){__DEV__&&L.error("Unhandled error",t.message,t.stack)}function Yc(t){__DEV__&&t&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var No=function(){function t(e){var r=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=lc(r.resolvers,n)}):this.resolvers=lc(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ft(this,void 0,void 0,function(){return Lt(this,function(c){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(u){return T(T({},n),{data:u.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return uc(e)},t.prototype.prepareContext=function(e){var r=this.cache;return T(T({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),Ft(this,void 0,void 0,function(){return Lt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return T(T({},r),a.exportedVariables)})]:[2,T({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return et(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return Xr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:cc(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,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),Ft(this,void 0,void 0,function(){var s,c,u,l,d,p,f,h,m,g,_;return Lt(this,function(S){return s=nn(e),c=rn(e),u=en(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:T(T({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:p,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,r,g).then(function(w){return{result:w,exportedVariables:g.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,i){return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Lt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(p){return Ft(l,void 0,void 0,function(){var f,h;return Lt(this,function(m){return!r&&!i.selectionsToResolve.has(p)?[2]:sr(p,s)?gt(p)?[2,this.resolveField(p,r,n,i).then(function(g){var _;typeof g<"u"&&c.push((_={},_[It(p)]=g,_))})]:(ic(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,r,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},t.prototype.resolveField=function(e,r,n,i){return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h=this;return Lt(this,function(m){return n?(a=i.variables,o=e.name.value,s=It(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(ai.withValue(this.cache,f,[n,cr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var _,S;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(b){b.name.value==="export"&&b.arguments&&b.arguments.forEach(function(A){A.name.value==="as"&&A.value.kind==="StringValue"&&(i.exportedVariables[A.value.value]=g)})}),!e.selectionSet||g==null)return g;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(b){return b.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,r||w,g,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||w,g,i)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,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,r,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,i)}))},t.prototype.collectSelectionsToResolve=function(e,r){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),et(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=r[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)},t}();var si=new(kt?WeakMap:Map);function Zc(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return si.set(t,(si.get(t)+1)%1e15),r.apply(this,arguments)})}function tp(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var Co=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;si.has(n)||(si.set(n,0),Zc(n,"evict"),Zc(n,"modify"),Zc(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||fe.loading;return this.variables&&this.networkStatus!==fe.loading&&!xe(this.variables,e.variables)&&(r=fe.setVariables),xe(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){tp(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&xe(r,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(r);return this.updateLastDiff(i,r),i},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!xe(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=r.getDiff();n.fromOptimisticTransaction?e.observe():Jc(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;tp(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Dr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=T(T({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!xe(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===si.get(this.cache)&&xe(r,n.variables)&&xe(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new lt,s=$e(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&$e(e.incremental)){var c=lo(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&&(Ro(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:si.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)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=fe.ready},t.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},t}();function Ro(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!ei(t);return!n&&r&&t.data&&(n=!0),n}var by=Object.prototype.hasOwnProperty,rp=function(){function t(e){var r=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(kt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=p||new No({cache:r}),this.ssrMode=u,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new K("QueryManager stopped while query was in flight"):new K(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,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?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,g=e.errorPolicy,_=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,S=e.keepRootFields,w=e.context;return Ft(this,void 0,void 0,function(){var b,A,R,E,C,F;return Lt(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(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),b=this.generateMutationId(),A=this.transform(i),R=A.document,E=A.hasClientExports,i=this.cache.transformForLink(R),a=this.getVariables(i,a),E?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[b]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:b,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:p,keepRootFields:S}),this.broadcastQueries(),F=this,[2,new Promise(function(M,Ee){return co(F.getObservableFromLink(i,T(T({},w),{optimisticResponse:o}),a,!1),function(ne){if(ei(ne)&&_==="none")throw new ur({graphQLErrors:fo(ne)});C&&(C.loading=!1,C.error=null);var j=T({},ne);return typeof u=="function"&&(u=u(j)),_==="ignore"&&ei(j)&&delete j.errors,F.markMutationResult({mutationId:b,result:j,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?b:void 0,onQueryUpdated:f,keepRootFields:S})}).subscribe({next:function(ne){F.broadcastQueries(),(!("hasNext"in ne)||ne.hasNext===!1)&&M(ne)},error:function(ne){C&&(C.loading=!1,C.error=ne),o&&F.cache.removeOptimistic(b),F.broadcastQueries(),Ee(ne instanceof ur?ne:new ur({networkError:ne}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Ro(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=r.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=lo(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||!by.call(u,h))){var m=u[h],g=n.queries.get(p),_=g.document,S=g.variables,w=r.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),b=w.result,A=w.complete;if(A&&b){var R=m(b,{mutationResult:i,queryName:_&&Jn(_)||void 0,queryVariables:S});R&&a.push({result:R,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var p=e.update,f=!Ml(i)||Tr(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=T(T({},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 _=g.fieldName,S=g.DELETE;return _==="__typename"?m:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(T(T({},r),{result:{data:i}}),a)}catch(o){__DEV__&&L.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=sc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:ec(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:an(Gt(n)),asQuery:T(T({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?T(T({},u),{operation:"query"}):u})})},c=function(u){u&&!r.has(u)&&r.set(u,s)};c(e),c(n),c(a),c(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return T(T({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=T(T({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new Co(this),n=new Do({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=this;return r===void 0&&(r=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(r,e).finally(function(){return n.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new K("Store reset while query was in flight (not completed in link chain)"):new K(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=fe.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):rc(o)?i.set(r.transform(o).document,!1):se(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=Wi("legacyOneTimeQuery"),c=r.getQuery(s).init({document:o.query,variables:o.variables}),u=new Do({queryManager:r,queryInfo:c,options:T(T({},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},t.prototype.reFetchObservableQueries=function(e){var r=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()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=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 r.getObservableFromLink(n,c,d).map(function(p){if(i!=="no-cache"&&(Ro(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),ei(p))throw new ur({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ee(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)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,n,i){var a=this,o;i===void 0&&(i=(o=r?.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:Jn(c)||void 0,context:this.prepareContext(T(T({},r),{forceFetch:!i}))};if(r=p.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=vt(n);if(s=f.get(h),!s){var m=new Xn([ti(d,p)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new Xn([ti(d,p)])}else s=new Xn([ee.of({data:{}})]),r=this.prepareContext(r);var g=this.transform(e).clientQuery;return g&&(s=co(s,function(_){return a.localState.runResolvers({document:g,remoteResult:_,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return co(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=fo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new ur({graphQLErrors:s}));e.markResult(o,a,n,r),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=ep(o)?o:new ur({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=fe.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=r.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=r.errorPolicy,p=d===void 0?c&&c.errorPolicy||"none":d,f=r.returnPartialData,h=f===void 0?!1:f,m=r.notifyOnNetworkStatusChange,g=m===void 0?!1:m,_=r.context,S=_===void 0?{}:_,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:g,context:S}),b=function(E){w.variables=E;var C=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),C},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){A(),setTimeout(function(){return R.cancel(E)})});var R=new Xn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(b):b(w.variables));return R.promise.then(A,A),R},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Wi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(p,f){l.set(f,{oq:p,lastDiff:r.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,_;if(u){if(!g){var S=h.queryInfo;S.reset(),g=S.getDiff()}_=u(h,g,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),f.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),d},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,a=r.query,o=r.variables,s=r.fetchPolicy,c=r.refetchWritePolicy,u=r.errorPolicy,l=r.returnPartialData,d=r.context,p=r.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(b,A){A===void 0&&(A=e.networkStatus||fe.loading);var R=b.result;__DEV__&&!l&&!xe(R,{})&&Yc(b.missing);var E=function(C){return ee.of(T({data:C,loading:Dr(A),networkStatus:A},b.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(C){return E(C.data||void 0)}):u==="none"&&A===fe.refetch&&Array.isArray(b.missing)?E(void 0):E(R)},g=s==="no-cache"?0:n===fe.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},S=p&&typeof f=="number"&&f!==n&&Dr(n);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Co(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return T(T({},r),{clientAwareness:this.clientAwareness})},t}();var np=!1;var Xc=function(){function t(e){var r=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,_=g===void 0?!1:g,S=e.resolvers,w=e.typeDefs,b=e.fragmentMatcher,A=e.name,R=e.version,E=e.link;if(E||(E=n?new kc({uri:n,credentials:i,headers:a}):At.empty()),!o)throw __DEV__?new K(`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 K(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return r.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!np&&p&&__DEV__&&(np=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,F=C&&C.userAgent,P=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Bl,this.localState=new No({cache:o,client:this,resolvers:S,fragmentMatcher:b}),this.queryManager=new rp({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:R},localState:this.localState,assumeImmutableResults:_,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=T(T({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.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=T(T({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return ti(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.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},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();hl(Zr?"log":"silent");function rt(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function lr(t){return rt(t)==="object"}function ip(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function eu(t,e){return t.length<124?t:e}var ap="graphql-transport-ws";var ft;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ft||(ft={}));var De;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(De||(De={}));function op(t){if(!lr(t))throw new Error(`Message is expected to be an object, but got ${rt(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${rt(t.type)}`);switch(t.type){case De.ConnectionInit:case De.ConnectionAck:case De.Ping:case De.Pong:{if(t.payload!=null&&!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case De.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${rt(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${rt(t.payload.query)}`);if(t.payload.variables!=null&&!lr(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${rt(t.payload.variables)}`);if(t.payload.operationName!=null&&rt(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${rt(t.payload.operationName)}`);if(t.payload.extensions!=null&&!lr(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${rt(t.payload.extensions)}`);break}case De.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${rt(t.payload)}`);break}case De.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ip(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case De.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${rt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function sp(t,e){return op(typeof t=="string"?JSON.parse(t,e):t)}function ci(t,e){return op(t),JSON.stringify(t,e)}function tu(t){let{url:e,connectionParams:r,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 ve=1e3;for(let ae=0;ae<ge;ae++)ve*=2;await new Promise(ae=>setTimeout(ae,ve+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Po,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ge=>{let ve=Math.random()*16|0;return(ge=="x"?ve:ve&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:_}=t,S;if(h){if(!Sy(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,b=(()=>{let j=(()=>{let ve={};return{on(ae,oe){return ve[ae]=oe,()=>{delete ve[ae]}},emit(ae){var oe;"id"in ae&&((oe=ve[ae.id])===null||oe===void 0||oe.call(ve,ae))}}})(),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?[j.emit,f.message]:[j.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:j.on,on(ve,ae){let oe=ge[ve];return oe.push(ae),()=>{oe.splice(oe.indexOf(ae),1)}},emit(ve,...ae){for(let oe of[...ge[ve]])oe(...ae)}}})();function A(j){let ge=[b.on("error",ve=>{ge.forEach(ae=>ae()),j(ve)}),b.on("closed",ve=>{ge.forEach(ae=>ae()),j(ve)})]}let R,E=0,C,F=!1,P=0,M=!1;async function Ee(){clearTimeout(C);let[j,ge]=await(R??(R=new Promise((oe,Bt)=>(async()=>{if(F){if(await l(P),!E)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});P++}b.emit("connecting");let X=new w(typeof e=="function"?await e():e,ap),Vt,_r;function Ja(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{X.readyState===w.OPEN&&(X.send(ci({type:De.Ping})),b.emit("ping",!1,void 0))},o))}A(Ge=>{R=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(Ge),Po(Ge)&&Ge.code===4499&&(X.close(4499,"Terminated"),X.onerror=null,X.onclose=null)}),X.onerror=Ge=>b.emit("error",Ge),X.onclose=Ge=>b.emit("closed",Ge),X.onopen=async()=>{try{b.emit("opened",X);let Ge=typeof r=="function"?await r():r;if(X.readyState!==w.OPEN)return;X.send(ci(Ge?{type:De.ConnectionInit,payload:Ge}:{type:De.ConnectionInit},g)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{X.close(ft.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ja()}catch(Ge){b.emit("error",Ge),X.close(ft.InternalClientError,eu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Internal client error"))}};let Gn=!1;X.onmessage=({data:Ge})=>{try{let We=sp(Ge,_);if(b.emit("message",We),We.type==="ping"||We.type==="pong"){b.emit(We.type,!0,We.payload),We.type==="pong"?Ja():s||(X.send(ci(We.payload?{type:De.Pong,payload:We.payload}:{type:De.Pong})),b.emit("pong",!1,We.payload));return}if(Gn)return;if(We.type!==De.ConnectionAck)throw new Error(`First message cannot be of type ${We.type}`);clearTimeout(Vt),Gn=!0,b.emit("connected",X,We.payload),F=!1,P=0,oe([X,new Promise((G_,Oh)=>A(Oh))])}catch(We){X.onmessage=null,b.emit("error",We),X.close(ft.BadResponse,eu(We instanceof Error?We.message:new Error(We).message,"Bad response"))}}})())));j.readyState===w.CLOSING&&await ge;let ve=()=>{},ae=new Promise(oe=>ve=oe);return[j,ve,Promise.race([ae.then(()=>{if(!E){let oe=()=>j.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{j.readyState===w.OPEN&&oe()},a):oe()}}),ge])]}function ne(j){if(Po(j)&&(_y(j.code)||[ft.InternalServerError,ft.InternalClientError,ft.BadRequest,ft.BadResponse,ft.Unauthorized,ft.SubprotocolNotAcceptable,ft.SubscriberAlreadyExists,ft.TooManyInitialisationRequests].includes(j.code)))throw j;if(M)return!1;if(Po(j)&&j.code===1e3)return E>0;if(!u||P>=u||!d(j)||p?.(j))throw j;return F=!0}return n||(async()=>{for(E++;;)try{let[,,j]=await Ee();await j}catch(j){try{if(!ne(j))return}catch(ge){return i?.(ge)}}})(),{on:b.on,subscribe(j,ge){let ve=m(j),ae=!1,oe=!1,Bt=()=>{E--,ae=!0};return(async()=>{for(E++;;)try{let[X,Vt,_r]=await Ee();if(ae)return Vt();let Ja=b.onMessage(ve,Gn=>{switch(Gn.type){case De.Next:{ge.next(Gn.payload);return}case De.Error:{oe=!0,ae=!0,ge.error(Gn.payload),Bt();return}case De.Complete:{ae=!0,Bt();return}}});X.send(ci({id:ve,type:De.Subscribe,payload:j},g)),Bt=()=>{!ae&&X.readyState===w.OPEN&&X.send(ci({id:ve,type:De.Complete},g)),E--,ae=!0,Vt()},await _r.finally(Ja);return}catch(X){if(!ne(X))return}})().then(()=>{oe||ge.complete()}).catch(X=>{ge.error(X)}),()=>{ae||Bt()}},async dispose(){if(M=!0,R){let[j]=await R;j.close(1e3,"Normal Closure")}},terminate(){R&&b.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Po(t){return lr(t)&&"code"in t&&"reason"in t}function _y(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function Sy(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function wy(t){return se(t)&&"code"in t&&"reason"in t}var cp=function(t){Ae(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new ee(function(i){return n.client.subscribe(T(T({},r),{query:Wn(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):wy(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Fo="0.11.2-dev";function up(){return typeof window!="undefined"&&window.self!==window.top}function ru(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function fr(t,e){ru()&&localStorage.setItem(`${Fo}/${t}`,e)}function Lo(t){return ru()?localStorage.getItem(`${Fo}/${t}`):null}function ra(t){ru()&&localStorage.removeItem(`${Fo}/${t}`)}function lp(t,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((r,n)=>{let i;try{i=new WebSocket(t,"graphql-transport-ws"),i.onopen=()=>{i.close(),r(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((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(r){return typeof r}:Jo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Jo(t)}function xy(t){return Jo(t)=="object"&&t!==null}var Ad=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wu(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Ty(t){return Od(t.source,wu(t.source,t.start))}function Od(t,e){var r=t.locationOffset.column-1,n=Yo(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,c=e.column+s,u="".concat(t.name,":").concat(o,":").concat(c,`
52
52
  `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var p=Math.floor(c/80),f=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+fp([["".concat(o),h[0]]].concat(h.slice(1,p+1).map(function(g){return["",g]}),[[" ",Yo(f-1)+"^"],["",h[p+1]]]))}return u+fp([["".concat(o-1),l[i-1]],["".concat(o),d],["",Yo(c-1)+"^"],["".concat(o+1),l[i+1]]])}function fp(t){var e=t.filter(function(n){n[0];var i=n[1];return i!==void 0}),r=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 Iy(r,i)+(a?" | "+a:" |")}).join(`
53
- `)}function Yo(t){return Array(t+1).join(" ")}function Iy(t,e){return Yo(t-e.length)+e}function Zo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(r){return typeof r}:Zo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zo(t)}function pp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ky(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pp(Object(r),!0).forEach(function(n){Ay(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ay(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Dy(t,e,r){return e&&dp(t.prototype,e),r&&dp(t,r),t}function Ny(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Aa(t,e)}function Cy(t){var e=Nd();return function(){var n=Oa(t),i;if(e){var a=Oa(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Dd(this,i)}}function Dd(t,e){return e&&(Zo(e)==="object"||typeof e=="function")?e:oa(t)}function oa(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Eu(t){var e=typeof Map=="function"?new Map:void 0;return Eu=function(n){if(n===null||!Ry(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 Xo(n,arguments,Oa(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Aa(i,n)},Eu(t)}function Xo(t,e,r){return Nd()?Xo=Reflect.construct:Xo=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Aa(u,o.prototype),u},Xo.apply(null,arguments)}function Nd(){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 Ry(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Aa(t,e){return Aa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Aa(t,e)}function Oa(t){return Oa=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Oa(t)}var Py=function(t){Ny(r,t);var e=Cy(r);function r(n,i,a,o,s,c,u){var l,d,p,f;Oy(this,r),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=hp(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,g=(w=f.nodes)!==null&&w!==void 0?w:[];m<g.length;m++){var w,b=g[m],S=b.loc;S!=null&&h.push(S)}h=hp(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(A){return A.start})),f.locations=o&&a?o.map(function(A){return wu(a,A)}):(p=h)===null||p===void 0?void 0:p.map(function(A){return wu(A.source,A.start)}),f.path=s??void 0;var _=c?.extensions;return u==null&&xy(_)?f.extensions=ky({},_):f.extensions=u??{},Object.defineProperties(oa(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(oa(f),"stack",{value:c.stack,writable:!0,configurable:!0}),Dd(f)):(Error.captureStackTrace?Error.captureStackTrace(oa(f),r):Object.defineProperty(oa(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Dy(r,[{key:"toString",value:function(){return Ly(this)}},{key:Ad,get:function(){return"Object"}}]),r}(Eu(Error));function hp(t){return t===void 0||t.length===0?void 0:t}function Ly(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
53
+ `)}function Yo(t){return Array(t+1).join(" ")}function Iy(t,e){return Yo(t-e.length)+e}function Zo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(r){return typeof r}:Zo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zo(t)}function pp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function ky(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pp(Object(r),!0).forEach(function(n){Ay(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ay(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Oy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Dy(t,e,r){return e&&dp(t.prototype,e),r&&dp(t,r),t}function Ny(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Oa(t,e)}function Cy(t){var e=Nd();return function(){var n=Da(t),i;if(e){var a=Da(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Dd(this,i)}}function Dd(t,e){return e&&(Zo(e)==="object"||typeof e=="function")?e:sa(t)}function sa(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Eu(t){var e=typeof Map=="function"?new Map:void 0;return Eu=function(n){if(n===null||!Ry(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 Xo(n,arguments,Da(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Oa(i,n)},Eu(t)}function Xo(t,e,r){return Nd()?Xo=Reflect.construct:Xo=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Oa(u,o.prototype),u},Xo.apply(null,arguments)}function Nd(){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 Ry(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Oa(t,e){return Oa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Oa(t,e)}function Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Da(t)}var Py=function(t){Ny(r,t);var e=Cy(r);function r(n,i,a,o,s,c,u){var l,d,p,f;Oy(this,r),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=hp(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,g=(_=f.nodes)!==null&&_!==void 0?_:[];m<g.length;m++){var _,S=g[m],w=S.loc;w!=null&&h.push(w)}h=hp(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(A){return A.start})),f.locations=o&&a?o.map(function(A){return wu(a,A)}):(p=h)===null||p===void 0?void 0:p.map(function(A){return wu(A.source,A.start)}),f.path=s??void 0;var b=c?.extensions;return u==null&&xy(b)?f.extensions=ky({},b):f.extensions=u??{},Object.defineProperties(sa(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(sa(f),"stack",{value:c.stack,writable:!0,configurable:!0}),Dd(f)):(Error.captureStackTrace?Error.captureStackTrace(sa(f),r):Object.defineProperty(sa(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Dy(r,[{key:"toString",value:function(){return Fy(this)}},{key:Ad,get:function(){return"Object"}}]),r}(Eu(Error));function hp(t){return t===void 0||t.length===0?void 0:t}function Fy(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
54
54
 
55
55
  `+Ty(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
56
56
 
57
- `+Od(t.source,s)}return e}function _t(t,e,r){return new Py("Syntax Error: ".concat(r),void 0,t,[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 Fy(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var $y=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,xu=$y;function Cd(t){var e=t.prototype.toJSON;typeof e=="function"||Fy(0),t.prototype.inspect=e,xu&&(t.prototype[xu]=e)}var Rd=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Cd(Rd);var Ce=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Cd(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 es(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?es=function(r){return typeof r}:es=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},es(t)}var My=10,Pd=2;function jy(t){return Ms(t,[])}function Ms(t,e){switch(es(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Uy(t,e);default:return String(t)}}function Uy(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Vy(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Ms(i,r)}else if(Array.isArray(t))return By(t,r);return qy(t,r)}function qy(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Pd)return"["+Qy(t)+"]";var n=r.map(function(i){var a=Ms(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function By(t,e){if(t.length===0)return"[]";if(e.length>Pd)return"[Array]";for(var r=Math.min(My,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Ms(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Vy(t){var e=t[String(xu)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Qy(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function nu(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var zy=function(e,r){return e instanceof r};function mp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wy(t,e,r){return e&&mp(t.prototype,e),r&&mp(t,r),t}var Ld=function(){function t(e){var r=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"||nu(0,"Body must be a string. Received: ".concat(jy(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||nu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||nu(0,"column in locationOffset is 1-indexed and must be positive.")}return Wy(t,[{key:Ad,get:function(){return"Source"}}]),t}();function Gy(t){return zy(t,Ld)}var Ky=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 Hy(t){var e=t.split(/\r\n|[\n\r]/g),r=Jy(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&yp(e[i]);)++i;for(var a=e.length;a>i&&yp(e[a-1]);)--a;return e.slice(i,a).join(`
58
- `)}function yp(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Jy(t){for(var e,r=!0,n=!0,i=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var Yy=function(){function t(r){var n=new Ce(D.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.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=Xy(this,n)}while(n.kind===D.COMMENT);return n},t}();function Zy(t){return t===D.BANG||t===D.DOLLAR||t===D.AMP||t===D.PAREN_L||t===D.PAREN_R||t===D.SPREAD||t===D.COLON||t===D.EQUALS||t===D.AT||t===D.BRACKET_L||t===D.BRACKET_R||t===D.BRACE_L||t===D.PIPE||t===D.BRACE_R}function In(t){return isNaN(t)?D.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Xy(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=t.line,c=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Ce(D.BANG,a,a+1,s,c,e);case 35:return tg(r,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?ig(r,a,s,c,e,t):ng(r,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 rg(r,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 og(r,a,s,c,e)}throw _t(r,a,eg(o))}var u=t.line,l=1+a-t.lineStart;return new Ce(D.EOF,i,i,u,l,e)}function eg(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(In(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(In(t),".")}function tg(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Ce(D.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function rg(t,e,r,n,i,a){var o=t.body,s=r,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw _t(t,c,"Invalid number, unexpected digit after 0: ".concat(In(s),"."))}else c=iu(t,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=iu(t,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=iu(t,c,s),s=o.charCodeAt(c)),s===46||sg(s))throw _t(t,c,"Invalid number, expected digit but got: ".concat(In(s),"."));return new Ce(u?D.FLOAT:D.INT,e,c,n,i,a,o.slice(e,c))}function iu(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw _t(t,i,"Invalid number, expected digit but got: ".concat(In(a),"."))}function ng(t,e,r,n,i){for(var a=t.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,r,n,i,u);if(c<32&&c!==9)throw _t(t,o,"Invalid character within String: ".concat(In(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=ag(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 _t(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw _t(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw _t(t,o,"Unterminated string.")}function ig(t,e,r,n,i,a){for(var o=t.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,r,n,i,Hy(l));if(u<32&&u!==9&&u!==10&&u!==13)throw _t(t,s,"Invalid character within String: ".concat(In(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 _t(t,s,"Unterminated string.")}function ag(t,e,r,n){return $o(t)<<12|$o(e)<<8|$o(r)<<4|$o(n)}function $o(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function og(t,e,r,n,i){for(var a=t.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,r,n,i,a.slice(e,s))}function sg(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function cg(t,e){var r=new ug(t,e);return r.parseDocument()}var ug=function(){function t(r,n){var i=Gy(r)?r:new Ld(r);this._lexer=new Yy(i),this._options=n}var e=t.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(Ky[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 Rd(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 _t(this._lexer.source,i.start,"Expected ".concat(Fd(n),", found ").concat(au(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 _t(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(au(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 _t(this._lexer.source,i.start,"Unexpected ".concat(au(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},t}();function au(t){var e=t.value;return Fd(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Fd(t){return Zy(t)?'"'.concat(t,'"'):t}var ts=new Map,Tu=new Map,$d=!0,ys=!1;function Md(t){return t.replace(/[\s,]+/g," ").trim()}function lg(t){return Md(t.source.body.substring(t.start,t.end))}function fg(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=lg(n.loc),o=Tu.get(i);o&&!o.has(a)?$d&&console.warn("Warning: fragment with name "+i+` already exists.
57
+ `+Od(t.source,s)}return e}function _t(t,e,r){return new Py("Syntax Error: ".concat(r),void 0,t,[e])}var z=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Ly(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var $y=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,xu=$y;function Cd(t){var e=t.prototype.toJSON;typeof e=="function"||Ly(0),t.prototype.inspect=e,xu&&(t.prototype[xu]=e)}var Rd=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Cd(Rd);var Re=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Cd(Re);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 es(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?es=function(r){return typeof r}:es=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},es(t)}var My=10,Pd=2;function jy(t){return Ms(t,[])}function Ms(t,e){switch(es(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Uy(t,e);default:return String(t)}}function Uy(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Vy(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Ms(i,r)}else if(Array.isArray(t))return By(t,r);return qy(t,r)}function qy(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Pd)return"["+Qy(t)+"]";var n=r.map(function(i){var a=Ms(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function By(t,e){if(t.length===0)return"[]";if(e.length>Pd)return"[Array]";for(var r=Math.min(My,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Ms(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Vy(t){var e=t[String(xu)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Qy(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function nu(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var zy=function(e,r){return e instanceof r};function mp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Gy(t,e,r){return e&&mp(t.prototype,e),r&&mp(t,r),t}var Fd=function(){function t(e){var r=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"||nu(0,"Body must be a string. Received: ".concat(jy(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||nu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||nu(0,"column in locationOffset is 1-indexed and must be positive.")}return Gy(t,[{key:Ad,get:function(){return"Source"}}]),t}();function Wy(t){return zy(t,Fd)}var Ky=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 Hy(t){var e=t.split(/\r\n|[\n\r]/g),r=Jy(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&yp(e[i]);)++i;for(var a=e.length;a>i&&yp(e[a-1]);)--a;return e.slice(i,a).join(`
58
+ `)}function yp(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Jy(t){for(var e,r=!0,n=!0,i=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var Yy=function(){function t(r){var n=new Re(D.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.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=Xy(this,n)}while(n.kind===D.COMMENT);return n},t}();function Zy(t){return t===D.BANG||t===D.DOLLAR||t===D.AMP||t===D.PAREN_L||t===D.PAREN_R||t===D.SPREAD||t===D.COLON||t===D.EQUALS||t===D.AT||t===D.BRACKET_L||t===D.BRACKET_R||t===D.BRACE_L||t===D.PIPE||t===D.BRACE_R}function In(t){return isNaN(t)?D.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Xy(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=t.line,c=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Re(D.BANG,a,a+1,s,c,e);case 35:return tg(r,a,s,c,e);case 36:return new Re(D.DOLLAR,a,a+1,s,c,e);case 38:return new Re(D.AMP,a,a+1,s,c,e);case 40:return new Re(D.PAREN_L,a,a+1,s,c,e);case 41:return new Re(D.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Re(D.SPREAD,a,a+3,s,c,e);break;case 58:return new Re(D.COLON,a,a+1,s,c,e);case 61:return new Re(D.EQUALS,a,a+1,s,c,e);case 64:return new Re(D.AT,a,a+1,s,c,e);case 91:return new Re(D.BRACKET_L,a,a+1,s,c,e);case 93:return new Re(D.BRACKET_R,a,a+1,s,c,e);case 123:return new Re(D.BRACE_L,a,a+1,s,c,e);case 124:return new Re(D.PIPE,a,a+1,s,c,e);case 125:return new Re(D.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?ig(r,a,s,c,e,t):ng(r,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 rg(r,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 og(r,a,s,c,e)}throw _t(r,a,eg(o))}var u=t.line,l=1+a-t.lineStart;return new Re(D.EOF,i,i,u,l,e)}function eg(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(In(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(In(t),".")}function tg(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Re(D.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function rg(t,e,r,n,i,a){var o=t.body,s=r,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw _t(t,c,"Invalid number, unexpected digit after 0: ".concat(In(s),"."))}else c=iu(t,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=iu(t,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=iu(t,c,s),s=o.charCodeAt(c)),s===46||sg(s))throw _t(t,c,"Invalid number, expected digit but got: ".concat(In(s),"."));return new Re(u?D.FLOAT:D.INT,e,c,n,i,a,o.slice(e,c))}function iu(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw _t(t,i,"Invalid number, expected digit but got: ".concat(In(a),"."))}function ng(t,e,r,n,i){for(var a=t.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 Re(D.STRING,e,o+1,r,n,i,u);if(c<32&&c!==9)throw _t(t,o,"Invalid character within String: ".concat(In(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=ag(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 _t(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw _t(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw _t(t,o,"Unterminated string.")}function ig(t,e,r,n,i,a){for(var o=t.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(D.BLOCK_STRING,e,s+3,r,n,i,Hy(l));if(u<32&&u!==9&&u!==10&&u!==13)throw _t(t,s,"Invalid character within String: ".concat(In(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 _t(t,s,"Unterminated string.")}function ag(t,e,r,n){return $o(t)<<12|$o(e)<<8|$o(r)<<4|$o(n)}function $o(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function og(t,e,r,n,i){for(var a=t.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(D.NAME,e,s,r,n,i,a.slice(e,s))}function sg(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function cg(t,e){var r=new ug(t,e);return r.parseDocument()}var ug=function(){function t(r,n){var i=Wy(r)?r:new Fd(r);this._lexer=new Yy(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(D.NAME);return{kind:z.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:z.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:z.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:z.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:z.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:z.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:z.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:z.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:z.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:z.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:z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:z.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:z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:z.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:z.INT,value:i.value,loc:this.loc(i)};case D.FLOAT:return this._lexer.advance(),{kind:z.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:z.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:z.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:z.NULL,loc:this.loc(i)};default:return{kind:z.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:z.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:z.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:z.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:z.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:z.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:z.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(D.BANG)?{kind:z.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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:z.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(Ky[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 Rd(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 _t(this._lexer.source,i.start,"Expected ".concat(Ld(n),", found ").concat(au(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 _t(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(au(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 _t(this._lexer.source,i.start,"Unexpected ".concat(au(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},t}();function au(t){var e=t.value;return Ld(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Ld(t){return Zy(t)?'"'.concat(t,'"'):t}var ts=new Map,Tu=new Map,$d=!0,ys=!1;function Md(t){return t.replace(/[\s,]+/g," ").trim()}function lg(t){return Md(t.source.body.substring(t.start,t.end))}function fg(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=lg(n.loc),o=Tu.get(i);o&&!o.has(a)?$d&&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||Tu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),ms(ms({},t),{definitions:r})}function pg(t){var e=new Set(t.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 r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function dg(t){var e=Md(t);if(!ts.has(e)){var r=cg(t,{experimentalFragmentVariables:ys,allowLegacyFragmentVariables:ys});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ts.set(e,pg(fg(r)))}return ts.get(e)}function T(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),dg(n)}function hg(){ts.clear(),Tu.clear()}function mg(){$d=!1}function yg(){ys=!0}function gg(){ys=!1}var ra={gql:T,resetCaches:hg,disableFragmentWarnings:mg,enableExperimentalFragmentVariables:yg,disableExperimentalFragmentVariables:gg};(function(t){t.gql=ra.gql,t.resetCaches=ra.resetCaches,t.disableFragmentWarnings=ra.disableFragmentWarnings,t.enableExperimentalFragmentVariables=ra.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=ra.disableExperimentalFragmentVariables})(T||(T={}));T.default=T;function k(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function vg(){}function Jr(){return vg}var H=Jr,y=Jr,ze=Jr,he=Jr,W=Jr,xt=Jr,bg=Jr,Hu=Jr,jd=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ud=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},kn=class{constructor(e){this.code=e}};jd([y(),Ud("design:type",String)],kn.prototype,"code",void 0);kn=jd([W(),Ud("design:paramtypes",[String])],kn);var Ju=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Yu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},er=class{constructor(e,r){this.address=e,this.name=r}};Ju([y(),Yu("design:type",String)],er.prototype,"address",void 0);Ju([y(),Yu("design:type",String)],er.prototype,"name",void 0);er=Ju([W(),Yu("design:paramtypes",[String,String])],er);var Te=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},je=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},vr=class{constructor(e,r){this.key=r,this.signature=e}};Te([y(),je("design:type",String)],vr.prototype,"signature",void 0);Te([y(),je("design:type",String)],vr.prototype,"key",void 0);Te([y(),je("design:type",Boolean)],vr.prototype,"valid",void 0);Te([y(),je("design:type",Boolean)],vr.prototype,"invalid",void 0);vr=Te([W(),ze(),je("design:paramtypes",[String,String])],vr);var An=class{};Te([y(),je("design:type",String)],An.prototype,"signature",void 0);Te([y(),je("design:type",String)],An.prototype,"key",void 0);Te([y(),je("design:type",Boolean)],An.prototype,"valid",void 0);Te([y(),je("design:type",Boolean)],An.prototype,"invalid",void 0);An=Te([ze()],An);function Yr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Te([y(),je("design:type",String)],e.prototype,"author",void 0),Te([y(),je("design:type",String)],e.prototype,"timestamp",void 0),Te([y(),je("design:type",Object)],e.prototype,"data",void 0),Te([y(),je("design:type",vr)],e.prototype,"proof",void 0),e=Te([W(),je("design:paramtypes",[String,String,Object,vr])],e),e}function _g(t){let e=class{};return Te([y(),je("design:type",String)],e.prototype,"author",void 0),Te([y(),je("design:type",String)],e.prototype,"timestamp",void 0),Te([y(),je("design:type",Object)],e.prototype,"data",void 0),Te([y(),je("design:type",An)],e.prototype,"proof",void 0),e=Te([ze()],e),e}var gp=class extends Yr(){};gp=Te([W()],gp);var gs=class extends Yr(){};Te([y(),je("design:type",er)],gs.prototype,"language",void 0);Te([y(),je("design:type",kn)],gs.prototype,"icon",void 0);gs=Te([W()],gs);function DI(t){return t&&t.author&&t.timestamp&&t.data}var Pe=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Xe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},On=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Pe([y(),Xe("design:type",String)],On.prototype,"source",void 0);Pe([y(),Xe("design:type",String)],On.prototype,"target",void 0);Pe([y(),Xe("design:type",String)],On.prototype,"predicate",void 0);On=Pe([W(),Xe("design:paramtypes",[Object])],On);var vs=class{};Pe([y(),Xe("design:type",Array)],vs.prototype,"additions",void 0);Pe([y(),Xe("design:type",Array)],vs.prototype,"removals",void 0);vs=Pe([ze()],vs);var bs=class{constructor(e,r){this.additions=e,this.removals=r}};Pe([y(),Xe("design:type",Array)],bs.prototype,"additions",void 0);Pe([y(),Xe("design:type",Array)],bs.prototype,"removals",void 0);bs=Pe([W(),Xe("design:paramtypes",[Array,Array])],bs);var Da=class{};Pe([y(),Xe("design:type",String)],Da.prototype,"source",void 0);Pe([y(),Xe("design:type",String)],Da.prototype,"target",void 0);Pe([y(),Xe("design:type",String)],Da.prototype,"predicate",void 0);Da=Pe([ze()],Da);var Qr=class extends Yr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Pe([y(),Xe("design:type",String)],Qr.prototype,"status",void 0);Qr=Pe([W()],Qr);var Iu=class extends _g(){};Pe([y(),Xe("design:type",String)],Iu.prototype,"status",void 0);Iu=Pe([ze()],Iu);function $I(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function MI(t){return t&&t.source&&t.target}var _s=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Pe([y(),Xe("design:type",Qr)],_s.prototype,"oldLink",void 0);Pe([y(),Xe("design:type",Qr)],_s.prototype,"newLink",void 0);_s=Pe([W(),Xe("design:paramtypes",[Qr,Qr])],_s);var Mn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Va=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ku,nr=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 r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};Mn([y(),Va("design:type",Array)],nr.prototype,"links",void 0);nr=Mn([W(),Va("design:paramtypes",[Array])],nr);var Ss=class{};Mn([y(),Va("design:type",Array)],Ss.prototype,"links",void 0);Ss=Mn([ze()],Ss);var Au=ku=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new ku;return r.links.push(e),r}};Mn([y(),Va("design:type",Array)],Au.prototype,"links",void 0);Au=ku=Mn([ze(),Va("design:paramtypes",[Array])],Au);var Dn=class extends Yr(){};Dn=Mn([W()],Dn);var j=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},U=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},jr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new nr}};j([y(),U("design:type",String)],jr.prototype,"did",void 0);j([y(),U("design:type",nr)],jr.prototype,"perspective",void 0);j([y(),U("design:type",String)],jr.prototype,"directMessageLanguage",void 0);jr=j([W(),U("design:paramtypes",[String,nr])],jr);var vp=class extends Yr(){};vp=j([W()],vp);var zr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([y(),U("design:type",String)],zr.prototype,"did",void 0);j([y(),U("design:type",String)],zr.prototype,"didSigningKeyId",void 0);j([y(),U("design:type",String)],zr.prototype,"deviceKeyType",void 0);j([y(),U("design:type",String)],zr.prototype,"deviceKey",void 0);j([y(),U("design:type",String)],zr.prototype,"deviceKeySignedByDid",void 0);j([y(),U("design:type",String)],zr.prototype,"didSignedByDeviceKey",void 0);zr=j([W(),U("design:paramtypes",[String,String,String,String,String,String])],zr);var Wr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([y(),U("design:type",String)],Wr.prototype,"did",void 0);j([y(),U("design:type",String)],Wr.prototype,"didSigningKeyId",void 0);j([y(),U("design:type",String)],Wr.prototype,"deviceKeyType",void 0);j([y(),U("design:type",String)],Wr.prototype,"deviceKey",void 0);j([y(),U("design:type",String)],Wr.prototype,"deviceKeySignedByDid",void 0);j([y(),U("design:type",String)],Wr.prototype,"didSignedByDeviceKey",void 0);Wr=j([ze(),U("design:paramtypes",[String,String,String,String,String,String])],Wr);var ws=class{constructor(e,r){this.signature=e,this.publicKey=r}};j([y(),U("design:type",String)],ws.prototype,"signature",void 0);j([y(),U("design:type",String)],ws.prototype,"publicKey",void 0);ws=j([W(),U("design:paramtypes",[String,String])],ws);var Si=class{constructor(e,r){this.domain=e,this.pointers=r}};j([y(),U("design:type",String)],Si.prototype,"domain",void 0);j([y(),U("design:type",Array)],Si.prototype,"pointers",void 0);Si=j([W(),U("design:paramtypes",[String,Array])],Si);var Es=class{constructor(e,r){this.with=e,this.can=r}};j([y(),U("design:type",Si)],Es.prototype,"with",void 0);j([y(),U("design:type",Array)],Es.prototype,"can",void 0);Es=j([W(),U("design:paramtypes",[Si,Array])],Es);var br=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};j([y(),U("design:type",String)],br.prototype,"appName",void 0);j([y(),U("design:type",String)],br.prototype,"appDesc",void 0);j([y(),U("design:type",String)],br.prototype,"appUrl",void 0);j([y(),U("design:type",String)],br.prototype,"appIconPath",void 0);j([y(),U("design:type",Array)],br.prototype,"capabilities",void 0);br=j([W(),U("design:paramtypes",[String,String,String,Array,String])],br);var wi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};j([y(),U("design:type",String)],wi.prototype,"requestId",void 0);j([y(),U("design:type",String)],wi.prototype,"token",void 0);j([y(),U("design:type",Boolean)],wi.prototype,"revoked",void 0);j([y(),U("design:type",br)],wi.prototype,"auth",void 0);wi=j([W(),U("design:paramtypes",[String,br,String,Boolean])],wi);var Ei=class{constructor(e,r){this.domain=e,this.pointers=r}};j([y(),U("design:type",String)],Ei.prototype,"domain",void 0);j([y(),U("design:type",Array)],Ei.prototype,"pointers",void 0);Ei=j([ze(),U("design:paramtypes",[String,Array])],Ei);var xs=class{constructor(e,r){this.with=e,this.can=r}};j([y(),U("design:type",Ei)],xs.prototype,"with",void 0);j([y(),U("design:type",Array)],xs.prototype,"can",void 0);xs=j([ze(),U("design:paramtypes",[Ei,Array])],xs);var ir=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};j([y(),U("design:type",String)],ir.prototype,"appName",void 0);j([y(),U("design:type",String)],ir.prototype,"appDesc",void 0);j([y(),U("design:type",String)],ir.prototype,"appDomain",void 0);j([y(),U("design:type",String)],ir.prototype,"appUrl",void 0);j([y(),U("design:type",String)],ir.prototype,"appIconPath",void 0);j([y(),U("design:type",Array)],ir.prototype,"capabilities",void 0);ir=j([ze(),U("design:paramtypes",[String,String,String,String,String,Array])],ir);var Nn=class{constructor(e,r,n){this.did=e,this.success=r,this.error=n}};j([y(),U("design:type",String)],Nn.prototype,"did",void 0);j([y(),U("design:type",Boolean)],Nn.prototype,"success",void 0);j([y(),U("design:type",String)],Nn.prototype,"error",void 0);Nn=j([W(),U("design:paramtypes",[String,Boolean,String])],Nn);var Di=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ni=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Nt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isInitialized",void 0);Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isUnlocked",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"did",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"didDocument",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"error",void 0);Nt=Di([W(),Ni("design:paramtypes",[Object])],Nt);var bp=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},De=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},pt,dt,Ou=class{constructor(e,r){pt.set(this,void 0),dt.set(this,void 0),bp(this,pt,e,"f"),bp(this,dt,r,"f")}async otherAgents(){return await De(this,pt,"f").otherAgents(De(this,dt,"f"))}async hasTelepresenceAdapter(){return await De(this,pt,"f").hasTelepresenceAdapter(De(this,dt,"f"))}async onlineAgents(){return await De(this,pt,"f").onlineAgents(De(this,dt,"f"))}async setOnlineStatus(e){return await De(this,pt,"f").setOnlineStatus(De(this,dt,"f"),e)}async setOnlineStatusU(e){return await De(this,pt,"f").setOnlineStatusU(De(this,dt,"f"),e)}async sendSignal(e,r){return await De(this,pt,"f").sendSignal(De(this,dt,"f"),e,r)}async sendSignalU(e,r){return await De(this,pt,"f").sendSignalU(De(this,dt,"f"),e,r)}async sendBroadcast(e,r=!1){return await De(this,pt,"f").sendBroadcast(De(this,dt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await De(this,pt,"f").sendBroadcastU(De(this,dt,"f"),e,r)}async addSignalHandler(e){await De(this,pt,"f").addSignalHandler(De(this,dt,"f"),e)}removeSignalHandler(e){De(this,pt,"f").removeSignalHandler(De(this,dt,"f"),e)}};pt=new WeakMap,dt=new WeakMap;var jn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Un=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ye=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)}};jn([y(),Un("design:type",String)],Ye.prototype,"source",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"target",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"predicate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"fromDate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"untilDate",void 0);jn([y(),Un("design:type",Number)],Ye.prototype,"limit",void 0);Ye=jn([W(),ze(),Un("design:paramtypes",[Object])],Ye);var _p=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},He=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ht,dr;function Mo(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Ze=class{constructor(){ht.set(this,void 0),dr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new Ze;return _p(r,dr,e,"f"),r}static from(e){let r=new Ze;return _p(r,ht,e,"f"),r}toUrl(){if(He(this,dr,"f")&&!He(this,ht,"f"))return He(this,dr,"f");if(!He(this,dr,"f")&&(He(this,ht,"f")===void 0||He(this,ht,"f")===""||He(this,ht,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof He(this,ht,"f")){case"string":e=`string:${Mo(He(this,ht,"f"))}`;break;case"number":e=`number:${Mo(He(this,ht,"f"))}`;break;case"boolean":e=`boolean:${Mo(He(this,ht,"f"))}`;break;case"object":e=`json:${Mo(JSON.stringify(He(this,ht,"f")))}`;break}return`literal://${e}`}get(){if(He(this,ht,"f"))return He(this,ht,"f");if(!He(this,dr,"f"))throw new Error("Can't render empty Literal");if(!He(this,dr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=He(this,dr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};ht=new WeakMap,dr=new WeakMap;function Ur(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Zu(t){return`set${Ur(t)}`}function vi(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Xu(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function Sg(t){return`add${Ur(Xu(t))}`}function wg(t){let e=t.substring(3),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Eg(t){return`remove${Ur(Xu(t))}`}function xg(t){let e=t.substring(6),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Tg(t){let e=t.substring(13),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Ig(t){return`setCollection${Ur(Xu(t))}`}function fn(t){if(Array.isArray(t))return`[${t.map(fn).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var ou=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Y=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},it,at,Ne,bi=class{constructor(t,e,r){it.set(this,void 0),at.set(this,void 0),Ne.set(this,void 0),ou(this,it,e,"f"),ou(this,at,r,"f"),ou(this,Ne,t,"f")}get baseExpression(){return Y(this,it,"f")}async init(){let isInstance=await Y(this,Ne,"f").isSubjectInstance(Y(this,it,"f"),Y(this,at,"f"));if(!isInstance)throw`Not a valid subject instance of ${Y(this,at,"f")} for ${Y(this,it,"f")}`;let results=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties)await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_resolve(C, "${t}")`),Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Ne,"f").getPropertyValueViaSurreal(Y(this,it,"f"),Y(this,at,"f"),t)}catch(e){console.warn(`Failed to get property ${t} via SurrealDB:`,e);return}}});let setters=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Zu(property)]=async t=>{resolveLanguage&&(t=await Y(this,Ne,"f").createExpression(t,resolveLanguage)),await Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let results2=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Ne,"f").getCollectionValuesViaSurreal(Y(this,it,"f"),Y(this,at,"f"),t)}catch(e){return console.warn(`Failed to get collection ${t} via SurrealDB:`,e),[]}}});let adders=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[Sg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:e}]))):await Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let removers=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[Eg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:e}]))):await Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let collectionSetters=await Y(this,Ne,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Ig(collection)]=async t=>{Array.isArray(t)?await Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),t.map(e=>({name:"value",value:e}))):await Y(this,Ne,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}}};it=new WeakMap,at=new WeakMap,Ne=new WeakMap;function Sp(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function ak(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Sp(e)} your ${r} actions, with access to ${Sp(n)}`}function we(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var de=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},O=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rs,hr,Ht,Jt,_n,Pr,Lr,pn,sa,ns,dn,hn,Ot,mi,Du,se,ue,mn,yn,gn,ca,Ts=class{constructor(e,r,n){rs.add(this),hr.set(this,void 0),Ht.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),Pr.set(this,void 0),Lr.set(this,void 0),pn.set(this,void 0),sa.set(this,!1),ns.set(this,void 0),dn.set(this,void 0),hn.set(this,void 0),Ot.set(this,void 0),mi.set(this,void 0),this.isSurrealDB=!1,de(this,hr,e,"f"),de(this,mi,r,"f"),de(this,Jt,n,"f"),de(this,_n,new Set,"f"),de(this,pn,null,"f"),de(this,ns,new Promise((i,a)=>{de(this,dn,i,"f"),de(this,hn,a,"f")}),"f")}async subscribe(){O(this,Lr,"f")&&(O(this,Lr,"f").call(this),de(this,Lr,void 0,"f")),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,Pr,"f")&&(clearTimeout(O(this,Pr,"f")),de(this,Pr,void 0,"f"));try{let r;this.isSurrealDB?r=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,hr,"f"),O(this,mi,"f")):r=await O(this,Jt,"f").subscribeQuery(O(this,hr,"f"),O(this,mi,"f")),de(this,Ht,r.subscriptionId,"f"),r.result?(de(this,pn,r.result,"f"),O(this,rs,"m",Du).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),de(this,Ot,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,Lr,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Ht,"f"),n=>{O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,dn,"f")&&(O(this,dn,"f").call(this,!0),de(this,dn,void 0,"f"),de(this,hn,void 0,"f")),!(n.isInit&&O(this,pn,"f"))&&(de(this,pn,n,"f"),O(this,rs,"m",Du).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),O(this,hn,"f")&&(O(this,hn,"f").call(this,r),de(this,dn,void 0,"f"),de(this,hn,void 0,"f")),r}let e=async()=>{if(!O(this,sa,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,hr,"f"),O(this,Ht,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,hr,"f"),O(this,Ht,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",O(this,mi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,sa,"f")||de(this,Pr,setTimeout(e,3e4),"f")}};de(this,Pr,setTimeout(e,3e4),"f")}get id(){return O(this,Ht,"f")}get initialized(){return O(this,ns,"f")}get result(){return O(this,pn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){de(this,sa,!0,"f"),clearTimeout(O(this,Pr,"f")),O(this,Lr,"f")&&O(this,Lr,"f").call(this),O(this,_n,"f").clear(),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,Ht,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};hr=new WeakMap,Ht=new WeakMap,Jt=new WeakMap,_n=new WeakMap,Pr=new WeakMap,Lr=new WeakMap,pn=new WeakMap,sa=new WeakMap,ns=new WeakMap,dn=new WeakMap,hn=new WeakMap,Ot=new WeakMap,mi=new WeakMap,rs=new WeakSet,Du=function t(e){for(let r of O(this,_n,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var gi=class{constructor(t,e){se.set(this,void 0),ue.set(this,void 0),mn.set(this,void 0),yn.set(this,void 0),gn.set(this,void 0),ca.set(this,void 0),de(this,mn,[],"f"),de(this,yn,[],"f"),de(this,gn,[],"f"),de(this,ca,[],"f"),de(this,se,t,"f"),de(this,ue,e,"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,mn,"f")),O(this,ue,"f").addPerspectiveLinkRemovedListener(O(this,se,"f").uuid,O(this,yn,"f")),O(this,ue,"f").addPerspectiveLinkUpdatedListener(O(this,se,"f").uuid,O(this,gn,"f")),O(this,ue,"f").addPerspectiveSyncStateChangeListener(O(this,se,"f").uuid,O(this,ca,"f"))}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(t,e,r,n){return await O(this,ue,"f").executeCommands(O(this,se,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await O(this,ue,"f").queryLinks(O(this,se,"f").uuid,t)}async infer(t){return await O(this,ue,"f").queryProlog(O(this,se,"f").uuid,t)}async querySurrealDB(t){return await O(this,ue,"f").querySurrealDB(O(this,se,"f").uuid,t)}async add(t,e="shared",r){return await O(this,ue,"f").addLink(O(this,se,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await O(this,ue,"f").addLinks(O(this,se,"f").uuid,t,e,r)}async removeLinks(t,e){return await O(this,ue,"f").removeLinks(O(this,se,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await O(this,ue,"f").linkMutations(O(this,se,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await O(this,ue,"f").addLinkExpression(O(this,se,"f").uuid,t,e,r)}async update(t,e,r){return await O(this,ue,"f").updateLink(O(this,se,"f").uuid,t,e,r)}async remove(t,e){return await O(this,ue,"f").removeLink(O(this,se,"f").uuid,t,e)}async createBatch(){return await O(this,ue,"f").createBatch(O(this,se,"f").uuid)}async commitBatch(t){return await O(this,ue,"f").commitBatch(O(this,se,"f").uuid,t)}async getExpression(t){return await O(this,ue,"f").getExpression(t)}async createExpression(t,e){return await O(this,ue,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?O(this,mn,"f").push(e):t==="link-removed"?O(this,yn,"f").push(e):t==="link-updated"&&O(this,gn,"f").push(e)}async addSyncStateChangeListener(t){O(this,ca,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=O(this,mn,"f").indexOf(e);O(this,mn,"f").splice(r,1)}else if(t==="link-removed"){let r=O(this,yn,"f").indexOf(e);O(this,yn,"f").splice(r,1)}else if(t==="link-updated"){let r=O(this,gn,"f").indexOf(e);O(this,gn,"f").splice(r,1)}}async snapshot(){return O(this,ue,"f").snapshotByUUID(O(this,se,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new Ye({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let t=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let r of t){let n=await this.get(new Ye({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new Ye({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=Ze.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(t){let e=Ze.from(t);if((await this.get(new Ye({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Ye({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=Ze.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return O(this,ue,"f").addSdna(O(this,se,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e,r,n){let i;if(typeof t=="string")i=t,await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await O(this,ue,"f").createSubject(O(this,se,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,n)}return n?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await O(this,ue,"f").getSubjectData(O(this,se,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)try{let i=r.replace(/"/g,'\\"'),a=t.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${i}", C), instance(C, "${a}")`);return o&&o.length>0}catch(i){return console.warn(`Failed to check instance via Prolog for class ${r}:`,i),!1}if(n.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${we(t)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let i of n.requiredTriples){let a=we(t),o=we(i.predicate),s;if(i.target){let d=we(i.target);s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}' AND out.uri = '${d}'`}else s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}'`;let c=await this.querySurrealDB(s);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=new bi(this,t,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(t){try{let e=await this.get(new Ye({source:Ze.from(t).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${t}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${t} has no target:`,e[0]),null;let r=Ze.fromUrl(e[0].data.target).get(),n=[],i=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=i.exec(r))!==null;){o=!0;let p=a[1],f=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=f.exec(p))!==null;){let m=h[1],g=h[2];n.push({predicate:m,target:g})}}o||console.warn(`No instance rule found in SDNA for ${t}`);let s=n.map(p=>p.predicate),c=new Map,u=await this.infer(`subject_class("${t}", C), property(C, P)`);if(u)for(let p of u){let f=p.P,h=null,m=await this.infer(`subject_class("${t}", C), property_setter(C, "${f}", Setter)`);if(m&&m.length>0){let w=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);w&&(h=w[1]||w[2])}if(!h){let g=this.escapeRegExp(f),w=r.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${g}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));w&&(h=w[1])}if(h){let g=await this.infer(`subject_class("${t}", C), property_resolve_language(C, "${f}", Lang)`),w=g&&g.length>0?g[0].Lang:void 0;c.set(f,{predicate:h,resolveLanguage:w})}}let l=new Map,d=await this.infer(`subject_class("${t}", C), collection(C, Coll)`);if(d)for(let p of d){let f=p.Coll,h=null,m,g=await this.infer(`subject_class("${t}", C), collection_adder(C, "${f}", Adder)`);if(g&&g.length>0){let A=g[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);A&&(h=A[1]||A[2])}let w=this.escapeRegExp(f),b=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${w}"[^)]*\\)\\s*:-[^.]+\\.`),S=r.match(b);if(S){let _=S[0],A=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,R=_.match(A);if(R){let I=R[1];if(I.startsWith("(")&&I.endsWith(")")&&(I=I.substring(1,I.length-1)),!h){let F=I.match(/triple\([^,]+,\s*"([^"]+)"/);F&&(h=F[1])}let C=I.match(/subject_class\("([^"]+)"/);C&&(m=C[1])}}h&&l.set(f,{predicate:h,instanceFilter:m})}return{requiredPredicates:s,requiredTriples:n,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${t}:`,e),null}}generateSurrealInstanceQuery(t){return t.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${t.requiredTriples.map(r=>{let n=we(r.predicate);if(r.target){let i=we(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${i}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return;let i=n.properties.get(r);if(!i)return;let a=we(t),o=we(i.predicate),s=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(s);if(!c||c.length===0)return;let u=c[0].value;if(i.resolveLanguage&&u)try{let l=await this.getExpression(u);try{return JSON.parse(l.data)}catch{return l.data}}catch{return u}return u}async getCollectionValuesViaSurreal(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return[];let i=n.collections.get(r);if(!i)return[];let a=we(t),o=we(i.predicate),s=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(s);if(!c||c.length===0)return[];let u=c.map(l=>l.value).filter(l=>l!==""&&l!=="");if(i.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(i.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,i.instanceFilter)}catch{return this.filterInstancesSequential(u,i.instanceFilter)}return u}async batchCheckSubjectInstances(t,e){if(t.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${t.map(s=>`'${we(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let r=[];for(let i of e.requiredTriples){let a=t.map(u=>`'${we(u)}'`).join(", "),o=we(i.predicate),s;if(i.target){let u=we(i.target);s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' AND out.uri = '${u}' GROUP BY in.uri`}else s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' GROUP BY in.uri`;let c=await this.querySurrealDB(s);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?t:t.filter(i=>r.every(a=>a.has(i)))}async filterInstancesSequential(t,e){let r=[];for(let n of t)try{await this.isSubjectInstance(n,e)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{i.includes(l)||i.push(l)}):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of n)u+=`, property(C, "${l}")`;for(let l of i)u+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),u+=`, property_setter(C, "${d}", _)`}for(let l of o)u+=`, collection_adder(C, "${wg(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${xg(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${Tg(l)}", _)`;u+=".",e=u}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return O(this,ue,"f").getNeighbourhoodProxy(O(this,se,"f").uuid)}get ai(){return O(this,ue,"f").aiClient}async subscribeInfer(t){let e=new Ts(this.uuid,t,O(this,ue,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new Ts(this.uuid,t,O(this,ue,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};se=new WeakMap,ue=new WeakMap,mn=new WeakMap,yn=new WeakMap,gn=new WeakMap,ca=new WeakMap;var Nr=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},B=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Z,ua,la,fa,is,pa,as,os,nt=`
61
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Tu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),ms(ms({},t),{definitions:r})}function pg(t){var e=new Set(t.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 r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function dg(t){var e=Md(t);if(!ts.has(e)){var r=cg(t,{experimentalFragmentVariables:ys,allowLegacyFragmentVariables:ys});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ts.set(e,pg(fg(r)))}return ts.get(e)}function I(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),dg(n)}function hg(){ts.clear(),Tu.clear()}function mg(){$d=!1}function yg(){ys=!0}function gg(){ys=!1}var na={gql:I,resetCaches:hg,disableFragmentWarnings:mg,enableExperimentalFragmentVariables:yg,disableExperimentalFragmentVariables:gg};(function(t){t.gql=na.gql,t.resetCaches=na.resetCaches,t.disableFragmentWarnings=na.disableFragmentWarnings,t.enableExperimentalFragmentVariables=na.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=na.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function k(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function vg(){}function Jr(){return vg}var H=Jr,y=Jr,ze=Jr,me=Jr,G=Jr,xt=Jr,bg=Jr,Hu=Jr,jd=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ud=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},kn=class{constructor(e){this.code=e}};jd([y(),Ud("design:type",String)],kn.prototype,"code",void 0);kn=jd([G(),Ud("design:paramtypes",[String])],kn);var Ju=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Yu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},er=class{constructor(e,r){this.address=e,this.name=r}};Ju([y(),Yu("design:type",String)],er.prototype,"address",void 0);Ju([y(),Yu("design:type",String)],er.prototype,"name",void 0);er=Ju([G(),Yu("design:paramtypes",[String,String])],er);var Ie=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ue=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},vr=class{constructor(e,r){this.key=r,this.signature=e}};Ie([y(),Ue("design:type",String)],vr.prototype,"signature",void 0);Ie([y(),Ue("design:type",String)],vr.prototype,"key",void 0);Ie([y(),Ue("design:type",Boolean)],vr.prototype,"valid",void 0);Ie([y(),Ue("design:type",Boolean)],vr.prototype,"invalid",void 0);vr=Ie([G(),ze(),Ue("design:paramtypes",[String,String])],vr);var An=class{};Ie([y(),Ue("design:type",String)],An.prototype,"signature",void 0);Ie([y(),Ue("design:type",String)],An.prototype,"key",void 0);Ie([y(),Ue("design:type",Boolean)],An.prototype,"valid",void 0);Ie([y(),Ue("design:type",Boolean)],An.prototype,"invalid",void 0);An=Ie([ze()],An);function Yr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ie([y(),Ue("design:type",String)],e.prototype,"author",void 0),Ie([y(),Ue("design:type",String)],e.prototype,"timestamp",void 0),Ie([y(),Ue("design:type",Object)],e.prototype,"data",void 0),Ie([y(),Ue("design:type",vr)],e.prototype,"proof",void 0),e=Ie([G(),Ue("design:paramtypes",[String,String,Object,vr])],e),e}function _g(t){let e=class{};return Ie([y(),Ue("design:type",String)],e.prototype,"author",void 0),Ie([y(),Ue("design:type",String)],e.prototype,"timestamp",void 0),Ie([y(),Ue("design:type",Object)],e.prototype,"data",void 0),Ie([y(),Ue("design:type",An)],e.prototype,"proof",void 0),e=Ie([ze()],e),e}var gp=class extends Yr(){};gp=Ie([G()],gp);var gs=class extends Yr(){};Ie([y(),Ue("design:type",er)],gs.prototype,"language",void 0);Ie([y(),Ue("design:type",kn)],gs.prototype,"icon",void 0);gs=Ie([G()],gs);function DI(t){return t&&t.author&&t.timestamp&&t.data}var Le=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Xe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},On=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Le([y(),Xe("design:type",String)],On.prototype,"source",void 0);Le([y(),Xe("design:type",String)],On.prototype,"target",void 0);Le([y(),Xe("design:type",String)],On.prototype,"predicate",void 0);On=Le([G(),Xe("design:paramtypes",[Object])],On);var vs=class{};Le([y(),Xe("design:type",Array)],vs.prototype,"additions",void 0);Le([y(),Xe("design:type",Array)],vs.prototype,"removals",void 0);vs=Le([ze()],vs);var bs=class{constructor(e,r){this.additions=e,this.removals=r}};Le([y(),Xe("design:type",Array)],bs.prototype,"additions",void 0);Le([y(),Xe("design:type",Array)],bs.prototype,"removals",void 0);bs=Le([G(),Xe("design:paramtypes",[Array,Array])],bs);var Na=class{};Le([y(),Xe("design:type",String)],Na.prototype,"source",void 0);Le([y(),Xe("design:type",String)],Na.prototype,"target",void 0);Le([y(),Xe("design:type",String)],Na.prototype,"predicate",void 0);Na=Le([ze()],Na);var Qr=class extends Yr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Le([y(),Xe("design:type",String)],Qr.prototype,"status",void 0);Qr=Le([G()],Qr);var Iu=class extends _g(){};Le([y(),Xe("design:type",String)],Iu.prototype,"status",void 0);Iu=Le([ze()],Iu);function $I(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function MI(t){return t&&t.source&&t.target}var _s=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Le([y(),Xe("design:type",Qr)],_s.prototype,"oldLink",void 0);Le([y(),Xe("design:type",Qr)],_s.prototype,"newLink",void 0);_s=Le([G(),Xe("design:paramtypes",[Qr,Qr])],_s);var Mn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Qa=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ku,nr=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 r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};Mn([y(),Qa("design:type",Array)],nr.prototype,"links",void 0);nr=Mn([G(),Qa("design:paramtypes",[Array])],nr);var Ss=class{};Mn([y(),Qa("design:type",Array)],Ss.prototype,"links",void 0);Ss=Mn([ze()],Ss);var Au=ku=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new ku;return r.links.push(e),r}};Mn([y(),Qa("design:type",Array)],Au.prototype,"links",void 0);Au=ku=Mn([ze(),Qa("design:paramtypes",[Array])],Au);var Dn=class extends Yr(){};Dn=Mn([G()],Dn);var U=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},q=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},jr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new nr}};U([y(),q("design:type",String)],jr.prototype,"did",void 0);U([y(),q("design:type",nr)],jr.prototype,"perspective",void 0);U([y(),q("design:type",String)],jr.prototype,"directMessageLanguage",void 0);jr=U([G(),q("design:paramtypes",[String,nr])],jr);var vp=class extends Yr(){};vp=U([G()],vp);var zr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([y(),q("design:type",String)],zr.prototype,"did",void 0);U([y(),q("design:type",String)],zr.prototype,"didSigningKeyId",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKeyType",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKey",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKeySignedByDid",void 0);U([y(),q("design:type",String)],zr.prototype,"didSignedByDeviceKey",void 0);zr=U([G(),q("design:paramtypes",[String,String,String,String,String,String])],zr);var Gr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([y(),q("design:type",String)],Gr.prototype,"did",void 0);U([y(),q("design:type",String)],Gr.prototype,"didSigningKeyId",void 0);U([y(),q("design:type",String)],Gr.prototype,"deviceKeyType",void 0);U([y(),q("design:type",String)],Gr.prototype,"deviceKey",void 0);U([y(),q("design:type",String)],Gr.prototype,"deviceKeySignedByDid",void 0);U([y(),q("design:type",String)],Gr.prototype,"didSignedByDeviceKey",void 0);Gr=U([ze(),q("design:paramtypes",[String,String,String,String,String,String])],Gr);var ws=class{constructor(e,r){this.signature=e,this.publicKey=r}};U([y(),q("design:type",String)],ws.prototype,"signature",void 0);U([y(),q("design:type",String)],ws.prototype,"publicKey",void 0);ws=U([G(),q("design:paramtypes",[String,String])],ws);var Si=class{constructor(e,r){this.domain=e,this.pointers=r}};U([y(),q("design:type",String)],Si.prototype,"domain",void 0);U([y(),q("design:type",Array)],Si.prototype,"pointers",void 0);Si=U([G(),q("design:paramtypes",[String,Array])],Si);var Es=class{constructor(e,r){this.with=e,this.can=r}};U([y(),q("design:type",Si)],Es.prototype,"with",void 0);U([y(),q("design:type",Array)],Es.prototype,"can",void 0);Es=U([G(),q("design:paramtypes",[Si,Array])],Es);var br=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};U([y(),q("design:type",String)],br.prototype,"appName",void 0);U([y(),q("design:type",String)],br.prototype,"appDesc",void 0);U([y(),q("design:type",String)],br.prototype,"appUrl",void 0);U([y(),q("design:type",String)],br.prototype,"appIconPath",void 0);U([y(),q("design:type",Array)],br.prototype,"capabilities",void 0);br=U([G(),q("design:paramtypes",[String,String,String,Array,String])],br);var wi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};U([y(),q("design:type",String)],wi.prototype,"requestId",void 0);U([y(),q("design:type",String)],wi.prototype,"token",void 0);U([y(),q("design:type",Boolean)],wi.prototype,"revoked",void 0);U([y(),q("design:type",br)],wi.prototype,"auth",void 0);wi=U([G(),q("design:paramtypes",[String,br,String,Boolean])],wi);var Ei=class{constructor(e,r){this.domain=e,this.pointers=r}};U([y(),q("design:type",String)],Ei.prototype,"domain",void 0);U([y(),q("design:type",Array)],Ei.prototype,"pointers",void 0);Ei=U([ze(),q("design:paramtypes",[String,Array])],Ei);var xs=class{constructor(e,r){this.with=e,this.can=r}};U([y(),q("design:type",Ei)],xs.prototype,"with",void 0);U([y(),q("design:type",Array)],xs.prototype,"can",void 0);xs=U([ze(),q("design:paramtypes",[Ei,Array])],xs);var ir=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};U([y(),q("design:type",String)],ir.prototype,"appName",void 0);U([y(),q("design:type",String)],ir.prototype,"appDesc",void 0);U([y(),q("design:type",String)],ir.prototype,"appDomain",void 0);U([y(),q("design:type",String)],ir.prototype,"appUrl",void 0);U([y(),q("design:type",String)],ir.prototype,"appIconPath",void 0);U([y(),q("design:type",Array)],ir.prototype,"capabilities",void 0);ir=U([ze(),q("design:paramtypes",[String,String,String,String,String,Array])],ir);var Nn=class{constructor(e,r,n){this.did=e,this.success=r,this.error=n}};U([y(),q("design:type",String)],Nn.prototype,"did",void 0);U([y(),q("design:type",Boolean)],Nn.prototype,"success",void 0);U([y(),q("design:type",String)],Nn.prototype,"error",void 0);Nn=U([G(),q("design:paramtypes",[String,Boolean,String])],Nn);var Di=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ni=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Nt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isInitialized",void 0);Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isUnlocked",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"did",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"didDocument",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"error",void 0);Nt=Di([G(),Ni("design:paramtypes",[Object])],Nt);var bp=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ne=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},pt,dt,Ou=class{constructor(e,r){pt.set(this,void 0),dt.set(this,void 0),bp(this,pt,e,"f"),bp(this,dt,r,"f")}async otherAgents(){return await Ne(this,pt,"f").otherAgents(Ne(this,dt,"f"))}async hasTelepresenceAdapter(){return await Ne(this,pt,"f").hasTelepresenceAdapter(Ne(this,dt,"f"))}async onlineAgents(){return await Ne(this,pt,"f").onlineAgents(Ne(this,dt,"f"))}async setOnlineStatus(e){return await Ne(this,pt,"f").setOnlineStatus(Ne(this,dt,"f"),e)}async setOnlineStatusU(e){return await Ne(this,pt,"f").setOnlineStatusU(Ne(this,dt,"f"),e)}async sendSignal(e,r){return await Ne(this,pt,"f").sendSignal(Ne(this,dt,"f"),e,r)}async sendSignalU(e,r){return await Ne(this,pt,"f").sendSignalU(Ne(this,dt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Ne(this,pt,"f").sendBroadcast(Ne(this,dt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Ne(this,pt,"f").sendBroadcastU(Ne(this,dt,"f"),e,r)}async addSignalHandler(e){await Ne(this,pt,"f").addSignalHandler(Ne(this,dt,"f"),e)}removeSignalHandler(e){Ne(this,pt,"f").removeSignalHandler(Ne(this,dt,"f"),e)}};pt=new WeakMap,dt=new WeakMap;var jn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Un=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ye=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)}};jn([y(),Un("design:type",String)],Ye.prototype,"source",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"target",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"predicate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"fromDate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"untilDate",void 0);jn([y(),Un("design:type",Number)],Ye.prototype,"limit",void 0);Ye=jn([G(),ze(),Un("design:paramtypes",[Object])],Ye);var _p=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},He=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ht,dr;function Mo(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Ze=class{constructor(){ht.set(this,void 0),dr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new Ze;return _p(r,dr,e,"f"),r}static from(e){let r=new Ze;return _p(r,ht,e,"f"),r}toUrl(){if(He(this,dr,"f")&&!He(this,ht,"f"))return He(this,dr,"f");if(!He(this,dr,"f")&&(He(this,ht,"f")===void 0||He(this,ht,"f")===""||He(this,ht,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof He(this,ht,"f")){case"string":e=`string:${Mo(He(this,ht,"f"))}`;break;case"number":e=`number:${Mo(He(this,ht,"f"))}`;break;case"boolean":e=`boolean:${Mo(He(this,ht,"f"))}`;break;case"object":e=`json:${Mo(JSON.stringify(He(this,ht,"f")))}`;break}return`literal://${e}`}get(){if(He(this,ht,"f"))return He(this,ht,"f");if(!He(this,dr,"f"))throw new Error("Can't render empty Literal");if(!He(this,dr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=He(this,dr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};ht=new WeakMap,dr=new WeakMap;function Ur(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Zu(t){return`set${Ur(t)}`}function vi(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Xu(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function Sg(t){return`add${Ur(Xu(t))}`}function wg(t){let e=t.substring(3),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Eg(t){return`remove${Ur(Xu(t))}`}function xg(t){let e=t.substring(6),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Tg(t){let e=t.substring(13),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Ig(t){return`setCollection${Ur(Xu(t))}`}function fn(t){if(Array.isArray(t))return`[${t.map(fn).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var ou=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Y=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},it,at,Ce,bi=class{constructor(t,e,r){it.set(this,void 0),at.set(this,void 0),Ce.set(this,void 0),ou(this,it,e,"f"),ou(this,at,r,"f"),ou(this,Ce,t,"f")}get baseExpression(){return Y(this,it,"f")}async init(){let isInstance=await Y(this,Ce,"f").isSubjectInstance(Y(this,it,"f"),Y(this,at,"f"));if(!isInstance)throw`Not a valid subject instance of ${Y(this,at,"f")} for ${Y(this,it,"f")}`;let results=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties)await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_resolve(C, "${t}")`),Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Ce,"f").getPropertyValueViaSurreal(Y(this,it,"f"),Y(this,at,"f"),t)}catch(e){console.warn(`Failed to get property ${t} via SurrealDB:`,e);return}}});let setters=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Zu(property)]=async t=>{resolveLanguage&&(t=await Y(this,Ce,"f").createExpression(t,resolveLanguage)),await Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let results2=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Ce,"f").getCollectionValuesViaSurreal(Y(this,it,"f"),Y(this,at,"f"),t)}catch(e){return console.warn(`Failed to get collection ${t} via SurrealDB:`,e),[]}}});let adders=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[Sg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:e}]))):await Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let removers=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[Eg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:e}]))):await Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}let collectionSetters=await Y(this,Ce,"f").infer(`subject_class("${Y(this,at,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Ig(collection)]=async t=>{Array.isArray(t)?await Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),t.map(e=>({name:"value",value:e}))):await Y(this,Ce,"f").executeAction(actions,Y(this,it,"f"),[{name:"value",value:t}])}}}};it=new WeakMap,at=new WeakMap,Ce=new WeakMap;function Sp(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function ak(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Sp(e)} your ${r} actions, with access to ${Sp(n)}`}function we(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var he=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},O=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rs,hr,Ht,Jt,_n,Pr,Fr,pn,ca,ns,dn,hn,Ot,mi,Du,ce,le,mn,yn,gn,ua,Ts=class{constructor(e,r,n){rs.add(this),hr.set(this,void 0),Ht.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),Pr.set(this,void 0),Fr.set(this,void 0),pn.set(this,void 0),ca.set(this,!1),ns.set(this,void 0),dn.set(this,void 0),hn.set(this,void 0),Ot.set(this,void 0),mi.set(this,void 0),this.isSurrealDB=!1,he(this,hr,e,"f"),he(this,mi,r,"f"),he(this,Jt,n,"f"),he(this,_n,new Set,"f"),he(this,pn,null,"f"),he(this,ns,new Promise((i,a)=>{he(this,dn,i,"f"),he(this,hn,a,"f")}),"f")}async subscribe(){O(this,Fr,"f")&&(O(this,Fr,"f").call(this),he(this,Fr,void 0,"f")),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,Pr,"f")&&(clearTimeout(O(this,Pr,"f")),he(this,Pr,void 0,"f"));try{let r;this.isSurrealDB?r=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,hr,"f"),O(this,mi,"f")):r=await O(this,Jt,"f").subscribeQuery(O(this,hr,"f"),O(this,mi,"f")),he(this,Ht,r.subscriptionId,"f"),r.result?(he(this,pn,r.result,"f"),O(this,rs,"m",Du).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),he(this,Ot,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"),he(this,Fr,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Ht,"f"),n=>{O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,dn,"f")&&(O(this,dn,"f").call(this,!0),he(this,dn,void 0,"f"),he(this,hn,void 0,"f")),!(n.isInit&&O(this,pn,"f"))&&(he(this,pn,n,"f"),O(this,rs,"m",Du).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),O(this,hn,"f")&&(O(this,hn,"f").call(this,r),he(this,dn,void 0,"f"),he(this,hn,void 0,"f")),r}let e=async()=>{if(!O(this,ca,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,hr,"f"),O(this,Ht,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,hr,"f"),O(this,Ht,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",O(this,mi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,ca,"f")||he(this,Pr,setTimeout(e,3e4),"f")}};he(this,Pr,setTimeout(e,3e4),"f")}get id(){return O(this,Ht,"f")}get initialized(){return O(this,ns,"f")}get result(){return O(this,pn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){he(this,ca,!0,"f"),clearTimeout(O(this,Pr,"f")),O(this,Fr,"f")&&O(this,Fr,"f").call(this),O(this,_n,"f").clear(),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,Ht,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};hr=new WeakMap,Ht=new WeakMap,Jt=new WeakMap,_n=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,pn=new WeakMap,ca=new WeakMap,ns=new WeakMap,dn=new WeakMap,hn=new WeakMap,Ot=new WeakMap,mi=new WeakMap,rs=new WeakSet,Du=function t(e){for(let r of O(this,_n,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var gi=class{constructor(t,e){ce.set(this,void 0),le.set(this,void 0),mn.set(this,void 0),yn.set(this,void 0),gn.set(this,void 0),ua.set(this,void 0),he(this,mn,[],"f"),he(this,yn,[],"f"),he(this,gn,[],"f"),he(this,ua,[],"f"),he(this,ce,t,"f"),he(this,le,e,"f"),this.uuid=O(this,ce,"f").uuid,this.name=O(this,ce,"f").name,this.owners=O(this,ce,"f").owners,this.sharedUrl=O(this,ce,"f").sharedUrl,this.neighbourhood=O(this,ce,"f").neighbourhood,this.state=O(this,ce,"f").state,O(this,le,"f").addPerspectiveLinkAddedListener(O(this,ce,"f").uuid,O(this,mn,"f")),O(this,le,"f").addPerspectiveLinkRemovedListener(O(this,ce,"f").uuid,O(this,yn,"f")),O(this,le,"f").addPerspectiveLinkUpdatedListener(O(this,ce,"f").uuid,O(this,gn,"f")),O(this,le,"f").addPerspectiveSyncStateChangeListener(O(this,ce,"f").uuid,O(this,ua,"f"))}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(t,e,r,n){return await O(this,le,"f").executeCommands(O(this,ce,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await O(this,le,"f").queryLinks(O(this,ce,"f").uuid,t)}async infer(t){return await O(this,le,"f").queryProlog(O(this,ce,"f").uuid,t)}async querySurrealDB(t){return await O(this,le,"f").querySurrealDB(O(this,ce,"f").uuid,t)}async add(t,e="shared",r){return await O(this,le,"f").addLink(O(this,ce,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await O(this,le,"f").addLinks(O(this,ce,"f").uuid,t,e,r)}async removeLinks(t,e){return await O(this,le,"f").removeLinks(O(this,ce,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await O(this,le,"f").linkMutations(O(this,ce,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await O(this,le,"f").addLinkExpression(O(this,ce,"f").uuid,t,e,r)}async update(t,e,r){return await O(this,le,"f").updateLink(O(this,ce,"f").uuid,t,e,r)}async remove(t,e){return await O(this,le,"f").removeLink(O(this,ce,"f").uuid,t,e)}async createBatch(){return await O(this,le,"f").createBatch(O(this,ce,"f").uuid)}async commitBatch(t){return await O(this,le,"f").commitBatch(O(this,ce,"f").uuid,t)}async getExpression(t){return await O(this,le,"f").getExpression(t)}async createExpression(t,e){return await O(this,le,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?O(this,mn,"f").push(e):t==="link-removed"?O(this,yn,"f").push(e):t==="link-updated"&&O(this,gn,"f").push(e)}async addSyncStateChangeListener(t){O(this,ua,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=O(this,mn,"f").indexOf(e);O(this,mn,"f").splice(r,1)}else if(t==="link-removed"){let r=O(this,yn,"f").indexOf(e);O(this,yn,"f").splice(r,1)}else if(t==="link-updated"){let r=O(this,gn,"f").indexOf(e);O(this,gn,"f").splice(r,1)}}async snapshot(){return O(this,le,"f").snapshotByUUID(O(this,ce,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new Ye({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let t=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let r of t){let n=await this.get(new Ye({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new Ye({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=Ze.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(t){let e=Ze.from(t);if((await this.get(new Ye({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Ye({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=Ze.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return O(this,le,"f").addSdna(O(this,ce,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e,r,n){let i;if(typeof t=="string")i=t,await O(this,le,"f").createSubject(O(this,ce,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await O(this,le,"f").createSubject(O(this,ce,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,n)}return n?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await O(this,le,"f").getSubjectData(O(this,ce,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await O(this,le,"f").getSubjectData(O(this,ce,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)try{let i=r.replace(/"/g,'\\"'),a=t.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${i}", C), instance(C, "${a}")`);return o&&o.length>0}catch(i){return console.warn(`Failed to check instance via Prolog for class ${r}:`,i),!1}if(n.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${we(t)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let i of n.requiredTriples){let a=we(t),o=we(i.predicate),s;if(i.target){let d=we(i.target);s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}' AND out.uri = '${d}'`}else s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}'`;let c=await this.querySurrealDB(s);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=new bi(this,t,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(t){try{let e=await this.get(new Ye({source:Ze.from(t).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${t}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${t} has no target:`,e[0]),null;let r=Ze.fromUrl(e[0].data.target).get(),n=[],i=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=i.exec(r))!==null;){o=!0;let p=a[1],f=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=f.exec(p))!==null;){let m=h[1],g=h[2];n.push({predicate:m,target:g})}}o||console.warn(`No instance rule found in SDNA for ${t}`);let s=n.map(p=>p.predicate),c=new Map,u=await this.infer(`subject_class("${t}", C), property(C, P)`);if(u)for(let p of u){let f=p.P,h=null,m=await this.infer(`subject_class("${t}", C), property_setter(C, "${f}", Setter)`);if(m&&m.length>0){let _=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);_&&(h=_[1]||_[2])}if(!h){let g=this.escapeRegExp(f),_=r.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${g}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));_&&(h=_[1])}if(h){let g=await this.infer(`subject_class("${t}", C), property_resolve_language(C, "${f}", Lang)`),_=g&&g.length>0?g[0].Lang:void 0;c.set(f,{predicate:h,resolveLanguage:_})}}let l=new Map,d=await this.infer(`subject_class("${t}", C), collection(C, Coll)`);if(d)for(let p of d){let f=p.Coll,h=null,m,g=await this.infer(`subject_class("${t}", C), collection_adder(C, "${f}", Adder)`);if(g&&g.length>0){let A=g[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);A&&(h=A[1]||A[2])}let _=this.escapeRegExp(f),S=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${_}"[^)]*\\)\\s*:-[^.]+\\.`),w=r.match(S);if(w){let b=w[0],A=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,R=b.match(A);if(R){let E=R[1];if(E.startsWith("(")&&E.endsWith(")")&&(E=E.substring(1,E.length-1)),!h){let F=E.match(/triple\([^,]+,\s*"([^"]+)"/);F&&(h=F[1])}let C=E.match(/subject_class\("([^"]+)"/);C&&(m=C[1])}}h&&l.set(f,{predicate:h,instanceFilter:m})}return{requiredPredicates:s,requiredTriples:n,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${t}:`,e),null}}generateSurrealInstanceQuery(t){return t.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${t.requiredTriples.map(r=>{let n=we(r.predicate);if(r.target){let i=we(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${i}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return;let i=n.properties.get(r);if(!i)return;let a=we(t),o=we(i.predicate),s=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(s);if(!c||c.length===0)return;let u=c[0].value;if(i.resolveLanguage&&u)try{let l=await this.getExpression(u);try{return JSON.parse(l.data)}catch{return l.data}}catch{return u}return u}async getCollectionValuesViaSurreal(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return[];let i=n.collections.get(r);if(!i)return[];let a=we(t),o=we(i.predicate),s=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(s);if(!c||c.length===0)return[];let u=c.map(l=>l.value).filter(l=>l!==""&&l!=="");if(i.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(i.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,i.instanceFilter)}catch{return this.filterInstancesSequential(u,i.instanceFilter)}return u}async batchCheckSubjectInstances(t,e){if(t.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${t.map(s=>`'${we(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let r=[];for(let i of e.requiredTriples){let a=t.map(u=>`'${we(u)}'`).join(", "),o=we(i.predicate),s;if(i.target){let u=we(i.target);s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' AND out.uri = '${u}' GROUP BY in.uri`}else s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' GROUP BY in.uri`;let c=await this.querySurrealDB(s);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?t:t.filter(i=>r.every(a=>a.has(i)))}async filterInstancesSequential(t,e){let r=[];for(let n of t)try{await this.isSubjectInstance(n,e)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{i.includes(l)||i.push(l)}):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of n)u+=`, property(C, "${l}")`;for(let l of i)u+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),u+=`, property_setter(C, "${d}", _)`}for(let l of o)u+=`, collection_adder(C, "${wg(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${xg(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${Tg(l)}", _)`;u+=".",e=u}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return O(this,le,"f").getNeighbourhoodProxy(O(this,ce,"f").uuid)}get ai(){return O(this,le,"f").aiClient}async subscribeInfer(t){let e=new Ts(this.uuid,t,O(this,le,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new Ts(this.uuid,t,O(this,le,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};ce=new WeakMap,le=new WeakMap,mn=new WeakMap,yn=new WeakMap,gn=new WeakMap,ua=new WeakMap;var Nr=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},V=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Z,la,fa,pa,is,da,as,os,nt=`
62
62
  author
63
63
  timestamp
64
64
  status
@@ -85,73 +85,73 @@ neighbourhood {
85
85
  }
86
86
  author
87
87
  }
88
- `,Is=class{constructor(e,r=!0){Z.set(this,void 0),ua.set(this,void 0),la.set(this,void 0),fa.set(this,void 0),is.set(this,void 0),pa.set(this,void 0),as.set(this,void 0),os.set(this,void 0),Nr(this,Z,e,"f"),Nr(this,ua,[],"f"),Nr(this,la,[],"f"),Nr(this,fa,[],"f"),Nr(this,is,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Nr(this,pa,e,"f")}setNeighbourhoodClient(e){Nr(this,as,e,"f")}setAIClient(e){Nr(this,os,e,"f")}get aiClient(){return B(this,os,"f")}async all(){let{perspectives:e}=k(await B(this,Z,"f").query({query:T`query perspectives {
88
+ `,Is=class{constructor(e,r=!0){Z.set(this,void 0),la.set(this,void 0),fa.set(this,void 0),pa.set(this,void 0),is.set(this,void 0),da.set(this,void 0),as.set(this,void 0),os.set(this,void 0),Nr(this,Z,e,"f"),Nr(this,la,[],"f"),Nr(this,fa,[],"f"),Nr(this,pa,[],"f"),Nr(this,is,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Nr(this,da,e,"f")}setNeighbourhoodClient(e){Nr(this,as,e,"f")}setAIClient(e){Nr(this,os,e,"f")}get aiClient(){return V(this,os,"f")}async all(){let{perspectives:e}=k(await V(this,Z,"f").query({query:I`query perspectives {
89
89
  perspectives {
90
90
  ${ui}
91
91
  }
92
- }`}));return e.map(r=>new gi(r,this))}async byUUID(e){let{perspective:r}=k(await B(this,Z,"f").query({query:T`query perspective($uuid: String!) {
92
+ }`}));return e.map(r=>new gi(r,this))}async byUUID(e){let{perspective:r}=k(await V(this,Z,"f").query({query:I`query perspective($uuid: String!) {
93
93
  perspective(uuid: $uuid) {
94
94
  ${ui}
95
95
  }
96
- }`,variables:{uuid:e}}));return r?new gi(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await B(this,Z,"f").query({query:T`query perspectiveSnapshot($uuid: String!) {
96
+ }`,variables:{uuid:e}}));return r?new gi(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await V(this,Z,"f").query({query:I`query perspectiveSnapshot($uuid: String!) {
97
97
  perspectiveSnapshot(uuid: $uuid) {
98
98
  links { ${nt} }
99
99
  }
100
- }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectivePublishSnapshot($uuid: String!) {
100
+ }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectivePublishSnapshot($uuid: String!) {
101
101
  perspectivePublishSnapshot(uuid: $uuid)
102
- }`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await B(this,Z,"f").query({query:T`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
102
+ }`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
103
103
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
104
104
  ${nt}
105
105
  }
106
- }`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await B(this,Z,"f").query({query:T`query perspectiveQueryProlog($uuid: String!, $query: String!) {
106
+ }`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQueryProlog($uuid: String!, $query: String!) {
107
107
  perspectiveQueryProlog(uuid: $uuid, query: $query)
108
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=k(await B(this,Z,"f").query({query:T`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
108
+ }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
109
109
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
110
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
110
+ }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
111
111
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
112
112
  subscriptionId
113
113
  result
114
114
  }
115
- }`,variables:{uuid:e,query:r}})),{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,r){let{perspectiveSubscribeSurrealQuery:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
115
+ }`,variables:{uuid:e,query:r}})),{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,r){let{perspectiveSubscribeSurrealQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
116
116
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
117
117
  subscriptionId
118
118
  result
119
119
  }
120
- }`,variables:{uuid:e,query:r}})),{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,r){let{perspectiveKeepAliveSurrealQuery:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
120
+ }`,variables:{uuid:e,query:r}})),{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,r){let{perspectiveKeepAliveSurrealQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
121
121
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
122
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
122
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
123
123
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
124
- }`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=B(this,Z,"f").subscribe({query:T`
124
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=V(this,Z,"f").subscribe({query:I`
125
125
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
126
126
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
127
127
  }
128
- `,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)}r(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
128
+ `,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)}r(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
129
129
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
130
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
130
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
131
131
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
132
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveAdd($name: String!) {
132
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAdd($name: String!) {
133
133
  perspectiveAdd(name: $name) {
134
134
  ${ui}
135
135
  }
136
- }`,variables:{name:e}}));return new gi(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveUpdate($uuid: String!, $name: String!) {
136
+ }`,variables:{name:e}}));return new gi(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveUpdate($uuid: String!, $name: String!) {
137
137
  perspectiveUpdate(uuid: $uuid, name: $name) {
138
138
  ${ui}
139
139
  }
140
- }`,variables:{uuid:e,name:r}}));return new gi(n,this)}async remove(e){return k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveRemove($uuid: String!) {
140
+ }`,variables:{uuid:e,name:r}}));return new gi(n,this)}async remove(e){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemove($uuid: String!) {
141
141
  perspectiveRemove(uuid: $uuid)
142
- }`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
142
+ }`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
143
143
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
144
144
  ${nt}
145
145
  }
146
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
146
+ }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
147
147
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
148
148
  ${nt}
149
149
  }
150
- }`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
150
+ }`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
151
151
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
152
152
  ${nt}
153
153
  }
154
- }`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
154
+ }`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
155
155
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
156
156
  additions {
157
157
  ${nt}
@@ -160,43 +160,43 @@ neighbourhood {
160
160
  ${nt}
161
161
  }
162
162
  }
163
- }`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
163
+ }`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
164
164
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
165
165
  ${nt}
166
166
  }
167
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
167
+ }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
168
168
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
169
169
  ${nt}
170
170
  }
171
- }`,variables:{uuid:e,oldLink:r,newLink:n,batchId:i}}));return a}async removeLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:i}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
171
+ }`,variables:{uuid:e,oldLink:r,newLink:n,batchId:i}}));return a}async removeLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
172
172
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
173
- }`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
173
+ }`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
174
174
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
175
- }`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
175
+ }`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
176
176
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
177
- }`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
177
+ }`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
178
178
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
179
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
179
+ }`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
180
180
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
181
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,pa,"f").get(e)}async createExpression(e,r){return await B(this,pa,"f").create(e,r)}addPerspectiveAddedListener(e){B(this,ua,"f").push(e)}subscribePerspectiveAdded(){B(this,Z,"f").subscribe({query:T` subscription {
181
+ }`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await V(this,da,"f").get(e)}async createExpression(e,r){return await V(this,da,"f").create(e,r)}addPerspectiveAddedListener(e){V(this,la,"f").push(e)}subscribePerspectiveAdded(){V(this,Z,"f").subscribe({query:I` subscription {
182
182
  perspectiveAdded { ${ui} }
183
183
  }
184
- `}).subscribe({next:e=>{B(this,ua,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,la,"f").push(e)}subscribePerspectiveUpdated(){B(this,Z,"f").subscribe({query:T` subscription {
184
+ `}).subscribe({next:e=>{V(this,la,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){V(this,fa,"f").push(e)}subscribePerspectiveUpdated(){V(this,Z,"f").subscribe({query:I` subscription {
185
185
  perspectiveUpdated { ${ui} }
186
186
  }
187
- `}).subscribe({next:e=>{B(this,la,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,is,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){B(this,Z,"f").subscribe({query:T` subscription {
187
+ `}).subscribe({next:e=>{V(this,fa,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){V(this,is,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
188
188
  perspectiveSyncStateChange(uuid: "${e}")
189
189
  }
190
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){B(this,fa,"f").push(e)}subscribePerspectiveRemoved(){B(this,Z,"f").subscribe({query:T` subscription {
190
+ `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){V(this,pa,"f").push(e)}subscribePerspectiveRemoved(){V(this,Z,"f").subscribe({query:I` subscription {
191
191
  perspectiveRemoved
192
192
  }
193
- `}).subscribe({next:e=>{B(this,fa,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){B(this,Z,"f").subscribe({query:T` subscription {
193
+ `}).subscribe({next:e=>{V(this,pa,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
194
194
  perspectiveLinkAdded(uuid: "${e}") { ${nt} }
195
195
  }
196
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){B(this,Z,"f").subscribe({query:T` subscription {
196
+ `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
197
197
  perspectiveLinkRemoved(uuid: "${e}") { ${nt} }
198
198
  }
199
- `}).subscribe({next:n=>{r.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,r){B(this,Z,"f").subscribe({query:T` subscription {
199
+ `}).subscribe({next:n=>{r.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,r){V(this,Z,"f").subscribe({query:I` subscription {
200
200
  perspectiveLinkUpdated(uuid: "${e}") {
201
201
  oldLink {
202
202
  ${nt}
@@ -206,9 +206,9 @@ neighbourhood {
206
206
  }
207
207
  }
208
208
  }
209
- `}).subscribe({next:n=>{r.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 Ou(B(this,as,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveCreateBatch($uuid: String!) {
209
+ `}).subscribe({next:n=>{r.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 Ou(V(this,as,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCreateBatch($uuid: String!) {
210
210
  perspectiveCreateBatch(uuid: $uuid)
211
- }`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=k(await B(this,Z,"f").mutate({mutation:T`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
211
+ }`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
212
212
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
213
213
  additions {
214
214
  ${nt}
@@ -217,7 +217,7 @@ neighbourhood {
217
217
  ${nt}
218
218
  }
219
219
  }
220
- }`,variables:{uuid:e,batchId:r}}));return n}};Z=new WeakMap,ua=new WeakMap,la=new WeakMap,fa=new WeakMap,is=new WeakMap,pa=new WeakMap,as=new WeakMap,os=new WeakMap;var jo=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},re=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ce,da,ha,ma,na=`
220
+ }`,variables:{uuid:e,batchId:r}}));return n}};Z=new WeakMap,la=new WeakMap,fa=new WeakMap,pa=new WeakMap,is=new WeakMap,da=new WeakMap,as=new WeakMap,os=new WeakMap;var jo=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},re=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ue,ha,ma,ya,ia=`
221
221
  did
222
222
  directMessageLanguage
223
223
  perspective {
@@ -263,17 +263,17 @@ neighbourhood {
263
263
  `,kg=`
264
264
  signature
265
265
  publicKey
266
- `,Na=class{constructor(e,r=!0){ce.set(this,void 0),da.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),jo(this,ce,e,"f"),jo(this,ha,[],"f"),jo(this,ma,[],"f"),jo(this,da,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await re(this,ce,"f").query({query:T`query agent { agent { ${na} } }`})),r=new jr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await re(this,ce,"f").query({query:T`query agentStatus {
266
+ `,Ca=class{constructor(e,r=!0){ue.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),ya.set(this,void 0),jo(this,ue,e,"f"),jo(this,ma,[],"f"),jo(this,ya,[],"f"),jo(this,ha,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await re(this,ue,"f").query({query:I`query agent { agent { ${ia} } }`})),r=new jr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await re(this,ue,"f").query({query:I`query agentStatus {
267
267
  agentStatus {
268
268
  ${li}
269
269
  }
270
- }`}));return new Nt(e)}async generate(e){let{agentGenerate:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentGenerate(
270
+ }`}));return new Nt(e)}async generate(e){let{agentGenerate:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentGenerate(
271
271
  $passphrase: String!
272
272
  ) {
273
273
  agentGenerate(passphrase: $passphrase) {
274
274
  ${li}
275
275
  }
276
- }`,variables:{passphrase:e}}));return new Nt(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentImport(
276
+ }`,variables:{passphrase:e}}));return new Nt(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentImport(
277
277
  $did: String!,
278
278
  $didDocument: String!,
279
279
  $keystore: String!,
@@ -282,103 +282,103 @@ neighbourhood {
282
282
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
283
283
  ${li}
284
284
  }
285
- }`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Nt(o)}async lock(e){let{agentLock:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentLock($passphrase: String!) {
285
+ }`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Nt(o)}async lock(e){let{agentLock:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentLock($passphrase: String!) {
286
286
  agentLock(passphrase: $passphrase) {
287
287
  ${li}
288
288
  }
289
- }`,variables:{passphrase:e}}));return new Nt(r)}async unlock(e,r=!0){let{agentUnlock:n}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
289
+ }`,variables:{passphrase:e}}));return new Nt(r)}async unlock(e,r=!0){let{agentUnlock:n}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
290
290
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
291
291
  ${li}
292
292
  }
293
- }`,variables:{passphrase:e,holochain:r}}));return new Nt(n)}async byDID(e){let{agentByDID:r}=k(await re(this,ce,"f").query({query:T`query agentByDID($did: String!) {
293
+ }`,variables:{passphrase:e,holochain:r}}));return new Nt(n)}async byDID(e){let{agentByDID:r}=k(await re(this,ue,"f").query({query:I`query agentByDID($did: String!) {
294
294
  agentByDID(did: $did) {
295
- ${na}
295
+ ${ia}
296
296
  }
297
- }`,variables:{did:e}}));return r}async updatePublicPerspective(e){let r=JSON.parse(JSON.stringify(e));delete r.__typename,r.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:n}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
297
+ }`,variables:{did:e}}));return r}async updatePublicPerspective(e){let r=JSON.parse(JSON.stringify(e));delete r.__typename,r.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:n}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
298
298
  agentUpdatePublicPerspective(perspective: $perspective) {
299
- ${na}
299
+ ${ia}
300
300
  }
301
- }`,variables:{perspective:r}})),i=n,a=new jr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new Is(re(this,ce,"f")),n=new Na(re(this,ce,"f")),i=await r.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 r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
301
+ }`,variables:{perspective:r}})),i=n,a=new jr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new Is(re(this,ue,"f")),n=new Ca(re(this,ue,"f")),i=await r.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 r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
302
302
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
303
- ${na}
303
+ ${ia}
304
304
  }
305
- }`,variables:{directMessageLanguage:e}})),n=r,i=new jr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
305
+ }`,variables:{directMessageLanguage:e}})),n=r,i=new jr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
306
306
  agentAddEntanglementProofs(proofs: $proofs) {
307
307
  ${qo}
308
308
  }
309
- }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
309
+ }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
310
310
  agentDeleteEntanglementProofs(proofs: $proofs) {
311
311
  ${qo}
312
312
  }
313
- }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await re(this,ce,"f").query({query:T`query agentGetEntanglementProofs {
313
+ }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await re(this,ue,"f").query({query:I`query agentGetEntanglementProofs {
314
314
  agentGetEntanglementProofs {
315
315
  ${qo}
316
316
  }
317
- }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
317
+ }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
318
318
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
319
319
  ${qo}
320
320
  }
321
- }`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){re(this,ha,"f").push(e)}addAppChangedListener(e){re(this,da,"f").push(e)}subscribeAgentUpdated(){re(this,ce,"f").subscribe({query:T` subscription {
322
- agentUpdated { ${na} }
321
+ }`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){re(this,ma,"f").push(e)}addAppChangedListener(e){re(this,ha,"f").push(e)}subscribeAgentUpdated(){re(this,ue,"f").subscribe({query:I` subscription {
322
+ agentUpdated { ${ia} }
323
323
  }
324
- `}).subscribe({next:e=>{let r=e.data.agentUpdated;re(this,ha,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){re(this,ce,"f").subscribe({query:T` subscription {
324
+ `}).subscribe({next:e=>{let r=e.data.agentUpdated;re(this,ma,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){re(this,ue,"f").subscribe({query:I` subscription {
325
325
  agentAppsChanged {
326
326
  ${Uo}
327
327
  }
328
328
  }
329
- `}).subscribe({next:e=>{re(this,da,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){re(this,ma,"f").push(e)}subscribeAgentStatusChanged(){re(this,ce,"f").subscribe({query:T` subscription {
329
+ `}).subscribe({next:e=>{re(this,ha,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){re(this,ya,"f").push(e)}subscribeAgentStatusChanged(){re(this,ue,"f").subscribe({query:I` subscription {
330
330
  agentStatusChanged { ${li} }
331
331
  }
332
- `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;re(this,ma,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await re(this,ce,"f").mutate({mutation:T`
332
+ `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;re(this,ya,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await re(this,ue,"f").mutate({mutation:I`
333
333
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
334
334
  agentRequestCapability(authInfo: $authInfo)
335
335
  }
336
- `,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=k(await re(this,ce,"f").mutate({mutation:T`
336
+ `,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=k(await re(this,ue,"f").mutate({mutation:I`
337
337
  mutation agentPermitCapability($auth: String!) {
338
338
  agentPermitCapability(auth: $auth)
339
339
  }
340
- `,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await re(this,ce,"f").mutate({mutation:T`
340
+ `,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await re(this,ue,"f").mutate({mutation:I`
341
341
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
342
342
  agentGenerateJwt(requestId: $requestId, rand: $rand)
343
343
  }
344
- `,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await re(this,ce,"f").mutate({mutation:T`query agentGetApps {
344
+ `,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await re(this,ue,"f").mutate({mutation:I`query agentGetApps {
345
345
  agentGetApps {
346
346
  ${Uo}
347
347
  }
348
- }`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentRemoveApp($requestId: String!) {
348
+ }`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentRemoveApp($requestId: String!) {
349
349
  agentRemoveApp(requestId: $requestId) {
350
350
  ${Uo}
351
351
  }
352
- }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentRevokeToken($requestId: String!) {
352
+ }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentRevokeToken($requestId: String!) {
353
353
  agentRevokeToken(requestId: $requestId) {
354
354
  ${Uo}
355
355
  }
356
- }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await re(this,ce,"f").mutate({mutation:T`
356
+ }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await re(this,ue,"f").mutate({mutation:I`
357
357
  query agentIsLocked {
358
358
  agentIsLocked
359
359
  }
360
- `}));return e}async signMessage(e){let{agentSignMessage:r}=k(await re(this,ce,"f").mutate({mutation:T`mutation agentSignMessage($message: String!) {
360
+ `}));return e}async signMessage(e){let{agentSignMessage:r}=k(await re(this,ue,"f").mutate({mutation:I`mutation agentSignMessage($message: String!) {
361
361
  agentSignMessage(message: $message) {
362
362
  ${kg}
363
363
  }
364
- }`,variables:{message:e}}));return r}async createUser(e,r,n){let{runtimeCreateUser:i}=k(await re(this,ce,"f").mutate({mutation:T`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
364
+ }`,variables:{message:e}}));return r}async createUser(e,r,n){let{runtimeCreateUser:i}=k(await re(this,ue,"f").mutate({mutation:I`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
365
365
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
366
366
  did
367
367
  success
368
368
  error
369
369
  }
370
- }`,variables:{email:e,password:r,appInfo:n}}));return i}async loginUser(e,r){let{runtimeLoginUser:n}=k(await re(this,ce,"f").mutate({mutation:T`mutation runtimeLoginUser($email: String!, $password: String!) {
370
+ }`,variables:{email:e,password:r,appInfo:n}}));return i}async loginUser(e,r){let{runtimeLoginUser:n}=k(await re(this,ue,"f").mutate({mutation:I`mutation runtimeLoginUser($email: String!, $password: String!) {
371
371
  runtimeLoginUser(email: $email, password: $password)
372
- }`,variables:{email:e,password:r}}));return n}async requestLoginVerification(e,r){let{runtimeRequestLoginVerification:n}=k(await re(this,ce,"f").mutate({mutation:T`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
372
+ }`,variables:{email:e,password:r}}));return n}async requestLoginVerification(e,r){let{runtimeRequestLoginVerification:n}=k(await re(this,ue,"f").mutate({mutation:I`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
373
373
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
374
374
  success
375
375
  message
376
376
  requiresPassword
377
377
  isExistingUser
378
378
  }
379
- }`,variables:{email:e,appInfo:r}}));return n}async verifyEmailCode(e,r,n){let{runtimeVerifyEmailCode:i}=k(await re(this,ce,"f").mutate({mutation:T`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
379
+ }`,variables:{email:e,appInfo:r}}));return n}async verifyEmailCode(e,r,n){let{runtimeVerifyEmailCode:i}=k(await re(this,ue,"f").mutate({mutation:I`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
380
380
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
381
- }`,variables:{email:e,code:r,verificationType:n}}));return i}};ce=new WeakMap,da=new WeakMap,ha=new WeakMap,ma=new WeakMap;var Ag=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Cr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ut,wp=`
381
+ }`,variables:{email:e,code:r,verificationType:n}}));return i}};ue=new WeakMap,ha=new WeakMap,ma=new WeakMap,ya=new WeakMap;var Ag=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Cr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ut,wp=`
382
382
  name
383
383
  address
384
384
  settings
@@ -395,45 +395,45 @@ neighbourhood {
395
395
  templateAppliedParams
396
396
  possibleTemplateParams
397
397
  sourceCodeLink
398
- `,Nu=class{constructor(e){Ut.set(this,void 0),Ag(this,Ut,e,"f")}async byAddress(e){let{language:r}=k(await Cr(this,Ut,"f").query({query:T`query byAddress($address: String!) {
398
+ `,Nu=class{constructor(e){Ut.set(this,void 0),Ag(this,Ut,e,"f")}async byAddress(e){let{language:r}=k(await Cr(this,Ut,"f").query({query:I`query byAddress($address: String!) {
399
399
  language(address: $address) {
400
400
  ${wp}
401
401
  }
402
- }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await Cr(this,Ut,"f").query({query:T`query byFilter($filter: String!) {
402
+ }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await Cr(this,Ut,"f").query({query:I`query byFilter($filter: String!) {
403
403
  languages(filter: $filter) {
404
404
  ${wp}
405
405
  }
406
- }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await Cr(this,Ut,"f").mutate({mutation:T`mutation writeSettings($languageAddress: String!, $settings: String!) {
406
+ }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation writeSettings($languageAddress: String!, $settings: String!) {
407
407
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
408
- }`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:T`mutation languageApplyTemplateAndPublish(
408
+ }`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageApplyTemplateAndPublish(
409
409
  $sourceLanguageHash: String!,
410
410
  $templateData: String!,
411
411
  ) {
412
412
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
413
413
  name, address
414
414
  }
415
- }`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:T`mutation languagePublish(
415
+ }`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languagePublish(
416
416
  $languagePath: String!,
417
417
  $languageMeta: LanguageMetaInput!,
418
418
  ) {
419
419
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
420
420
  ${Ep}
421
421
  }
422
- }`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await Cr(this,Ut,"f").query({query:T`query languageMeta(
422
+ }`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await Cr(this,Ut,"f").query({query:I`query languageMeta(
423
423
  $address: String!,
424
424
  ) {
425
425
  languageMeta(address: $address) {
426
426
  ${Ep}
427
427
  }
428
- }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await Cr(this,Ut,"f").query({query:T`query languageSource(
428
+ }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await Cr(this,Ut,"f").query({query:I`query languageSource(
429
429
  $address: String!,
430
430
  ) {
431
431
  languageSource(address: $address)
432
- }`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await Cr(this,Ut,"f").mutate({mutation:T`mutation languageRemove(
432
+ }`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageRemove(
433
433
  $address: String!,
434
434
  ) {
435
435
  languageRemove(address: $address)
436
- }`,variables:{address:e}}));return r}};Ut=new WeakMap;var Og=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},tt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ot,yi,Cu=class{constructor(e){ot.set(this,void 0),yi.set(this,new Map),Og(this,ot,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodPublishFromPerspective(
436
+ }`,variables:{address:e}}));return r}};Ut=new WeakMap;var Og=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},tt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ot,yi,Cu=class{constructor(e){ot.set(this,void 0),yi.set(this,new Map),Og(this,ot,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodPublishFromPerspective(
437
437
  $linkLanguage: String!,
438
438
  $meta: PerspectiveInput!,
439
439
  $perspectiveUUID: String!
@@ -443,7 +443,7 @@ neighbourhood {
443
443
  meta: $meta,
444
444
  perspectiveUUID: $perspectiveUUID
445
445
  )
446
- }`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodJoinFromUrl($url: String!) {
446
+ }`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodJoinFromUrl($url: String!) {
447
447
  neighbourhoodJoinFromUrl(url: $url) {
448
448
  uuid
449
449
  name
@@ -465,11 +465,11 @@ neighbourhood {
465
465
  author
466
466
  }
467
467
  }
468
- }`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await tt(this,ot,"f").query({query:T`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
468
+ }`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await tt(this,ot,"f").query({query:I`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
469
469
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
470
- }`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await tt(this,ot,"f").query({query:T`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
470
+ }`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await tt(this,ot,"f").query({query:I`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
471
471
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
472
- }`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await tt(this,ot,"f").query({query:T`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
472
+ }`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await tt(this,ot,"f").query({query:I`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
473
473
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
474
474
  did
475
475
  status {
@@ -486,7 +486,7 @@ neighbourhood {
486
486
  proof { valid, invalid, signature, key }
487
487
  }
488
488
  }
489
- }`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSetOnlineStatus(
489
+ }`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatus(
490
490
  $perspectiveUUID: String!,
491
491
  $status: PerspectiveInput!
492
492
  ) {
@@ -494,7 +494,7 @@ neighbourhood {
494
494
  perspectiveUUID: $perspectiveUUID,
495
495
  status: $status
496
496
  )
497
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSetOnlineStatusU(
497
+ }`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatusU(
498
498
  $perspectiveUUID: String!,
499
499
  $status: PerspectiveUnsignedInput!
500
500
  ) {
@@ -502,7 +502,7 @@ neighbourhood {
502
502
  perspectiveUUID: $perspectiveUUID,
503
503
  status: $status
504
504
  )
505
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSendSignal(
505
+ }`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendSignal(
506
506
  $perspectiveUUID: String!,
507
507
  $remoteAgentDid: String!,
508
508
  $payload: PerspectiveInput!
@@ -512,7 +512,7 @@ neighbourhood {
512
512
  remoteAgentDid: $remoteAgentDid,
513
513
  payload: $payload
514
514
  )
515
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSendSignalU(
515
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendSignalU(
516
516
  $perspectiveUUID: String!,
517
517
  $remoteAgentDid: String!,
518
518
  $payload: PerspectiveUnsignedInput!
@@ -522,7 +522,7 @@ neighbourhood {
522
522
  remoteAgentDid: $remoteAgentDid,
523
523
  payload: $payload
524
524
  )
525
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSendBroadcast(
525
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcast(
526
526
  $perspectiveUUID: String!,
527
527
  $payload: PerspectiveInput!,
528
528
  $loopback: Boolean
@@ -532,7 +532,7 @@ neighbourhood {
532
532
  payload: $payload,
533
533
  loopback: $loopback
534
534
  )
535
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await tt(this,ot,"f").mutate({mutation:T`mutation neighbourhoodSendBroadcastU(
535
+ }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await tt(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcastU(
536
536
  $perspectiveUUID: String!,
537
537
  $payload: PerspectiveUnsignedInput!,
538
538
  $loopback: Boolean
@@ -542,7 +542,7 @@ neighbourhood {
542
542
  payload: $payload,
543
543
  loopback: $loopback
544
544
  )
545
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=tt(this,yi,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await tt(this,ot,"f").subscribe({query:T`subscription neighbourhoodSignal($perspectiveUUID: String!) {
545
+ }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=tt(this,yi,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await tt(this,ot,"f").subscribe({query:I`subscription neighbourhoodSignal($perspectiveUUID: String!) {
546
546
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
547
547
  author
548
548
  timestamp
@@ -557,7 +557,7 @@ neighbourhood {
557
557
  }
558
558
  proof { valid, invalid, signature, key }
559
559
  }
560
- }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=tt(this,yi,"f").get(e);n||(n=[],tt(this,yi,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=tt(this,yi,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};ot=new WeakMap,yi=new WeakMap;var Bo=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},V=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},G,ya,ga,va,qd,Vo=`
560
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=tt(this,yi,"f").get(e);n||(n=[],tt(this,yi,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=tt(this,yi,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};ot=new WeakMap,yi=new WeakMap;var Bo=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Q=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},W,ga,va,ba,qd,Vo=`
561
561
  author
562
562
  timestamp
563
563
  data {
@@ -586,64 +586,64 @@ ${Dg}
586
586
  notification { ${Bd} }
587
587
  perspectiveId
588
588
  triggerMatch
589
- `,Ru=class{constructor(e,r=!0){G.set(this,void 0),ya.set(this,void 0),ga.set(this,void 0),va.set(this,void 0),qd.set(this,void 0),Bo(this,G,e,"f"),Bo(this,ya,[],"f"),Bo(this,ga,[],"f"),Bo(this,va,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await V(this,G,"f").query({query:T`query runtimeInfo {
589
+ `,Ru=class{constructor(e,r=!0){W.set(this,void 0),ga.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),qd.set(this,void 0),Bo(this,W,e,"f"),Bo(this,ga,[],"f"),Bo(this,va,[],"f"),Bo(this,ba,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await Q(this,W,"f").query({query:I`query runtimeInfo {
590
590
  runtimeInfo {
591
591
  ad4mExecutorVersion,
592
592
  isInitialized,
593
593
  isUnlocked
594
594
  }
595
- }`}));return e}async quit(){return k(await V(this,G,"f").mutate({mutation:T`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeOpenLink($url: String!) {
595
+ }`}));return e}async quit(){return k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeOpenLink($url: String!) {
596
596
  runtimeOpenLink(url: $url)
597
- }`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await V(this,G,"f").mutate({mutation:T`mutation addTrustedAgents($agents: [String!]!) {
597
+ }`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation addTrustedAgents($agents: [String!]!) {
598
598
  addTrustedAgents(agents: $agents)
599
- }`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await V(this,G,"f").mutate({mutation:T`mutation deleteTrustedAgents($agents: [String!]!) {
599
+ }`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation deleteTrustedAgents($agents: [String!]!) {
600
600
  deleteTrustedAgents(agents: $agents)
601
- }`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await V(this,G,"f").query({query:T`query getTrustedAgents {
601
+ }`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await Q(this,W,"f").query({query:I`query getTrustedAgents {
602
602
  getTrustedAgents
603
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
603
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
604
604
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
605
- }`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
605
+ }`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
606
606
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
607
- }`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await V(this,G,"f").query({query:T`query runtimeKnownLinkLanguageTemplates {
607
+ }`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await Q(this,W,"f").query({query:I`query runtimeKnownLinkLanguageTemplates {
608
608
  runtimeKnownLinkLanguageTemplates
609
- }`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeAddFriends($dids: [String!]!) {
609
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeAddFriends($dids: [String!]!) {
610
610
  runtimeAddFriends(dids: $dids)
611
- }`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeRemoveFriends($dids: [String!]!) {
611
+ }`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeRemoveFriends($dids: [String!]!) {
612
612
  runtimeRemoveFriends(dids: $dids)
613
- }`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await V(this,G,"f").query({query:T`query runtimeFriends {
613
+ }`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await Q(this,W,"f").query({query:I`query runtimeFriends {
614
614
  runtimeFriends
615
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await V(this,G,"f").query({query:T`query runtimeHcAgentInfos {
615
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await Q(this,W,"f").query({query:I`query runtimeHcAgentInfos {
616
616
  runtimeHcAgentInfos
617
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await V(this,G,"f").query({query:T`query runtimeGetNetworkMetrics {
617
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await Q(this,W,"f").query({query:I`query runtimeGetNetworkMetrics {
618
618
  runtimeGetNetworkMetrics
619
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeRestartHolochain {
619
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeRestartHolochain {
620
620
  runtimeRestartHolochain
621
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
621
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
622
622
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
623
- }`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await V(this,G,"f").mutate({mutation:T`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
623
+ }`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await Q(this,W,"f").mutate({mutation:I`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
624
624
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
625
- }`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeSetStatus($status: PerspectiveInput!) {
625
+ }`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeSetStatus($status: PerspectiveInput!) {
626
626
  runtimeSetStatus(status: $status)
627
- }`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await V(this,G,"f").query({query:T`query runtimeFriendStatus($did: String!) {
627
+ }`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await Q(this,W,"f").query({query:I`query runtimeFriendStatus($did: String!) {
628
628
  runtimeFriendStatus(did: $did) { ${Vo} }
629
- }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
629
+ }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
630
630
  runtimeFriendSendMessage(did: $did, message: $message)
631
- }`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await V(this,G,"f").query({query:T`query runtimeMessageInbox($filter: String) {
631
+ }`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await Q(this,W,"f").query({query:I`query runtimeMessageInbox($filter: String) {
632
632
  runtimeMessageInbox(filter: $filter) { ${Vo} }
633
- }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await V(this,G,"f").query({query:T`query runtimeMessageOutbox($filter: String) {
633
+ }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await Q(this,W,"f").query({query:I`query runtimeMessageOutbox($filter: String) {
634
634
  runtimeMessageOutbox(filter: $filter) {
635
635
  recipient,
636
636
  message {
637
637
  ${Vo}
638
638
  }
639
639
  }
640
- }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
640
+ }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
641
641
  runtimeRequestInstallNotification(notification: $notification)
642
- }`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeGrantNotification($id: String!) {
642
+ }`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeGrantNotification($id: String!) {
643
643
  runtimeGrantNotification(id: $id)
644
- }`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeExportDb($filePath: String!) {
644
+ }`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeExportDb($filePath: String!) {
645
645
  runtimeExportDb(filePath: $filePath)
646
- }`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeImportDb($filePath: String!) {
646
+ }`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeImportDb($filePath: String!) {
647
647
  runtimeImportDb(filePath: $filePath) {
648
648
  perspectives { total imported failed omitted errors }
649
649
  links { total imported failed omitted errors }
@@ -657,51 +657,51 @@ triggerMatch
657
657
  trustedAgents { total imported failed omitted errors }
658
658
  knownLinkLanguages { total imported failed omitted errors }
659
659
  }
660
- }`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=k(await V(this,G,"f").query({query:T`query runtimeNotifications {
660
+ }`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=k(await Q(this,W,"f").query({query:I`query runtimeNotifications {
661
661
  runtimeNotifications { ${Bd} }
662
- }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
662
+ }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
663
663
  runtimeUpdateNotification(id: $id, notification: $notification)
664
- }`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeRemoveNotification($id: String!) {
664
+ }`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeRemoveNotification($id: String!) {
665
665
  runtimeRemoveNotification(id: $id)
666
- }`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
666
+ }`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
667
667
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
668
- }`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeImportPerspective($filePath: String!) {
668
+ }`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeImportPerspective($filePath: String!) {
669
669
  runtimeImportPerspective(filePath: $filePath)
670
- }`,variables:{filePath:e}}));return r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await V(this,G,"f").query({query:T`query runtimeMultiUserEnabled {
670
+ }`,variables:{filePath:e}}));return r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await Q(this,W,"f").query({query:I`query runtimeMultiUserEnabled {
671
671
  runtimeMultiUserEnabled
672
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
672
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
673
673
  runtimeSetMultiUserEnabled(enabled: $enabled)
674
- }`,variables:{enabled:e}}));return r}async listUsers(){let{runtimeListUsers:e}=k(await V(this,G,"f").query({query:T`query runtimeListUsers {
674
+ }`,variables:{enabled:e}}));return r}async listUsers(){let{runtimeListUsers:e}=k(await Q(this,W,"f").query({query:I`query runtimeListUsers {
675
675
  runtimeListUsers {
676
676
  email
677
677
  did
678
678
  lastSeen
679
679
  perspectiveCount
680
680
  }
681
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeEmailTestModeEnable {
681
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestModeEnable {
682
682
  runtimeEmailTestModeEnable
683
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeEmailTestModeDisable {
683
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestModeDisable {
684
684
  runtimeEmailTestModeDisable
685
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:r}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeEmailTestGetCode($email: String!) {
685
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:r}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestGetCode($email: String!) {
686
686
  runtimeEmailTestGetCode(email: $email)
687
- }`,variables:{email:e}}));return r}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeEmailTestClearCodes {
687
+ }`,variables:{email:e}}));return r}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestClearCodes {
688
688
  runtimeEmailTestClearCodes
689
- }`}));return e}async emailTestSetExpiry(e,r,n){let{runtimeEmailTestSetExpiry:i}=k(await V(this,G,"f").mutate({mutation:T`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
689
+ }`}));return e}async emailTestSetExpiry(e,r,n){let{runtimeEmailTestSetExpiry:i}=k(await Q(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
690
690
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
691
- }`,variables:{email:e,verificationType:r,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){V(this,va,"f").push(e)}subscribeNotificationTriggered(){V(this,G,"f").subscribe({query:T` subscription {
691
+ }`,variables:{email:e,verificationType:r,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){Q(this,ba,"f").push(e)}subscribeNotificationTriggered(){Q(this,W,"f").subscribe({query:I` subscription {
692
692
  runtimeNotificationTriggered { ${Ng} }
693
693
  }
694
- `}).subscribe({next:e=>{V(this,va,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){V(this,ya,"f").push(e)}subscribeMessageReceived(){V(this,G,"f").subscribe({query:T` subscription {
694
+ `}).subscribe({next:e=>{Q(this,ba,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){Q(this,ga,"f").push(e)}subscribeMessageReceived(){Q(this,W,"f").subscribe({query:I` subscription {
695
695
  runtimeMessageReceived { ${Vo} }
696
696
  }
697
- `}).subscribe({next:e=>{V(this,ya,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){V(this,ga,"f").push(e)}subscribeExceptionOccurred(){V(this,G,"f").subscribe({query:T` subscription {
697
+ `}).subscribe({next:e=>{Q(this,ga,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){Q(this,va,"f").push(e)}subscribeExceptionOccurred(){Q(this,W,"f").subscribe({query:I` subscription {
698
698
  exceptionOccurred {
699
699
  title
700
700
  message
701
701
  type
702
702
  addon
703
703
  }
704
- }`}).subscribe({next:e=>{V(this,ga,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};G=new WeakMap,ya=new WeakMap,ga=new WeakMap,va=new WeakMap,qd=new WeakMap;var Cg=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},mr,Pu=class{constructor(e){mr.set(this,void 0),Cg(this,mr,e,"f")}async get(e,r=!1){if(!r)try{let i=Ze.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}=k(await fi(this,mr,"f").query({query:T`query expression($url: String!) {
704
+ }`}).subscribe({next:e=>{Q(this,va,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};W=new WeakMap,ga=new WeakMap,va=new WeakMap,ba=new WeakMap,qd=new WeakMap;var Cg=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},mr,Pu=class{constructor(e){mr.set(this,void 0),Cg(this,mr,e,"f")}async get(e,r=!1){if(!r)try{let i=Ze.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}=k(await fi(this,mr,"f").query({query:I`query expression($url: String!) {
705
705
  expression(url: $url) {
706
706
  author
707
707
  timestamp
@@ -714,7 +714,7 @@ triggerMatch
714
714
  invalid
715
715
  }
716
716
  }
717
- }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=k(await fi(this,mr,"f").query({query:T`query expressionMany($urls: [String!]!) {
717
+ }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=k(await fi(this,mr,"f").query({query:I`query expressionMany($urls: [String!]!) {
718
718
  expressionMany(urls: $urls) {
719
719
  author
720
720
  timestamp
@@ -727,19 +727,19 @@ triggerMatch
727
727
  invalid
728
728
  }
729
729
  }
730
- }`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await fi(this,mr,"f").query({query:T`query expressionRaw($url: String!) {
730
+ }`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await fi(this,mr,"f").query({query:I`query expressionRaw($url: String!) {
731
731
  expressionRaw(url: $url)
732
- }`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await fi(this,mr,"f").mutate({mutation:T`mutation expressionCreate($content: String!, $languageAddress: String!){
732
+ }`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await fi(this,mr,"f").mutate({mutation:I`mutation expressionCreate($content: String!, $languageAddress: String!){
733
733
  expressionCreate(content: $content, languageAddress: $languageAddress)
734
- }`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await fi(this,mr,"f").query({query:T`query expressionInteractions($url: String!) {
734
+ }`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await fi(this,mr,"f").query({query:I`query expressionInteractions($url: String!) {
735
735
  expressionInteractions(url: $url) {
736
736
  label
737
737
  name
738
738
  parameters { name, type }
739
739
  }
740
- }`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await fi(this,mr,"f").mutate({mutation:T`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
740
+ }`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await fi(this,mr,"f").mutate({mutation:I`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
741
741
  expressionInteract(url: $url, interactionCall: $interactionCall)
742
- }`,variables:{url:e,interactionCall:r}}));return n}};mr=new WeakMap;var js={};js.byteLength=Pg;js.toByteArray=Fg;js.fromByteArray=jg;var Zt=[],Dt=[],Rg=typeof Uint8Array<"u"?Uint8Array:Array,su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ln=0,xp=su.length;ln<xp;++ln)Zt[ln]=su[ln],Dt[su.charCodeAt(ln)]=ln;var ln,xp;Dt["-".charCodeAt(0)]=62;Dt["_".charCodeAt(0)]=63;function Vd(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Pg(t){var e=Vd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Lg(t,e,r){return(e+r)*3/4-r}function Fg(t){var e,r=Vd(t),n=r[0],i=r[1],a=new Rg(Lg(t,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Dt[t.charCodeAt(c)]<<18|Dt[t.charCodeAt(c+1)]<<12|Dt[t.charCodeAt(c+2)]<<6|Dt[t.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Dt[t.charCodeAt(c)]<<2|Dt[t.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Dt[t.charCodeAt(c)]<<10|Dt[t.charCodeAt(c+1)]<<4|Dt[t.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function $g(t){return Zt[t>>18&63]+Zt[t>>12&63]+Zt[t>>6&63]+Zt[t&63]}function Mg(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push($g(n));return i.join("")}function jg(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(Mg(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var Ug=4,Tp=0,Ip=1,qg=2;function Ci(t){let e=t.length;for(;--e>=0;)t[e]=0}var Bg=0,Qd=1,Vg=2,Qg=3,zg=258,el=29,Qa=256,Ca=Qa+1+el,_i=30,tl=19,zd=2*Ca+1,Sn=15,cu=16,Wg=7,rl=256,Wd=16,Gd=17,Kd=18,Lu=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]),ss=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]),Gg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kg=512,yr=new Array((Ca+2)*2);Ci(yr);var Ta=new Array(_i*2);Ci(Ta);var Ra=new Array(Kg);Ci(Ra);var Pa=new Array(zg-Qg+1);Ci(Pa);var nl=new Array(el);Ci(nl);var ks=new Array(_i);Ci(ks);function uu(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Jd,Yd,Zd;function lu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var Xd=t=>t<256?Ra[t]:Ra[256+(t>>>7)],La=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},mt=(t,e,r)=>{t.bi_valid>cu-r?(t.bi_buf|=e<<t.bi_valid&65535,La(t,t.bi_buf),t.bi_buf=e>>cu-t.bi_valid,t.bi_valid+=r-cu):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Xt=(t,e,r)=>{mt(t,r[e*2],r[e*2+1])},eh=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},Hg=t=>{t.bi_valid===16?(La(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Jg=(t,e)=>{let r=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<=Sn;p++)t.bl_count[p]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<zd;u++)l=t.heap[u],p=r[r[l*2+1]*2+1]+1,p>c&&(p=c,m++),r[l*2+1]=p,!(l>n)&&(t.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=r[l*2],t.opt_len+=h*(p+f),a&&(t.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(p=c-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(l=t.bl_count[p];l!==0;)d=t.heap[--u],!(d>n)&&(r[d*2+1]!==p&&(t.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),l--)}},th=(t,e,r)=>{let n=new Array(Sn+1),i=0,a,o;for(a=1;a<=Sn;a++)i=i+r[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=eh(n[s]++,s))}},Yg=()=>{let t,e,r,n,i,a=new Array(Sn+1);for(r=0,n=0;n<el-1;n++)for(nl[n]=r,t=0;t<1<<Lu[n];t++)Pa[r++]=n;for(Pa[r-1]=n,i=0,n=0;n<16;n++)for(ks[n]=i,t=0;t<1<<ss[n];t++)Ra[i++]=n;for(i>>=7;n<_i;n++)for(ks[n]=i<<7,t=0;t<1<<ss[n]-7;t++)Ra[256+i++]=n;for(e=0;e<=Sn;e++)a[e]=0;for(t=0;t<=143;)yr[t*2+1]=8,t++,a[8]++;for(;t<=255;)yr[t*2+1]=9,t++,a[9]++;for(;t<=279;)yr[t*2+1]=7,t++,a[7]++;for(;t<=287;)yr[t*2+1]=8,t++,a[8]++;for(th(yr,Ca+1,a),t=0;t<_i;t++)Ta[t*2+1]=5,Ta[t*2]=eh(t,5);Jd=new uu(yr,Lu,Qa+1,Ca,Sn),Yd=new uu(Ta,ss,0,_i,Sn),Zd=new uu(new Array(0),Gg,0,tl,Wg)},rh=t=>{let e;for(e=0;e<Ca;e++)t.dyn_ltree[e*2]=0;for(e=0;e<_i;e++)t.dyn_dtree[e*2]=0;for(e=0;e<tl;e++)t.bl_tree[e*2]=0;t.dyn_ltree[rl*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},nh=t=>{t.bi_valid>8?La(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},kp=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},fu=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&kp(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!kp(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Ap=(t,e,r)=>{let n,i,a=0,o,s;if(t.sym_next!==0)do n=t.pending_buf[t.sym_buf+a++]&255,n+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],n===0?Xt(t,i,e):(o=Pa[i],Xt(t,o+Qa+1,e),s=Lu[o],s!==0&&(i-=nl[o],mt(t,i,s)),n--,o=Xd(n),Xt(t,o,r),s=ss[o],s!==0&&(n-=ks[o],mt(t,n,s)));while(a<t.sym_next);Xt(t,rl,e)},Fu=(t,e)=>{let r=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(t.heap_len=0,t.heap_max=zd,o=0;o<a;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=n[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)fu(t,r,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],fu(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[u*2]=r[o*2]+r[s*2],t.depth[u]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[o*2+1]=r[s*2+1]=u,t.heap[1]=u++,fu(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Jg(t,e),th(r,c,t.bl_count)},Op=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[Wd*2]++):s<=10?t.bl_tree[Gd*2]++:t.bl_tree[Kd*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Dp=(t,e,r)=>{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<=r;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do Xt(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(t,a,t.bl_tree),s--),Xt(t,Wd,t.bl_tree),mt(t,s-3,2)):s<=10?(Xt(t,Gd,t.bl_tree),mt(t,s-3,3)):(Xt(t,Kd,t.bl_tree),mt(t,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Zg=t=>{let e;for(Op(t,t.dyn_ltree,t.l_desc.max_code),Op(t,t.dyn_dtree,t.d_desc.max_code),Fu(t,t.bl_desc),e=tl-1;e>=3&&t.bl_tree[Hd[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Xg=(t,e,r,n)=>{let i;for(mt(t,e-257,5),mt(t,r-1,5),mt(t,n-4,4),i=0;i<n;i++)mt(t,t.bl_tree[Hd[i]*2+1],3);Dp(t,t.dyn_ltree,e-1),Dp(t,t.dyn_dtree,r-1)},ev=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Tp;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Ip;for(r=32;r<Qa;r++)if(t.dyn_ltree[r*2]!==0)return Ip;return Tp},Np=!1,tv=t=>{Np||(Yg(),Np=!0),t.l_desc=new lu(t.dyn_ltree,Jd),t.d_desc=new lu(t.dyn_dtree,Yd),t.bl_desc=new lu(t.bl_tree,Zd),t.bi_buf=0,t.bi_valid=0,rh(t)},ih=(t,e,r,n)=>{mt(t,(Bg<<1)+(n?1:0),3),nh(t),La(t,r),La(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},rv=t=>{mt(t,Qd<<1,3),Xt(t,rl,yr),Hg(t)},nv=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===qg&&(t.strm.data_type=ev(t)),Fu(t,t.l_desc),Fu(t,t.d_desc),o=Zg(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?ih(t,e,r,n):t.strategy===Ug||a===i?(mt(t,(Qd<<1)+(n?1:0),3),Ap(t,yr,Ta)):(mt(t,(Vg<<1)+(n?1:0),3),Xg(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Ap(t,t.dyn_ltree,t.dyn_dtree)),rh(t),n&&nh(t)},iv=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Pa[r]+Qa+1)*2]++,t.dyn_dtree[Xd(e)*2]++),t.sym_next===t.sym_end),av=tv,ov=ih,sv=nv,cv=iv,uv=rv,lv={_tr_init:av,_tr_stored_block:ov,_tr_flush_block:sv,_tr_tally:cv,_tr_align:uv},fv=(t,e,r,n)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},Fa=fv,pv=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},dv=new Uint32Array(pv()),hv=(t,e,r,n)=>{let i=dv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Ve=hv,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"},qn={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:mv,_tr_stored_block:$u,_tr_flush_block:yv,_tr_tally:qr,_tr_align:gv}=lv,{Z_NO_FLUSH:Br,Z_PARTIAL_FLUSH:vv,Z_FULL_FLUSH:bv,Z_FINISH:Ct,Z_BLOCK:Cp,Z_OK:Je,Z_STREAM_END:Rp,Z_STREAM_ERROR:tr,Z_DATA_ERROR:_v,Z_BUF_ERROR:pu,Z_DEFAULT_COMPRESSION:Sv,Z_FILTERED:wv,Z_HUFFMAN_ONLY:Qo,Z_RLE:Ev,Z_FIXED:xv,Z_DEFAULT_STRATEGY:Tv,Z_UNKNOWN:Iv,Z_DEFLATED:Us}=qn,kv=9,Av=15,Ov=8,Dv=29,Nv=256,Mu=Nv+1+Dv,Cv=30,Rv=19,Pv=2*Mu+1,Lv=15,ne=3,$r=258,rr=$r+ne+1,Fv=32,xi=42,il=57,ju=69,Uu=73,qu=91,Bu=103,wn=113,ba=666,ct=1,Ri=2,Rn=3,Pi=4,$v=3,En=(t,e)=>(t.msg=Cn[e],e),Pp=t=>t*2-(t>4?9:0),Fr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Mv=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do r=t.head[--n],t.head[n]=r>=i?r-i:0;while(--e);e=i,n=e;do r=t.prev[--n],t.prev[n]=r>=i?r-i:0;while(--e)},jv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Vr=jv,bt=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},St=(t,e)=>{yv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bt(t.strm)},pe=(t,e)=>{t.pending_buf[t.pending++]=e},ia=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Vu=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),t.state.wrap===1?t.adler=Fa(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ve(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},ah=(t,e)=>{let r=t.max_chain_length,n=t.strstart,i,a,o=t.prev_length,s=t.nice_match,c=t.strstart>t.w_size-rr?t.strstart-(t.w_size-rr):0,u=t.window,l=t.w_mask,d=t.prev,p=t.strstart+$r,f=u[n+o-1],h=u[n+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.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=$r-(p-n),n=p-$r,a>o){if(t.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--r!==0);return o<=t.lookahead?o:t.lookahead},Ti=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-rr)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Mv(t),n+=e),t.strm.avail_in===0)break;if(r=Vu(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=ne)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Vr(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Vr(t,t.ins_h,t.window[i+ne-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<ne)););}while(t.lookahead<rr&&t.strm.avail_in!==0)},oh=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n,i,a,o=0,s=t.strm.avail_in;do{if(n=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>a&&(n=a),n<r&&(n===0&&e!==Ct||e===Br||n!==i+t.strm.avail_in)))break;o=e===Ct&&n===i+t.strm.avail_in?1:0,$u(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,bt(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vu(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?Pi:e!==Br&&e!==Ct&&t.strm.avail_in===0&&t.strstart===t.block_start?Ri:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Vu(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,r=a>t.w_size?t.w_size:a,i=t.strstart-t.block_start,(i>=r||(i||e===Ct)&&e!==Br&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Ct&&t.strm.avail_in===0&&n===i?1:0,$u(t,t.block_start,n,o),t.block_start+=n,bt(t.strm)),o?Rn:ct)},du=(t,e)=>{let r,n;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ne&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ne-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r)),t.match_length>=ne)if(n=qr(t,t.strstart-t.match_start,t.match_length-ne),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ne){t.match_length--;do t.strstart++,t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ne-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+1]);else n=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=t.strstart<ne-1?t.strstart:ne-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},pi=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ne&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ne-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ne-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r),t.match_length<=5&&(t.strategy===wv||t.match_length===ne&&t.strstart-t.match_start>4096)&&(t.match_length=ne-1)),t.prev_length>=ne&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ne,n=qr(t,t.strstart-1-t.prev_match,t.prev_length-ne),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ne-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ne-1,t.strstart++,n&&(St(t,!1),t.strm.avail_out===0))return ct}else if(t.match_available){if(n=qr(t,0,t.window[t.strstart-1]),n&&St(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return ct}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=qr(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ne-1?t.strstart:ne-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},Uv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=$r){if(Ti(t),t.lookahead<=$r&&e===Br)return ct;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ne&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+$r;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);t.match_length=$r-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ne?(r=qr(t,1,t.match_length-ne),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},qv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Ti(t),t.lookahead===0)){if(e===Br)return ct;break}if(t.match_length=0,r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri};function Kt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var _a=[new Kt(0,0,0,0,oh),new Kt(4,4,8,4,du),new Kt(4,5,16,8,du),new Kt(4,6,32,32,du),new Kt(4,4,16,16,pi),new Kt(8,16,32,32,pi),new Kt(8,16,128,128,pi),new Kt(8,32,128,256,pi),new Kt(32,128,258,1024,pi),new Kt(32,258,258,4096,pi)],Bv=t=>{t.window_size=2*t.w_size,Fr(t.head),t.max_lazy_match=_a[t.level].max_lazy,t.good_match=_a[t.level].good_length,t.nice_match=_a[t.level].nice_length,t.max_chain_length=_a[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ne-1,t.match_available=0,t.ins_h=0};function Vv(){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=Us,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(Pv*2),this.dyn_dtree=new Uint16Array((2*Cv+1)*2),this.bl_tree=new Uint16Array((2*Rv+1)*2),Fr(this.dyn_ltree),Fr(this.dyn_dtree),Fr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Lv+1),this.heap=new Uint16Array(2*Mu+1),Fr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Mu+1),Fr(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 za=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==xi&&e.status!==il&&e.status!==ju&&e.status!==Uu&&e.status!==qu&&e.status!==Bu&&e.status!==wn&&e.status!==ba?1:0},sh=t=>{if(za(t))return En(t,tr);t.total_in=t.total_out=0,t.data_type=Iv;let e=t.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:wn,t.adler=e.wrap===2?0:1,e.last_flush=-2,mv(e),Je},ch=t=>{let e=sh(t);return e===Je&&Bv(t.state),e},Qv=(t,e)=>za(t)||t.state.wrap!==2?tr:(t.state.gzhead=e,Je),uh=(t,e,r,n,i,a)=>{if(!t)return tr;let o=1;if(e===Sv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>kv||r!==Us||n<8||n>15||e<0||e>9||a<0||a>xv||n===8&&o!==1)return En(t,tr);n===8&&(n=9);let s=new Vv;return t.state=s,s.strm=t,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+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=r,ch(t)},zv=(t,e)=>uh(t,e,Us,Av,Ov,Tv),Wv=(t,e)=>{if(za(t)||e>Cp||e<0)return t?En(t,tr):tr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===ba&&e!==Ct)return En(t,t.avail_out===0?pu:tr);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(bt(t),t.avail_out===0)return r.last_flush=-1,Je}else if(t.avail_in===0&&Pp(e)<=Pp(n)&&e!==Ct)return En(t,pu);if(r.status===ba&&t.avail_in!==0)return En(t,pu);if(r.status===xi&&r.wrap===0&&(r.status=wn),r.status===xi){let i=Us+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Qo||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Fv),i+=31-i%31,ia(r,i),r.strstart!==0&&(ia(r,t.adler>>>16),ia(r,t.adler&65535)),t.adler=1,r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===il){if(t.adler=0,pe(r,31),pe(r,139),pe(r,8),r.gzhead)pe(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),pe(r,r.gzhead.time&255),pe(r,r.gzhead.time>>8&255),pe(r,r.gzhead.time>>16&255),pe(r,r.gzhead.time>>24&255),pe(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),pe(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(pe(r,r.gzhead.extra.length&255),pe(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ve(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=ju;else if(pe(r,0),pe(r,0),pe(r,0),pe(r,0),pe(r,0),pe(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),pe(r,$v),r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===ju){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let s=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0,a-=s}let o=new Uint8Array(r.gzhead.extra);r.pending_buf.set(o.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Uu}if(r.status===Uu){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,pe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=qu}if(r.status===qu){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,pe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i))}r.status=Bu}if(r.status===Bu){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(bt(t),r.pending!==0))return r.last_flush=-1,Je;pe(r,t.adler&255),pe(r,t.adler>>8&255),t.adler=0}if(r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(t.avail_in!==0||r.lookahead!==0||e!==Br&&r.status!==ba){let i=r.level===0?oh(r,e):r.strategy===Qo?qv(r,e):r.strategy===Ev?Uv(r,e):_a[r.level].func(r,e);if((i===Rn||i===Pi)&&(r.status=ba),i===ct||i===Rn)return t.avail_out===0&&(r.last_flush=-1),Je;if(i===Ri&&(e===vv?gv(r):e!==Cp&&($u(r,0,0,!1),e===bv&&(Fr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),bt(t),t.avail_out===0))return r.last_flush=-1,Je}return e!==Ct?Je:r.wrap<=0?Rp:(r.wrap===2?(pe(r,t.adler&255),pe(r,t.adler>>8&255),pe(r,t.adler>>16&255),pe(r,t.adler>>24&255),pe(r,t.total_in&255),pe(r,t.total_in>>8&255),pe(r,t.total_in>>16&255),pe(r,t.total_in>>24&255)):(ia(r,t.adler>>>16),ia(r,t.adler&65535)),bt(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Je:Rp)},Gv=t=>{if(za(t))return tr;let e=t.state.status;return t.state=null,e===wn?En(t,_v):Je},Kv=(t,e)=>{let r=e.length;if(za(t))return tr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==xi||n.lookahead)return tr;if(i===1&&(t.adler=Fa(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Fr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(r-n.w_size,r),0),e=c,r=n.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Ti(n);n.lookahead>=ne;){let c=n.strstart,u=n.lookahead-(ne-1);do n.ins_h=Vr(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,Ti(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,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,Je},Hv=zv,Jv=uh,Yv=ch,Zv=sh,Xv=Qv,eb=Wv,tb=Gv,rb=Kv,nb="pako deflate (from Nodeca project)",Ia={deflateInit:Hv,deflateInit2:Jv,deflateReset:Yv,deflateResetKeep:Zv,deflateSetHeader:Xv,deflate:eb,deflateEnd:tb,deflateSetDictionary:rb,deflateInfo:nb},ib=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ab=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)ib(r,n)&&(t[n]=r[n])}}return t},ob=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;let r=new Uint8Array(e);for(let n=0,i=0,a=t.length;n<a;n++){let o=t[n];r.set(o,i),i+=o.length}return r},qs={assign:ab,flattenChunks:ob},lh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){lh=!1}var $a=new Uint8Array(256);for(let t=0;t<256;t++)$a[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;$a[254]=$a[254]=1;var sb=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,n,i,a,o=t.length,s=0;for(i=0;i<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e},cb=(t,e)=>{if(e<65534&&t.subarray&&lh)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r},ub=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let n,i,a=new Array(r*2);for(i=0,n=0;n<r;){let o=t[n++];if(o<128){a[i++]=o;continue}let s=$a[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<r;)o=o<<6|t[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 cb(a,i)},lb=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+$a[t[r]]>e?r:e},Ma={string2buf:sb,buf2string:ub,utf8border:lb};function fb(){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 fh=fb,ph=Object.prototype.toString,{Z_NO_FLUSH:pb,Z_SYNC_FLUSH:db,Z_FULL_FLUSH:hb,Z_FINISH:mb,Z_OK:As,Z_STREAM_END:yb,Z_DEFAULT_COMPRESSION:gb,Z_DEFAULT_STRATEGY:vb,Z_DEFLATED:bb}=qn;function Wa(t){this.options=qs.assign({level:gb,method:bb,chunkSize:16384,windowBits:15,memLevel:8,strategy:vb},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=Ia.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==As)throw new Error(Cn[r]);if(e.header&&Ia.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=Ma.string2buf(e.dictionary):ph.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Ia.deflateSetDictionary(this.strm,n),r!==As)throw new Error(Cn[r]);this._dict_set=!0}}Wa.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?mb:pb,typeof t=="string"?r.input=Ma.string2buf(t):ph.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===db||a===hb)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=Ia.deflate(r,a),i===yb)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Ia.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===As;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};Wa.prototype.onData=function(t){this.chunks.push(t)};Wa.prototype.onEnd=function(t){t===As&&(this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function al(t,e){let r=new Wa(e);if(r.push(t,!0),r.err)throw r.msg||Cn[r.err];return r.result}function _b(t,e){return e=e||{},e.raw=!0,al(t,e)}function Sb(t,e){return e=e||{},e.gzip=!0,al(t,e)}var wb=Wa,Eb=al,xb=_b,Tb=Sb,Ib=qn,kb={Deflate:wb,deflate:Eb,deflateRaw:xb,gzip:Tb,constants:Ib},zo=16209,Ab=16191,Ob=function t(e,r){let n,i,a,o,s,c,u,l,d,p,f,h,m,g,w,b,S,_,A,R,I,C,F,L,M=e.state;n=e.next_in,F=e.input,i=n+(e.avail_in-5),a=e.next_out,L=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,d=M.wnext,p=M.window,f=M.hold,h=M.bits,m=M.lencode,g=M.distcode,w=(1<<M.lenbits)-1,b=(1<<M.distbits)-1;e:do{h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=m[f&w];t:for(;;){if(_=S>>>24,f>>>=_,h-=_,_=S>>>16&255,_===0)L[a++]=S&65535;else if(_&16){A=S&65535,_&=15,_&&(h<_&&(f+=F[n++]<<h,h+=8),A+=f&(1<<_)-1,f>>>=_,h-=_),h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=g[f&b];r:for(;;){if(_=S>>>24,f>>>=_,h-=_,_=S>>>16&255,_&16){if(R=S&65535,_&=15,h<_&&(f+=F[n++]<<h,h+=8,h<_&&(f+=F[n++]<<h,h+=8)),R+=f&(1<<_)-1,R>c){e.msg="invalid distance too far back",M.mode=zo;break e}if(f>>>=_,h-=_,_=a-o,R>_){if(_=R-_,_>l&&M.sane){e.msg="invalid distance too far back",M.mode=zo;break e}if(I=0,C=p,d===0){if(I+=u-_,_<A){A-=_;do L[a++]=p[I++];while(--_);I=a-R,C=L}}else if(d<_){if(I+=u+d-_,_-=d,_<A){A-=_;do L[a++]=p[I++];while(--_);if(I=0,d<A){_=d,A-=_;do L[a++]=p[I++];while(--_);I=a-R,C=L}}}else if(I+=d-_,_<A){A-=_;do L[a++]=p[I++];while(--_);I=a-R,C=L}for(;A>2;)L[a++]=C[I++],L[a++]=C[I++],L[a++]=C[I++],A-=3;A&&(L[a++]=C[I++],A>1&&(L[a++]=C[I++]))}else{I=a-R;do L[a++]=L[I++],L[a++]=L[I++],L[a++]=L[I++],A-=3;while(A>2);A&&(L[a++]=L[I++],A>1&&(L[a++]=L[I++]))}}else if((_&64)===0){S=g[(S&65535)+(f&(1<<_)-1)];continue r}else{e.msg="invalid distance code",M.mode=zo;break e}break}}else if((_&64)===0){S=m[(S&65535)+(f&(1<<_)-1)];continue t}else if(_&32){M.mode=Ab;break e}else{e.msg="invalid literal/length code",M.mode=zo;break e}break}}while(n<i&&a<s);A=h>>3,n-=A,h-=A<<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),M.hold=f,M.bits=h},di=15,Lp=852,Fp=592,$p=0,hu=1,Mp=2,Db=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]),Nb=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]),Cb=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]),Rb=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]),Pb=(t,e,r,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,w=0,b=0,S,_,A,R,I,C=null,F,L=new Uint16Array(di+1),M=new Uint16Array(di+1),le=null,Le,z,ge;for(u=0;u<=di;u++)L[u]=0;for(l=0;l<n;l++)L[e[r+l]]++;for(f=c,p=di;p>=1&&L[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&&L[d]===0;d++);for(f<d&&(f=d),g=1,u=1;u<=di;u++)if(g<<=1,g-=L[u],g<0)return-1;if(g>0&&(t===$p||p!==1))return-1;for(M[1]=0,u=1;u<di;u++)M[u+1]=M[u]+L[u];for(l=0;l<n;l++)e[r+l]!==0&&(o[M[e[r+l]]++]=l);if(t===$p?(C=le=o,F=20):t===hu?(C=Db,le=Nb,F=257):(C=Cb,le=Rb,F=0),b=0,l=0,u=d,I=a,h=f,m=0,A=-1,w=1<<f,R=w-1,t===hu&&w>Lp||t===Mp&&w>Fp)return 1;for(;;){Le=u-m,o[l]+1<F?(z=0,ge=o[l]):o[l]>=F?(z=le[o[l]-F],ge=C[o[l]-F]):(z=32+64,ge=0),S=1<<u-m,_=1<<h,d=_;do _-=S,i[I+(b>>m)+_]=Le<<24|z<<16|ge|0;while(_!==0);for(S=1<<u-1;b&S;)S>>=1;if(S!==0?(b&=S-1,b+=S):b=0,l++,--L[u]===0){if(u===p)break;u=e[r+o[l]]}if(u>f&&(b&R)!==A){for(m===0&&(m=f),I+=d,h=u-m,g=1<<h;h+m<p&&(g-=L[h+m],!(g<=0));)h++,g<<=1;if(w+=1<<h,t===hu&&w>Lp||t===Mp&&w>Fp)return 1;A=b&R,i[A]=f<<24|h<<16|I-a|0}}return b!==0&&(i[I+b]=u-m<<24|64<<16|0),s.bits=f,0},ka=Pb,Lb=0,dh=1,hh=2,{Z_FINISH:jp,Z_BLOCK:Fb,Z_TREES:Wo,Z_OK:Pn,Z_STREAM_END:$b,Z_NEED_DICT:Mb,Z_STREAM_ERROR:Rt,Z_DATA_ERROR:mh,Z_MEM_ERROR:yh,Z_BUF_ERROR:jb,Z_DEFLATED:Up}=qn,Bs=16180,qp=16181,Bp=16182,Vp=16183,Qp=16184,zp=16185,Wp=16186,Gp=16187,Kp=16188,Hp=16189,Os=16190,pr=16191,mu=16192,Jp=16193,yu=16194,Yp=16195,Zp=16196,Xp=16197,ed=16198,Go=16199,Ko=16200,td=16201,rd=16202,nd=16203,id=16204,ad=16205,gu=16206,od=16207,sd=16208,xe=16209,gh=16210,vh=16211,Ub=852,qb=592,Bb=15,Vb=Bb,cd=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Qb(){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 Bn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Bs||e.mode>vh?1:0},bh=t=>{if(Bn(t))return Rt;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Bs,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(Ub),e.distcode=e.distdyn=new Int32Array(qb),e.sane=1,e.back=-1,Pn},_h=t=>{if(Bn(t))return Rt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,bh(t)},Sh=(t,e)=>{let r;if(Bn(t))return Rt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Rt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,_h(t))},wh=(t,e)=>{if(!t)return Rt;let r=new Qb;t.state=r,r.strm=t,r.window=null,r.mode=Bs;let n=Sh(t,e);return n!==Pn&&(t.state=null),n},zb=t=>wh(t,Vb),ud=!0,vu,bu,Wb=t=>{if(ud){vu=new Int32Array(512),bu=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(ka(dh,t.lens,0,288,vu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;ka(hh,t.lens,0,32,bu,0,t.work,{bits:5}),ud=!1}t.lencode=vu,t.lenbits=9,t.distcode=bu,t.distbits=5},Eh=(t,e,r,n)=>{let i,a=t.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(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(r-n,r),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},Gb=(t,e)=>{let r,n,i,a,o,s,c,u,l,d,p,f,h,m,g=0,w,b,S,_,A,R,I,C,F=new Uint8Array(4),L,M,le=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Bn(t)||!t.output||!t.input&&t.avail_in!==0)return Rt;r=t.state,r.mode===pr&&(r.mode=mu),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,d=s,p=c,C=Pn;e:for(;;)switch(r.mode){case Bs:if(r.wrap===0){r.mode=mu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&2&&u===35615){r.wbits===0&&(r.wbits=15),r.check=0,F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0),u=0,l=0,r.mode=qp;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=xe;break}if((u&15)!==Up){t.msg="unknown compression method",r.mode=xe;break}if(u>>>=4,l-=4,I=(u&15)+8,r.wbits===0&&(r.wbits=I),I>15||I>r.wbits){t.msg="invalid window size",r.mode=xe;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=u&512?Hp:pr,u=0,l=0;break;case qp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.flags=u,(r.flags&255)!==Up){t.msg="unknown compression method",r.mode=xe;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=xe;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Bp;case Bp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.time=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,F[2]=u>>>16&255,F[3]=u>>>24&255,r.check=Ve(r.check,F,4,0)),u=0,l=0,r.mode=Vp;case Vp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Qp;case Qp:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=zp;case zp:if(r.flags&1024&&(f=r.length,f>s&&(f=s),f&&(r.head&&(I=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+f),I)),r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,r.length-=f),r.length))break e;r.length=0,r.mode=Wp;case Wp:if(r.flags&2048){if(s===0)break e;f=0;do I=n[a+f++],r.head&&I&&r.length<65536&&(r.head.name+=String.fromCharCode(I));while(I&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,I)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Gp;case Gp:if(r.flags&4096){if(s===0)break e;f=0;do I=n[a+f++],r.head&&I&&r.length<65536&&(r.head.comment+=String.fromCharCode(I));while(I&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,I)break e}else r.head&&(r.head.comment=null);r.mode=Kp;case Kp:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.check&65535)){t.msg="header crc mismatch",r.mode=xe;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=pr;break;case Hp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.adler=r.check=cd(u),u=0,l=0,r.mode=Os;case Os:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Mb;t.adler=r.check=1,r.mode=pr;case pr:if(e===Fb||e===Wo)break e;case mu:if(r.last){u>>>=l&7,l-=l&7,r.mode=gu;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(r.last=u&1,u>>>=1,l-=1,u&3){case 0:r.mode=Jp;break;case 1:if(Wb(r),r.mode=Go,e===Wo){u>>>=2,l-=2;break e}break;case 2:r.mode=Zp;break;case 3:t.msg="invalid block type",r.mode=xe}u>>>=2,l-=2;break;case Jp: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)){t.msg="invalid stored block lengths",r.mode=xe;break}if(r.length=u&65535,u=0,l=0,r.mode=yu,e===Wo)break e;case yu:r.mode=Yp;case Yp:if(f=r.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,r.length-=f;break}r.mode=pr;break;case Zp:for(;l<14;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.nlen=(u&31)+257,u>>>=5,l-=5,r.ndist=(u&31)+1,u>>>=5,l-=5,r.ncode=(u&15)+4,u>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=xe;break}r.have=0,r.mode=Xp;case Xp:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.lens[le[r.have++]]=u&7,u>>>=3,l-=3}for(;r.have<19;)r.lens[le[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,L={bits:r.lenbits},C=ka(Lb,r.lens,0,19,r.lencode,0,r.work,L),r.lenbits=L.bits,C){t.msg="invalid code lengths set",r.mode=xe;break}r.have=0,r.mode=ed;case ed:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[u&(1<<r.lenbits)-1],w=g>>>24,b=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S<16)u>>>=w,l-=w,r.lens[r.have++]=S;else{if(S===16){for(M=w+2;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=w,l-=w,r.have===0){t.msg="invalid bit length repeat",r.mode=xe;break}I=r.lens[r.have-1],f=3+(u&3),u>>>=2,l-=2}else if(S===17){for(M=w+3;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=w,l-=w,I=0,f=3+(u&7),u>>>=3,l-=3}else{for(M=w+7;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=w,l-=w,I=0,f=11+(u&127),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=xe;break}for(;f--;)r.lens[r.have++]=I}}if(r.mode===xe)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=xe;break}if(r.lenbits=9,L={bits:r.lenbits},C=ka(dh,r.lens,0,r.nlen,r.lencode,0,r.work,L),r.lenbits=L.bits,C){t.msg="invalid literal/lengths set",r.mode=xe;break}if(r.distbits=6,r.distcode=r.distdyn,L={bits:r.distbits},C=ka(hh,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,L),r.distbits=L.bits,C){t.msg="invalid distances set",r.mode=xe;break}if(r.mode=Go,e===Wo)break e;case Go:r.mode=Ko;case Ko:if(s>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Ob(t,p),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,r.mode===pr&&(r.back=-1);break}for(r.back=0;g=r.lencode[u&(1<<r.lenbits)-1],w=g>>>24,b=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(b&&(b&240)===0){for(_=w,A=b,R=S;g=r.lencode[R+((u&(1<<_+A)-1)>>_)],w=g>>>24,b=g>>>16&255,S=g&65535,!(_+w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,r.back+=_}if(u>>>=w,l-=w,r.back+=w,r.length=S,b===0){r.mode=ad;break}if(b&32){r.back=-1,r.mode=pr;break}if(b&64){t.msg="invalid literal/length code",r.mode=xe;break}r.extra=b&15,r.mode=td;case td:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=rd;case rd:for(;g=r.distcode[u&(1<<r.distbits)-1],w=g>>>24,b=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((b&240)===0){for(_=w,A=b,R=S;g=r.distcode[R+((u&(1<<_+A)-1)>>_)],w=g>>>24,b=g>>>16&255,S=g&65535,!(_+w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,r.back+=_}if(u>>>=w,l-=w,r.back+=w,b&64){t.msg="invalid distance code",r.mode=xe;break}r.offset=S,r.extra=b&15,r.mode=nd;case nd:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=xe;break}r.mode=id;case id:if(c===0)break e;if(f=p-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=xe;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),m=r.window}else m=i,h=o-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do i[o++]=m[h++];while(--f);r.length===0&&(r.mode=Ko);break;case ad:if(c===0)break e;i[o++]=r.length,c--,r.mode=Ko;break;case gu:if(r.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(p-=c,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,o-p):Fa(r.check,i,p,o-p)),p=c,r.wrap&4&&(r.flags?u:cd(u))!==r.check){t.msg="incorrect data check",r.mode=xe;break}u=0,l=0}r.mode=od;case od:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=xe;break}u=0,l=0}r.mode=sd;case sd:C=$b;break e;case xe:C=mh;break e;case gh:return yh;case vh:default:return Rt}return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,(r.wsize||p!==t.avail_out&&r.mode<xe&&(r.mode<gu||e!==jp))&&Eh(t,t.output,t.next_out,p-t.avail_out),d-=t.avail_in,p-=t.avail_out,t.total_in+=d,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,t.next_out-p):Fa(r.check,i,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===pr?128:0)+(r.mode===Go||r.mode===yu?256:0),(d===0&&p===0||e===jp)&&C===Pn&&(C=jb),C},Kb=t=>{if(Bn(t))return Rt;let e=t.state;return e.window&&(e.window=null),t.state=null,Pn},Hb=(t,e)=>{if(Bn(t))return Rt;let r=t.state;return(r.wrap&2)===0?Rt:(r.head=e,e.done=!1,Pn)},Jb=(t,e)=>{let r=e.length,n,i,a;return Bn(t)||(n=t.state,n.wrap!==0&&n.mode!==Os)?Rt:n.mode===Os&&(i=1,i=Fa(i,e,r,0),i!==n.check)?mh:(a=Eh(t,e,r,r),a?(n.mode=gh,yh):(n.havedict=1,Pn))},Yb=_h,Zb=Sh,Xb=bh,e_=zb,t_=wh,r_=Gb,n_=Kb,i_=Hb,a_=Jb,o_="pako inflate (from Nodeca project)",gr={inflateReset:Yb,inflateReset2:Zb,inflateResetKeep:Xb,inflateInit:e_,inflateInit2:t_,inflate:r_,inflateEnd:n_,inflateGetHeader:i_,inflateSetDictionary:a_,inflateInfo:o_};function s_(){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 c_=s_,xh=Object.prototype.toString,{Z_NO_FLUSH:u_,Z_FINISH:l_,Z_OK:ja,Z_STREAM_END:_u,Z_NEED_DICT:Su,Z_STREAM_ERROR:f_,Z_DATA_ERROR:ld,Z_MEM_ERROR:p_}=qn;function Ga(t){this.options=qs.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=gr.inflateInit2(this.strm,e.windowBits);if(r!==ja)throw new Error(Cn[r]);if(this.header=new c_,gr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Ma.string2buf(e.dictionary):xh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=gr.inflateSetDictionary(this.strm,e.dictionary),r!==ja)))throw new Error(Cn[r])}Ga.prototype.push=function(t,e){let r=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?l_:u_,xh.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=gr.inflate(r,o),a===Su&&i&&(a=gr.inflateSetDictionary(r,i),a===ja?a=gr.inflate(r,o):a===ld&&(a=Su));r.avail_in>0&&a===_u&&r.state.wrap>0&&t[r.next_in]!==0;)gr.inflateReset(r),a=gr.inflate(r,o);switch(a){case f_:case ld:case Su:case p_:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===_u))if(this.options.to==="string"){let c=Ma.utf8border(r.output,r.next_out),u=r.next_out-c,l=Ma.buf2string(r.output,c);r.next_out=u,r.avail_out=n-u,u&&r.output.set(r.output.subarray(c,c+u),0),this.onData(l)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===ja&&s===0)){if(a===_u)return a=gr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Ga.prototype.onData=function(t){this.chunks.push(t)};Ga.prototype.onEnd=function(t){t===ja&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ol(t,e){let r=new Ga(e);if(r.push(t),r.err)throw r.msg||Cn[r.err];return r.result}function d_(t,e){return e=e||{},e.raw=!0,ol(t,e)}var h_=Ga,m_=ol,y_=d_,g_=ol,v_=qn,b_={Inflate:h_,inflate:m_,inflateRaw:y_,ungzip:g_,constants:v_},{Deflate:__,deflate:S_,deflateRaw:w_,gzip:E_}=kb,{Inflate:x_,inflate:T_,inflateRaw:I_,ungzip:k_}=b_,A_=__,O_=S_,D_=w_,N_=E_,C_=x_,R_=T_,P_=I_,L_=k_,F_=qn,$_={Deflate:A_,deflate:O_,deflateRaw:D_,gzip:N_,Inflate:C_,inflate:R_,inflateRaw:P_,ungzip:L_,constants:F_},be=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},_e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ds=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ds.prototype,"input",void 0);be([y(),_e("design:type",String)],Ds.prototype,"output",void 0);Ds=be([ze(),_e("design:paramtypes",[String,String])],Ds);var Ns=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ns.prototype,"input",void 0);be([y(),_e("design:type",String)],Ns.prototype,"output",void 0);Ns=be([W(),_e("design:paramtypes",[String,String])],Ns);var Gr=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};be([y(),_e("design:type",String)],Gr.prototype,"name",void 0);be([y(),_e("design:type",String)],Gr.prototype,"modelId",void 0);be([y(),_e("design:type",String)],Gr.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],Gr.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],Gr.prototype,"metaData",void 0);Gr=be([ze(),_e("design:paramtypes",[String,String,String,Array,String])],Gr);var ar=class{constructor(e,r,n,i,a,o,s,c){this.name=e,this.modelId=r,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};be([y(),_e("design:type",String)],ar.prototype,"name",void 0);be([y(),_e("design:type",String)],ar.prototype,"modelId",void 0);be([y(),_e("design:type",String)],ar.prototype,"taskId",void 0);be([y(),_e("design:type",String)],ar.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],ar.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],ar.prototype,"metaData",void 0);be([y(),_e("design:type",String)],ar.prototype,"createdAt",void 0);be([y(),_e("design:type",String)],ar.prototype,"updatedAt",void 0);ar=be([W(),_e("design:paramtypes",[String,String,String,String,Array,String,String,String])],ar);var Ln=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};be([y(),_e("design:type",String)],Ln.prototype,"model",void 0);be([y(),_e("design:type",String)],Ln.prototype,"status",void 0);be([y(),_e("design:type",Number)],Ln.prototype,"progress",void 0);be([y(),_e("design:type",Boolean)],Ln.prototype,"downloaded",void 0);be([y(),_e("design:type",Boolean)],Ln.prototype,"loaded",void 0);Ln=be([W(),_e("design:paramtypes",[String,String,Number,Boolean,Boolean])],Ln);var M_=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ue=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Me,cs,Qu=class{constructor(e,r=!0){Me.set(this,void 0),cs.set(this,new Map),M_(this,Me,e,"f")}async getModels(){let e=await Ue(this,Me,"f").query({query:T`
742
+ }`,variables:{url:e,interactionCall:r}}));return n}};mr=new WeakMap;var js={};js.byteLength=Pg;js.toByteArray=Lg;js.fromByteArray=jg;var Zt=[],Dt=[],Rg=typeof Uint8Array<"u"?Uint8Array:Array,su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ln=0,xp=su.length;ln<xp;++ln)Zt[ln]=su[ln],Dt[su.charCodeAt(ln)]=ln;var ln,xp;Dt["-".charCodeAt(0)]=62;Dt["_".charCodeAt(0)]=63;function Vd(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Pg(t){var e=Vd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Fg(t,e,r){return(e+r)*3/4-r}function Lg(t){var e,r=Vd(t),n=r[0],i=r[1],a=new Rg(Fg(t,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Dt[t.charCodeAt(c)]<<18|Dt[t.charCodeAt(c+1)]<<12|Dt[t.charCodeAt(c+2)]<<6|Dt[t.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Dt[t.charCodeAt(c)]<<2|Dt[t.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Dt[t.charCodeAt(c)]<<10|Dt[t.charCodeAt(c+1)]<<4|Dt[t.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function $g(t){return Zt[t>>18&63]+Zt[t>>12&63]+Zt[t>>6&63]+Zt[t&63]}function Mg(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push($g(n));return i.join("")}function jg(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(Mg(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var Ug=4,Tp=0,Ip=1,qg=2;function Ci(t){let e=t.length;for(;--e>=0;)t[e]=0}var Bg=0,Qd=1,Vg=2,Qg=3,zg=258,el=29,za=256,Ra=za+1+el,_i=30,tl=19,zd=2*Ra+1,Sn=15,cu=16,Gg=7,rl=256,Gd=16,Wd=17,Kd=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]),ss=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]),Wg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kg=512,yr=new Array((Ra+2)*2);Ci(yr);var Ia=new Array(_i*2);Ci(Ia);var Pa=new Array(Kg);Ci(Pa);var Fa=new Array(zg-Qg+1);Ci(Fa);var nl=new Array(el);Ci(nl);var ks=new Array(_i);Ci(ks);function uu(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Jd,Yd,Zd;function lu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var Xd=t=>t<256?Pa[t]:Pa[256+(t>>>7)],La=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},mt=(t,e,r)=>{t.bi_valid>cu-r?(t.bi_buf|=e<<t.bi_valid&65535,La(t,t.bi_buf),t.bi_buf=e>>cu-t.bi_valid,t.bi_valid+=r-cu):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Xt=(t,e,r)=>{mt(t,r[e*2],r[e*2+1])},eh=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},Hg=t=>{t.bi_valid===16?(La(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Jg=(t,e)=>{let r=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<=Sn;p++)t.bl_count[p]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<zd;u++)l=t.heap[u],p=r[r[l*2+1]*2+1]+1,p>c&&(p=c,m++),r[l*2+1]=p,!(l>n)&&(t.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=r[l*2],t.opt_len+=h*(p+f),a&&(t.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(p=c-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(l=t.bl_count[p];l!==0;)d=t.heap[--u],!(d>n)&&(r[d*2+1]!==p&&(t.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),l--)}},th=(t,e,r)=>{let n=new Array(Sn+1),i=0,a,o;for(a=1;a<=Sn;a++)i=i+r[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=eh(n[s]++,s))}},Yg=()=>{let t,e,r,n,i,a=new Array(Sn+1);for(r=0,n=0;n<el-1;n++)for(nl[n]=r,t=0;t<1<<Fu[n];t++)Fa[r++]=n;for(Fa[r-1]=n,i=0,n=0;n<16;n++)for(ks[n]=i,t=0;t<1<<ss[n];t++)Pa[i++]=n;for(i>>=7;n<_i;n++)for(ks[n]=i<<7,t=0;t<1<<ss[n]-7;t++)Pa[256+i++]=n;for(e=0;e<=Sn;e++)a[e]=0;for(t=0;t<=143;)yr[t*2+1]=8,t++,a[8]++;for(;t<=255;)yr[t*2+1]=9,t++,a[9]++;for(;t<=279;)yr[t*2+1]=7,t++,a[7]++;for(;t<=287;)yr[t*2+1]=8,t++,a[8]++;for(th(yr,Ra+1,a),t=0;t<_i;t++)Ia[t*2+1]=5,Ia[t*2]=eh(t,5);Jd=new uu(yr,Fu,za+1,Ra,Sn),Yd=new uu(Ia,ss,0,_i,Sn),Zd=new uu(new Array(0),Wg,0,tl,Gg)},rh=t=>{let e;for(e=0;e<Ra;e++)t.dyn_ltree[e*2]=0;for(e=0;e<_i;e++)t.dyn_dtree[e*2]=0;for(e=0;e<tl;e++)t.bl_tree[e*2]=0;t.dyn_ltree[rl*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},nh=t=>{t.bi_valid>8?La(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},kp=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},fu=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&kp(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!kp(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Ap=(t,e,r)=>{let n,i,a=0,o,s;if(t.sym_next!==0)do n=t.pending_buf[t.sym_buf+a++]&255,n+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],n===0?Xt(t,i,e):(o=Fa[i],Xt(t,o+za+1,e),s=Fu[o],s!==0&&(i-=nl[o],mt(t,i,s)),n--,o=Xd(n),Xt(t,o,r),s=ss[o],s!==0&&(n-=ks[o],mt(t,n,s)));while(a<t.sym_next);Xt(t,rl,e)},Lu=(t,e)=>{let r=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(t.heap_len=0,t.heap_max=zd,o=0;o<a;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=n[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)fu(t,r,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],fu(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[u*2]=r[o*2]+r[s*2],t.depth[u]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[o*2+1]=r[s*2+1]=u,t.heap[1]=u++,fu(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Jg(t,e),th(r,c,t.bl_count)},Op=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[Gd*2]++):s<=10?t.bl_tree[Wd*2]++:t.bl_tree[Kd*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Dp=(t,e,r)=>{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<=r;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do Xt(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(t,a,t.bl_tree),s--),Xt(t,Gd,t.bl_tree),mt(t,s-3,2)):s<=10?(Xt(t,Wd,t.bl_tree),mt(t,s-3,3)):(Xt(t,Kd,t.bl_tree),mt(t,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Zg=t=>{let e;for(Op(t,t.dyn_ltree,t.l_desc.max_code),Op(t,t.dyn_dtree,t.d_desc.max_code),Lu(t,t.bl_desc),e=tl-1;e>=3&&t.bl_tree[Hd[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Xg=(t,e,r,n)=>{let i;for(mt(t,e-257,5),mt(t,r-1,5),mt(t,n-4,4),i=0;i<n;i++)mt(t,t.bl_tree[Hd[i]*2+1],3);Dp(t,t.dyn_ltree,e-1),Dp(t,t.dyn_dtree,r-1)},ev=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Tp;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Ip;for(r=32;r<za;r++)if(t.dyn_ltree[r*2]!==0)return Ip;return Tp},Np=!1,tv=t=>{Np||(Yg(),Np=!0),t.l_desc=new lu(t.dyn_ltree,Jd),t.d_desc=new lu(t.dyn_dtree,Yd),t.bl_desc=new lu(t.bl_tree,Zd),t.bi_buf=0,t.bi_valid=0,rh(t)},ih=(t,e,r,n)=>{mt(t,(Bg<<1)+(n?1:0),3),nh(t),La(t,r),La(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},rv=t=>{mt(t,Qd<<1,3),Xt(t,rl,yr),Hg(t)},nv=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===qg&&(t.strm.data_type=ev(t)),Lu(t,t.l_desc),Lu(t,t.d_desc),o=Zg(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?ih(t,e,r,n):t.strategy===Ug||a===i?(mt(t,(Qd<<1)+(n?1:0),3),Ap(t,yr,Ia)):(mt(t,(Vg<<1)+(n?1:0),3),Xg(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Ap(t,t.dyn_ltree,t.dyn_dtree)),rh(t),n&&nh(t)},iv=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Fa[r]+za+1)*2]++,t.dyn_dtree[Xd(e)*2]++),t.sym_next===t.sym_end),av=tv,ov=ih,sv=nv,cv=iv,uv=rv,lv={_tr_init:av,_tr_stored_block:ov,_tr_flush_block:sv,_tr_tally:cv,_tr_align:uv},fv=(t,e,r,n)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},$a=fv,pv=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},dv=new Uint32Array(pv()),hv=(t,e,r,n)=>{let i=dv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Ve=hv,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"},qn={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:mv,_tr_stored_block:$u,_tr_flush_block:yv,_tr_tally:qr,_tr_align:gv}=lv,{Z_NO_FLUSH:Br,Z_PARTIAL_FLUSH:vv,Z_FULL_FLUSH:bv,Z_FINISH:Ct,Z_BLOCK:Cp,Z_OK:Je,Z_STREAM_END:Rp,Z_STREAM_ERROR:tr,Z_DATA_ERROR:_v,Z_BUF_ERROR:pu,Z_DEFAULT_COMPRESSION:Sv,Z_FILTERED:wv,Z_HUFFMAN_ONLY:Qo,Z_RLE:Ev,Z_FIXED:xv,Z_DEFAULT_STRATEGY:Tv,Z_UNKNOWN:Iv,Z_DEFLATED:Us}=qn,kv=9,Av=15,Ov=8,Dv=29,Nv=256,Mu=Nv+1+Dv,Cv=30,Rv=19,Pv=2*Mu+1,Fv=15,ie=3,$r=258,rr=$r+ie+1,Lv=32,xi=42,il=57,ju=69,Uu=73,qu=91,Bu=103,wn=113,_a=666,ct=1,Ri=2,Rn=3,Pi=4,$v=3,En=(t,e)=>(t.msg=Cn[e],e),Pp=t=>t*2-(t>4?9:0),Lr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Mv=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do r=t.head[--n],t.head[n]=r>=i?r-i:0;while(--e);e=i,n=e;do r=t.prev[--n],t.prev[n]=r>=i?r-i:0;while(--e)},jv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Vr=jv,bt=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},St=(t,e)=>{yv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bt(t.strm)},pe=(t,e)=>{t.pending_buf[t.pending++]=e},aa=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Vu=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),t.state.wrap===1?t.adler=$a(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ve(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},ah=(t,e)=>{let r=t.max_chain_length,n=t.strstart,i,a,o=t.prev_length,s=t.nice_match,c=t.strstart>t.w_size-rr?t.strstart-(t.w_size-rr):0,u=t.window,l=t.w_mask,d=t.prev,p=t.strstart+$r,f=u[n+o-1],h=u[n+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.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=$r-(p-n),n=p-$r,a>o){if(t.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--r!==0);return o<=t.lookahead?o:t.lookahead},Ti=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-rr)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Mv(t),n+=e),t.strm.avail_in===0)break;if(r=Vu(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=ie)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Vr(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Vr(t,t.ins_h,t.window[i+ie-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<ie)););}while(t.lookahead<rr&&t.strm.avail_in!==0)},oh=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n,i,a,o=0,s=t.strm.avail_in;do{if(n=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>a&&(n=a),n<r&&(n===0&&e!==Ct||e===Br||n!==i+t.strm.avail_in)))break;o=e===Ct&&n===i+t.strm.avail_in?1:0,$u(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,bt(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vu(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?Pi:e!==Br&&e!==Ct&&t.strm.avail_in===0&&t.strstart===t.block_start?Ri:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Vu(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,r=a>t.w_size?t.w_size:a,i=t.strstart-t.block_start,(i>=r||(i||e===Ct)&&e!==Br&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Ct&&t.strm.avail_in===0&&n===i?1:0,$u(t,t.block_start,n,o),t.block_start+=n,bt(t.strm)),o?Rn:ct)},du=(t,e)=>{let r,n;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ie&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ie-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r)),t.match_length>=ie)if(n=qr(t,t.strstart-t.match_start,t.match_length-ie),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ie){t.match_length--;do t.strstart++,t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ie-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+1]);else n=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=t.strstart<ie-1?t.strstart:ie-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},pi=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ie&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ie-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ie-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r),t.match_length<=5&&(t.strategy===wv||t.match_length===ie&&t.strstart-t.match_start>4096)&&(t.match_length=ie-1)),t.prev_length>=ie&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ie,n=qr(t,t.strstart-1-t.prev_match,t.prev_length-ie),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ie-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ie-1,t.strstart++,n&&(St(t,!1),t.strm.avail_out===0))return ct}else if(t.match_available){if(n=qr(t,0,t.window[t.strstart-1]),n&&St(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return ct}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=qr(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ie-1?t.strstart:ie-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},Uv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=$r){if(Ti(t),t.lookahead<=$r&&e===Br)return ct;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ie&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+$r;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);t.match_length=$r-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ie?(r=qr(t,1,t.match_length-ie),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},qv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Ti(t),t.lookahead===0)){if(e===Br)return ct;break}if(t.match_length=0,r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri};function Kt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var Sa=[new Kt(0,0,0,0,oh),new Kt(4,4,8,4,du),new Kt(4,5,16,8,du),new Kt(4,6,32,32,du),new Kt(4,4,16,16,pi),new Kt(8,16,32,32,pi),new Kt(8,16,128,128,pi),new Kt(8,32,128,256,pi),new Kt(32,128,258,1024,pi),new Kt(32,258,258,4096,pi)],Bv=t=>{t.window_size=2*t.w_size,Lr(t.head),t.max_lazy_match=Sa[t.level].max_lazy,t.good_match=Sa[t.level].good_length,t.nice_match=Sa[t.level].nice_length,t.max_chain_length=Sa[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ie-1,t.match_available=0,t.ins_h=0};function Vv(){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=Us,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(Pv*2),this.dyn_dtree=new Uint16Array((2*Cv+1)*2),this.bl_tree=new Uint16Array((2*Rv+1)*2),Lr(this.dyn_ltree),Lr(this.dyn_dtree),Lr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Fv+1),this.heap=new Uint16Array(2*Mu+1),Lr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Mu+1),Lr(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=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==xi&&e.status!==il&&e.status!==ju&&e.status!==Uu&&e.status!==qu&&e.status!==Bu&&e.status!==wn&&e.status!==_a?1:0},sh=t=>{if(Ga(t))return En(t,tr);t.total_in=t.total_out=0,t.data_type=Iv;let e=t.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:wn,t.adler=e.wrap===2?0:1,e.last_flush=-2,mv(e),Je},ch=t=>{let e=sh(t);return e===Je&&Bv(t.state),e},Qv=(t,e)=>Ga(t)||t.state.wrap!==2?tr:(t.state.gzhead=e,Je),uh=(t,e,r,n,i,a)=>{if(!t)return tr;let o=1;if(e===Sv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>kv||r!==Us||n<8||n>15||e<0||e>9||a<0||a>xv||n===8&&o!==1)return En(t,tr);n===8&&(n=9);let s=new Vv;return t.state=s,s.strm=t,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+ie-1)/ie),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=r,ch(t)},zv=(t,e)=>uh(t,e,Us,Av,Ov,Tv),Gv=(t,e)=>{if(Ga(t)||e>Cp||e<0)return t?En(t,tr):tr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===_a&&e!==Ct)return En(t,t.avail_out===0?pu:tr);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(bt(t),t.avail_out===0)return r.last_flush=-1,Je}else if(t.avail_in===0&&Pp(e)<=Pp(n)&&e!==Ct)return En(t,pu);if(r.status===_a&&t.avail_in!==0)return En(t,pu);if(r.status===xi&&r.wrap===0&&(r.status=wn),r.status===xi){let i=Us+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Qo||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Lv),i+=31-i%31,aa(r,i),r.strstart!==0&&(aa(r,t.adler>>>16),aa(r,t.adler&65535)),t.adler=1,r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===il){if(t.adler=0,pe(r,31),pe(r,139),pe(r,8),r.gzhead)pe(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),pe(r,r.gzhead.time&255),pe(r,r.gzhead.time>>8&255),pe(r,r.gzhead.time>>16&255),pe(r,r.gzhead.time>>24&255),pe(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),pe(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(pe(r,r.gzhead.extra.length&255),pe(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ve(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=ju;else if(pe(r,0),pe(r,0),pe(r,0),pe(r,0),pe(r,0),pe(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),pe(r,$v),r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===ju){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let s=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0,a-=s}let o=new Uint8Array(r.gzhead.extra);r.pending_buf.set(o.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Uu}if(r.status===Uu){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,pe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=qu}if(r.status===qu){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,pe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i))}r.status=Bu}if(r.status===Bu){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(bt(t),r.pending!==0))return r.last_flush=-1,Je;pe(r,t.adler&255),pe(r,t.adler>>8&255),t.adler=0}if(r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(t.avail_in!==0||r.lookahead!==0||e!==Br&&r.status!==_a){let i=r.level===0?oh(r,e):r.strategy===Qo?qv(r,e):r.strategy===Ev?Uv(r,e):Sa[r.level].func(r,e);if((i===Rn||i===Pi)&&(r.status=_a),i===ct||i===Rn)return t.avail_out===0&&(r.last_flush=-1),Je;if(i===Ri&&(e===vv?gv(r):e!==Cp&&($u(r,0,0,!1),e===bv&&(Lr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),bt(t),t.avail_out===0))return r.last_flush=-1,Je}return e!==Ct?Je:r.wrap<=0?Rp:(r.wrap===2?(pe(r,t.adler&255),pe(r,t.adler>>8&255),pe(r,t.adler>>16&255),pe(r,t.adler>>24&255),pe(r,t.total_in&255),pe(r,t.total_in>>8&255),pe(r,t.total_in>>16&255),pe(r,t.total_in>>24&255)):(aa(r,t.adler>>>16),aa(r,t.adler&65535)),bt(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Je:Rp)},Wv=t=>{if(Ga(t))return tr;let e=t.state.status;return t.state=null,e===wn?En(t,_v):Je},Kv=(t,e)=>{let r=e.length;if(Ga(t))return tr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==xi||n.lookahead)return tr;if(i===1&&(t.adler=$a(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Lr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(r-n.w_size,r),0),e=c,r=n.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Ti(n);n.lookahead>=ie;){let c=n.strstart,u=n.lookahead-(ie-1);do n.ins_h=Vr(n,n.ins_h,n.window[c+ie-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=ie-1,Ti(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ie-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,Je},Hv=zv,Jv=uh,Yv=ch,Zv=sh,Xv=Qv,eb=Gv,tb=Wv,rb=Kv,nb="pako deflate (from Nodeca project)",ka={deflateInit:Hv,deflateInit2:Jv,deflateReset:Yv,deflateResetKeep:Zv,deflateSetHeader:Xv,deflate:eb,deflateEnd:tb,deflateSetDictionary:rb,deflateInfo:nb},ib=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ab=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)ib(r,n)&&(t[n]=r[n])}}return t},ob=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;let r=new Uint8Array(e);for(let n=0,i=0,a=t.length;n<a;n++){let o=t[n];r.set(o,i),i+=o.length}return r},qs={assign:ab,flattenChunks:ob},lh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){lh=!1}var Ma=new Uint8Array(256);for(let t=0;t<256;t++)Ma[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ma[254]=Ma[254]=1;var sb=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,n,i,a,o=t.length,s=0;for(i=0;i<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e},cb=(t,e)=>{if(e<65534&&t.subarray&&lh)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r},ub=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let n,i,a=new Array(r*2);for(i=0,n=0;n<r;){let o=t[n++];if(o<128){a[i++]=o;continue}let s=Ma[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<r;)o=o<<6|t[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 cb(a,i)},lb=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ma[t[r]]>e?r:e},ja={string2buf:sb,buf2string:ub,utf8border:lb};function fb(){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 fh=fb,ph=Object.prototype.toString,{Z_NO_FLUSH:pb,Z_SYNC_FLUSH:db,Z_FULL_FLUSH:hb,Z_FINISH:mb,Z_OK:As,Z_STREAM_END:yb,Z_DEFAULT_COMPRESSION:gb,Z_DEFAULT_STRATEGY:vb,Z_DEFLATED:bb}=qn;function Wa(t){this.options=qs.assign({level:gb,method:bb,chunkSize:16384,windowBits:15,memLevel:8,strategy:vb},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=ka.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==As)throw new Error(Cn[r]);if(e.header&&ka.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=ja.string2buf(e.dictionary):ph.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=ka.deflateSetDictionary(this.strm,n),r!==As)throw new Error(Cn[r]);this._dict_set=!0}}Wa.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?mb:pb,typeof t=="string"?r.input=ja.string2buf(t):ph.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===db||a===hb)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=ka.deflate(r,a),i===yb)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=ka.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===As;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};Wa.prototype.onData=function(t){this.chunks.push(t)};Wa.prototype.onEnd=function(t){t===As&&(this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function al(t,e){let r=new Wa(e);if(r.push(t,!0),r.err)throw r.msg||Cn[r.err];return r.result}function _b(t,e){return e=e||{},e.raw=!0,al(t,e)}function Sb(t,e){return e=e||{},e.gzip=!0,al(t,e)}var wb=Wa,Eb=al,xb=_b,Tb=Sb,Ib=qn,kb={Deflate:wb,deflate:Eb,deflateRaw:xb,gzip:Tb,constants:Ib},zo=16209,Ab=16191,Ob=function t(e,r){let n,i,a,o,s,c,u,l,d,p,f,h,m,g,_,S,w,b,A,R,E,C,F,P,M=e.state;n=e.next_in,F=e.input,i=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,d=M.wnext,p=M.window,f=M.hold,h=M.bits,m=M.lencode,g=M.distcode,_=(1<<M.lenbits)-1,S=(1<<M.distbits)-1;e:do{h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),w=m[f&_];t:for(;;){if(b=w>>>24,f>>>=b,h-=b,b=w>>>16&255,b===0)P[a++]=w&65535;else if(b&16){A=w&65535,b&=15,b&&(h<b&&(f+=F[n++]<<h,h+=8),A+=f&(1<<b)-1,f>>>=b,h-=b),h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),w=g[f&S];r:for(;;){if(b=w>>>24,f>>>=b,h-=b,b=w>>>16&255,b&16){if(R=w&65535,b&=15,h<b&&(f+=F[n++]<<h,h+=8,h<b&&(f+=F[n++]<<h,h+=8)),R+=f&(1<<b)-1,R>c){e.msg="invalid distance too far back",M.mode=zo;break e}if(f>>>=b,h-=b,b=a-o,R>b){if(b=R-b,b>l&&M.sane){e.msg="invalid distance too far back",M.mode=zo;break e}if(E=0,C=p,d===0){if(E+=u-b,b<A){A-=b;do P[a++]=p[E++];while(--b);E=a-R,C=P}}else if(d<b){if(E+=u+d-b,b-=d,b<A){A-=b;do P[a++]=p[E++];while(--b);if(E=0,d<A){b=d,A-=b;do P[a++]=p[E++];while(--b);E=a-R,C=P}}}else if(E+=d-b,b<A){A-=b;do P[a++]=p[E++];while(--b);E=a-R,C=P}for(;A>2;)P[a++]=C[E++],P[a++]=C[E++],P[a++]=C[E++],A-=3;A&&(P[a++]=C[E++],A>1&&(P[a++]=C[E++]))}else{E=a-R;do P[a++]=P[E++],P[a++]=P[E++],P[a++]=P[E++],A-=3;while(A>2);A&&(P[a++]=P[E++],A>1&&(P[a++]=P[E++]))}}else if((b&64)===0){w=g[(w&65535)+(f&(1<<b)-1)];continue r}else{e.msg="invalid distance code",M.mode=zo;break e}break}}else if((b&64)===0){w=m[(w&65535)+(f&(1<<b)-1)];continue t}else if(b&32){M.mode=Ab;break e}else{e.msg="invalid literal/length code",M.mode=zo;break e}break}}while(n<i&&a<s);A=h>>3,n-=A,h-=A<<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),M.hold=f,M.bits=h},di=15,Fp=852,Lp=592,$p=0,hu=1,Mp=2,Db=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]),Nb=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]),Cb=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]),Rb=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]),Pb=(t,e,r,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,_=0,S=0,w,b,A,R,E,C=null,F,P=new Uint16Array(di+1),M=new Uint16Array(di+1),Ee=null,ne,j,ge;for(u=0;u<=di;u++)P[u]=0;for(l=0;l<n;l++)P[e[r+l]]++;for(f=c,p=di;p>=1&&P[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&&P[d]===0;d++);for(f<d&&(f=d),g=1,u=1;u<=di;u++)if(g<<=1,g-=P[u],g<0)return-1;if(g>0&&(t===$p||p!==1))return-1;for(M[1]=0,u=1;u<di;u++)M[u+1]=M[u]+P[u];for(l=0;l<n;l++)e[r+l]!==0&&(o[M[e[r+l]]++]=l);if(t===$p?(C=Ee=o,F=20):t===hu?(C=Db,Ee=Nb,F=257):(C=Cb,Ee=Rb,F=0),S=0,l=0,u=d,E=a,h=f,m=0,A=-1,_=1<<f,R=_-1,t===hu&&_>Fp||t===Mp&&_>Lp)return 1;for(;;){ne=u-m,o[l]+1<F?(j=0,ge=o[l]):o[l]>=F?(j=Ee[o[l]-F],ge=C[o[l]-F]):(j=32+64,ge=0),w=1<<u-m,b=1<<h,d=b;do b-=w,i[E+(S>>m)+b]=ne<<24|j<<16|ge|0;while(b!==0);for(w=1<<u-1;S&w;)w>>=1;if(w!==0?(S&=w-1,S+=w):S=0,l++,--P[u]===0){if(u===p)break;u=e[r+o[l]]}if(u>f&&(S&R)!==A){for(m===0&&(m=f),E+=d,h=u-m,g=1<<h;h+m<p&&(g-=P[h+m],!(g<=0));)h++,g<<=1;if(_+=1<<h,t===hu&&_>Fp||t===Mp&&_>Lp)return 1;A=S&R,i[A]=f<<24|h<<16|E-a|0}}return S!==0&&(i[E+S]=u-m<<24|64<<16|0),s.bits=f,0},Aa=Pb,Fb=0,dh=1,hh=2,{Z_FINISH:jp,Z_BLOCK:Lb,Z_TREES:Go,Z_OK:Pn,Z_STREAM_END:$b,Z_NEED_DICT:Mb,Z_STREAM_ERROR:Rt,Z_DATA_ERROR:mh,Z_MEM_ERROR:yh,Z_BUF_ERROR:jb,Z_DEFLATED:Up}=qn,Bs=16180,qp=16181,Bp=16182,Vp=16183,Qp=16184,zp=16185,Gp=16186,Wp=16187,Kp=16188,Hp=16189,Os=16190,pr=16191,mu=16192,Jp=16193,yu=16194,Yp=16195,Zp=16196,Xp=16197,ed=16198,Wo=16199,Ko=16200,td=16201,rd=16202,nd=16203,id=16204,ad=16205,gu=16206,od=16207,sd=16208,Te=16209,gh=16210,vh=16211,Ub=852,qb=592,Bb=15,Vb=Bb,cd=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Qb(){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 Bn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Bs||e.mode>vh?1:0},bh=t=>{if(Bn(t))return Rt;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Bs,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(Ub),e.distcode=e.distdyn=new Int32Array(qb),e.sane=1,e.back=-1,Pn},_h=t=>{if(Bn(t))return Rt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,bh(t)},Sh=(t,e)=>{let r;if(Bn(t))return Rt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Rt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,_h(t))},wh=(t,e)=>{if(!t)return Rt;let r=new Qb;t.state=r,r.strm=t,r.window=null,r.mode=Bs;let n=Sh(t,e);return n!==Pn&&(t.state=null),n},zb=t=>wh(t,Vb),ud=!0,vu,bu,Gb=t=>{if(ud){vu=new Int32Array(512),bu=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Aa(dh,t.lens,0,288,vu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Aa(hh,t.lens,0,32,bu,0,t.work,{bits:5}),ud=!1}t.lencode=vu,t.lenbits=9,t.distcode=bu,t.distbits=5},Eh=(t,e,r,n)=>{let i,a=t.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(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(r-n,r),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},Wb=(t,e)=>{let r,n,i,a,o,s,c,u,l,d,p,f,h,m,g=0,_,S,w,b,A,R,E,C,F=new Uint8Array(4),P,M,Ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Bn(t)||!t.output||!t.input&&t.avail_in!==0)return Rt;r=t.state,r.mode===pr&&(r.mode=mu),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,d=s,p=c,C=Pn;e:for(;;)switch(r.mode){case Bs:if(r.wrap===0){r.mode=mu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&2&&u===35615){r.wbits===0&&(r.wbits=15),r.check=0,F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0),u=0,l=0,r.mode=qp;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Te;break}if((u&15)!==Up){t.msg="unknown compression method",r.mode=Te;break}if(u>>>=4,l-=4,E=(u&15)+8,r.wbits===0&&(r.wbits=E),E>15||E>r.wbits){t.msg="invalid window size",r.mode=Te;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=u&512?Hp:pr,u=0,l=0;break;case qp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.flags=u,(r.flags&255)!==Up){t.msg="unknown compression method",r.mode=Te;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Te;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Bp;case Bp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.time=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,F[2]=u>>>16&255,F[3]=u>>>24&255,r.check=Ve(r.check,F,4,0)),u=0,l=0,r.mode=Vp;case Vp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Qp;case Qp:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=zp;case zp:if(r.flags&1024&&(f=r.length,f>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+f),E)),r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,r.length-=f),r.length))break e;r.length=0,r.mode=Gp;case Gp:if(r.flags&2048){if(s===0)break e;f=0;do E=n[a+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E));while(E&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Wp;case Wp:if(r.flags&4096){if(s===0)break e;f=0;do E=n[a+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E));while(E&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=Kp;case Kp:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Te;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=pr;break;case Hp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.adler=r.check=cd(u),u=0,l=0,r.mode=Os;case Os:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Mb;t.adler=r.check=1,r.mode=pr;case pr:if(e===Lb||e===Go)break e;case mu:if(r.last){u>>>=l&7,l-=l&7,r.mode=gu;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(r.last=u&1,u>>>=1,l-=1,u&3){case 0:r.mode=Jp;break;case 1:if(Gb(r),r.mode=Wo,e===Go){u>>>=2,l-=2;break e}break;case 2:r.mode=Zp;break;case 3:t.msg="invalid block type",r.mode=Te}u>>>=2,l-=2;break;case Jp: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)){t.msg="invalid stored block lengths",r.mode=Te;break}if(r.length=u&65535,u=0,l=0,r.mode=yu,e===Go)break e;case yu:r.mode=Yp;case Yp:if(f=r.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,r.length-=f;break}r.mode=pr;break;case Zp:for(;l<14;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.nlen=(u&31)+257,u>>>=5,l-=5,r.ndist=(u&31)+1,u>>>=5,l-=5,r.ncode=(u&15)+4,u>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Te;break}r.have=0,r.mode=Xp;case Xp:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.lens[Ee[r.have++]]=u&7,u>>>=3,l-=3}for(;r.have<19;)r.lens[Ee[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},C=Aa(Fb,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,C){t.msg="invalid code lengths set",r.mode=Te;break}r.have=0,r.mode=ed;case ed:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[u&(1<<r.lenbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(w<16)u>>>=_,l-=_,r.lens[r.have++]=w;else{if(w===16){for(M=_+2;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=_,l-=_,r.have===0){t.msg="invalid bit length repeat",r.mode=Te;break}E=r.lens[r.have-1],f=3+(u&3),u>>>=2,l-=2}else if(w===17){for(M=_+3;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,E=0,f=3+(u&7),u>>>=3,l-=3}else{for(M=_+7;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,E=0,f=11+(u&127),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Te;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===Te)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Te;break}if(r.lenbits=9,P={bits:r.lenbits},C=Aa(dh,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,C){t.msg="invalid literal/lengths set",r.mode=Te;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},C=Aa(hh,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,C){t.msg="invalid distances set",r.mode=Te;break}if(r.mode=Wo,e===Go)break e;case Wo:r.mode=Ko;case Ko:if(s>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Ob(t,p),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,r.mode===pr&&(r.back=-1);break}for(r.back=0;g=r.lencode[u&(1<<r.lenbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S&&(S&240)===0){for(b=_,A=S,R=w;g=r.lencode[R+((u&(1<<b+A)-1)>>b)],_=g>>>24,S=g>>>16&255,w=g&65535,!(b+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,r.back+=b}if(u>>>=_,l-=_,r.back+=_,r.length=w,S===0){r.mode=ad;break}if(S&32){r.back=-1,r.mode=pr;break}if(S&64){t.msg="invalid literal/length code",r.mode=Te;break}r.extra=S&15,r.mode=td;case td:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=rd;case rd:for(;g=r.distcode[u&(1<<r.distbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((S&240)===0){for(b=_,A=S,R=w;g=r.distcode[R+((u&(1<<b+A)-1)>>b)],_=g>>>24,S=g>>>16&255,w=g&65535,!(b+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,r.back+=b}if(u>>>=_,l-=_,r.back+=_,S&64){t.msg="invalid distance code",r.mode=Te;break}r.offset=w,r.extra=S&15,r.mode=nd;case nd:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Te;break}r.mode=id;case id:if(c===0)break e;if(f=p-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Te;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),m=r.window}else m=i,h=o-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do i[o++]=m[h++];while(--f);r.length===0&&(r.mode=Ko);break;case ad:if(c===0)break e;i[o++]=r.length,c--,r.mode=Ko;break;case gu:if(r.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(p-=c,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,o-p):$a(r.check,i,p,o-p)),p=c,r.wrap&4&&(r.flags?u:cd(u))!==r.check){t.msg="incorrect data check",r.mode=Te;break}u=0,l=0}r.mode=od;case od:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Te;break}u=0,l=0}r.mode=sd;case sd:C=$b;break e;case Te:C=mh;break e;case gh:return yh;case vh:default:return Rt}return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,(r.wsize||p!==t.avail_out&&r.mode<Te&&(r.mode<gu||e!==jp))&&Eh(t,t.output,t.next_out,p-t.avail_out),d-=t.avail_in,p-=t.avail_out,t.total_in+=d,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,t.next_out-p):$a(r.check,i,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===pr?128:0)+(r.mode===Wo||r.mode===yu?256:0),(d===0&&p===0||e===jp)&&C===Pn&&(C=jb),C},Kb=t=>{if(Bn(t))return Rt;let e=t.state;return e.window&&(e.window=null),t.state=null,Pn},Hb=(t,e)=>{if(Bn(t))return Rt;let r=t.state;return(r.wrap&2)===0?Rt:(r.head=e,e.done=!1,Pn)},Jb=(t,e)=>{let r=e.length,n,i,a;return Bn(t)||(n=t.state,n.wrap!==0&&n.mode!==Os)?Rt:n.mode===Os&&(i=1,i=$a(i,e,r,0),i!==n.check)?mh:(a=Eh(t,e,r,r),a?(n.mode=gh,yh):(n.havedict=1,Pn))},Yb=_h,Zb=Sh,Xb=bh,e_=zb,t_=wh,r_=Wb,n_=Kb,i_=Hb,a_=Jb,o_="pako inflate (from Nodeca project)",gr={inflateReset:Yb,inflateReset2:Zb,inflateResetKeep:Xb,inflateInit:e_,inflateInit2:t_,inflate:r_,inflateEnd:n_,inflateGetHeader:i_,inflateSetDictionary:a_,inflateInfo:o_};function s_(){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 c_=s_,xh=Object.prototype.toString,{Z_NO_FLUSH:u_,Z_FINISH:l_,Z_OK:Ua,Z_STREAM_END:_u,Z_NEED_DICT:Su,Z_STREAM_ERROR:f_,Z_DATA_ERROR:ld,Z_MEM_ERROR:p_}=qn;function Ka(t){this.options=qs.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=gr.inflateInit2(this.strm,e.windowBits);if(r!==Ua)throw new Error(Cn[r]);if(this.header=new c_,gr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ja.string2buf(e.dictionary):xh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=gr.inflateSetDictionary(this.strm,e.dictionary),r!==Ua)))throw new Error(Cn[r])}Ka.prototype.push=function(t,e){let r=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?l_:u_,xh.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=gr.inflate(r,o),a===Su&&i&&(a=gr.inflateSetDictionary(r,i),a===Ua?a=gr.inflate(r,o):a===ld&&(a=Su));r.avail_in>0&&a===_u&&r.state.wrap>0&&t[r.next_in]!==0;)gr.inflateReset(r),a=gr.inflate(r,o);switch(a){case f_:case ld:case Su:case p_:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===_u))if(this.options.to==="string"){let c=ja.utf8border(r.output,r.next_out),u=r.next_out-c,l=ja.buf2string(r.output,c);r.next_out=u,r.avail_out=n-u,u&&r.output.set(r.output.subarray(c,c+u),0),this.onData(l)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===Ua&&s===0)){if(a===_u)return a=gr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Ka.prototype.onData=function(t){this.chunks.push(t)};Ka.prototype.onEnd=function(t){t===Ua&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ol(t,e){let r=new Ka(e);if(r.push(t),r.err)throw r.msg||Cn[r.err];return r.result}function d_(t,e){return e=e||{},e.raw=!0,ol(t,e)}var h_=Ka,m_=ol,y_=d_,g_=ol,v_=qn,b_={Inflate:h_,inflate:m_,inflateRaw:y_,ungzip:g_,constants:v_},{Deflate:__,deflate:S_,deflateRaw:w_,gzip:E_}=kb,{Inflate:x_,inflate:T_,inflateRaw:I_,ungzip:k_}=b_,A_=__,O_=S_,D_=w_,N_=E_,C_=x_,R_=T_,P_=I_,F_=k_,L_=qn,$_={Deflate:A_,deflate:O_,deflateRaw:D_,gzip:N_,Inflate:C_,inflate:R_,inflateRaw:P_,ungzip:F_,constants:L_},be=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},_e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ds=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ds.prototype,"input",void 0);be([y(),_e("design:type",String)],Ds.prototype,"output",void 0);Ds=be([ze(),_e("design:paramtypes",[String,String])],Ds);var Ns=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ns.prototype,"input",void 0);be([y(),_e("design:type",String)],Ns.prototype,"output",void 0);Ns=be([G(),_e("design:paramtypes",[String,String])],Ns);var Wr=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};be([y(),_e("design:type",String)],Wr.prototype,"name",void 0);be([y(),_e("design:type",String)],Wr.prototype,"modelId",void 0);be([y(),_e("design:type",String)],Wr.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],Wr.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],Wr.prototype,"metaData",void 0);Wr=be([ze(),_e("design:paramtypes",[String,String,String,Array,String])],Wr);var ar=class{constructor(e,r,n,i,a,o,s,c){this.name=e,this.modelId=r,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};be([y(),_e("design:type",String)],ar.prototype,"name",void 0);be([y(),_e("design:type",String)],ar.prototype,"modelId",void 0);be([y(),_e("design:type",String)],ar.prototype,"taskId",void 0);be([y(),_e("design:type",String)],ar.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],ar.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],ar.prototype,"metaData",void 0);be([y(),_e("design:type",String)],ar.prototype,"createdAt",void 0);be([y(),_e("design:type",String)],ar.prototype,"updatedAt",void 0);ar=be([G(),_e("design:paramtypes",[String,String,String,String,Array,String,String,String])],ar);var Fn=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};be([y(),_e("design:type",String)],Fn.prototype,"model",void 0);be([y(),_e("design:type",String)],Fn.prototype,"status",void 0);be([y(),_e("design:type",Number)],Fn.prototype,"progress",void 0);be([y(),_e("design:type",Boolean)],Fn.prototype,"downloaded",void 0);be([y(),_e("design:type",Boolean)],Fn.prototype,"loaded",void 0);Fn=be([G(),_e("design:paramtypes",[String,String,Number,Boolean,Boolean])],Fn);var M_=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},qe=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},je,cs,Qu=class{constructor(e,r=!0){je.set(this,void 0),cs.set(this,new Map),M_(this,je,e,"f")}async getModels(){let e=await qe(this,je,"f").query({query:I`
743
743
  query {
744
744
  aiGetModels {
745
745
  id
@@ -763,23 +763,23 @@ triggerMatch
763
763
  modelType
764
764
  }
765
765
  }
766
- `});return k(e).aiGetModels}async addModel(e){let r=await Ue(this,Me,"f").mutate({mutation:T`
766
+ `});return k(e).aiGetModels}async addModel(e){let r=await qe(this,je,"f").mutate({mutation:I`
767
767
  mutation($model: ModelInput!) {
768
768
  aiAddModel(model: $model)
769
769
  }
770
- `,variables:{model:e}});return k(r).aiAddModel}async updateModel(e,r){let n=await Ue(this,Me,"f").mutate({mutation:T`
770
+ `,variables:{model:e}});return k(r).aiAddModel}async updateModel(e,r){let n=await qe(this,je,"f").mutate({mutation:I`
771
771
  mutation($modelId: String!, $model: ModelInput!) {
772
772
  aiUpdateModel(modelId: $modelId, model: $model)
773
773
  }
774
- `,variables:{modelId:e,model:r}});return k(n).aiUpdateModel}async removeModel(e){let r=await Ue(this,Me,"f").mutate({mutation:T`
774
+ `,variables:{modelId:e,model:r}});return k(n).aiUpdateModel}async removeModel(e){let r=await qe(this,je,"f").mutate({mutation:I`
775
775
  mutation($modelId: String!) {
776
776
  aiRemoveModel(modelId: $modelId)
777
777
  }
778
- `,variables:{modelId:e}});return k(r).aiRemoveModel}async setDefaultModel(e,r){let n=await Ue(this,Me,"f").mutate({mutation:T`
778
+ `,variables:{modelId:e}});return k(r).aiRemoveModel}async setDefaultModel(e,r){let n=await qe(this,je,"f").mutate({mutation:I`
779
779
  mutation($modelType: ModelType!, $modelId: String!) {
780
780
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
781
781
  }
782
- `,variables:{modelId:r,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let r=await Ue(this,Me,"f").query({query:T`
782
+ `,variables:{modelId:r,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let r=await qe(this,je,"f").query({query:I`
783
783
  query($modelType: ModelType!) {
784
784
  aiGetDefaultModel(modelType: $modelType) {
785
785
  id
@@ -803,7 +803,7 @@ triggerMatch
803
803
  modelType
804
804
  }
805
805
  }
806
- `,variables:{modelType:e}});return k(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await Ue(this,Me,"f").query({query:T`
806
+ `,variables:{modelType:e}});return k(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await qe(this,je,"f").query({query:I`
807
807
  query {
808
808
  aiTasks {
809
809
  name
@@ -819,7 +819,7 @@ triggerMatch
819
819
  updatedAt
820
820
  }
821
821
  }
822
- `}));return e}async addTask(e,r,n,i,a){let o=new Gr(e,r,n,i,a),{aiAddTask:s}=k(await Ue(this,Me,"f").mutate({mutation:T`
822
+ `}));return e}async addTask(e,r,n,i,a){let o=new Wr(e,r,n,i,a),{aiAddTask:s}=k(await qe(this,je,"f").mutate({mutation:I`
823
823
  mutation AiAddTask($task: AITaskInput!) {
824
824
  aiAddTask(task: $task) {
825
825
  name
@@ -835,7 +835,7 @@ triggerMatch
835
835
  updatedAt
836
836
  }
837
837
  }
838
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=k(await Ue(this,Me,"f").mutate({mutation:T`
838
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=k(await qe(this,je,"f").mutate({mutation:I`
839
839
  mutation AiRemoveTask($taskId: String!) {
840
840
  aiRemoveTask(taskId: $taskId) {
841
841
  name
@@ -851,7 +851,7 @@ triggerMatch
851
851
  updatedAt
852
852
  }
853
853
  }
854
- `,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=k(await Ue(this,Me,"f").mutate({mutation:T`
854
+ `,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=k(await qe(this,je,"f").mutate({mutation:I`
855
855
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
856
856
  aiUpdateTask(taskId: $taskId, task: $task) {
857
857
  name
@@ -867,7 +867,7 @@ triggerMatch
867
867
  updatedAt
868
868
  }
869
869
  }
870
- `,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=k(await Ue(this,Me,"f").query({query:T`
870
+ `,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=k(await qe(this,je,"f").query({query:I`
871
871
  query AiModelLoadingStatus($model: String!) {
872
872
  aiModelLoadingStatus(model: $model) {
873
873
  model
@@ -877,41 +877,41 @@ triggerMatch
877
877
  downloaded
878
878
  }
879
879
  }
880
- `,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=k(await Ue(this,Me,"f").mutate({mutation:T`
880
+ `,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=k(await qe(this,je,"f").mutate({mutation:I`
881
881
  mutation AiPrompt($taskId: String!, $prompt: String!) {
882
882
  aiPrompt(taskId: $taskId, prompt: $prompt)
883
883
  }
884
- `,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=k(await Ue(this,Me,"f").mutate({mutation:T`
884
+ `,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=k(await qe(this,je,"f").mutate({mutation:I`
885
885
  mutation aiEmbed($modelId: String!, $text: String!) {
886
886
  aiEmbed(modelId: $modelId, text: $text)
887
887
  }
888
- `,variables:{modelId:e,text:r}})),i=js.toByteArray(n);return JSON.parse($_.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n){let{aiOpenTranscriptionStream:i}=k(await Ue(this,Me,"f").mutate({mutation:T`
888
+ `,variables:{modelId:e,text:r}})),i=js.toByteArray(n);return JSON.parse($_.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n){let{aiOpenTranscriptionStream:i}=k(await qe(this,je,"f").mutate({mutation:I`
889
889
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
890
890
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
891
891
  }
892
- `,variables:{modelId:e,params:n}})),a=Ue(this,Me,"f").subscribe({query:T` subscription {
892
+ `,variables:{modelId:e,params:n}})),a=qe(this,je,"f").subscribe({query:I` subscription {
893
893
  aiTranscriptionText(streamId: "${i}")
894
- }`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Ue(this,cs,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await Ue(this,Me,"f").mutate({mutation:T`
894
+ }`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return qe(this,cs,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await qe(this,je,"f").mutate({mutation:I`
895
895
  mutation aiCloseTranscriptionStream($streamId: String!) {
896
896
  aiCloseTranscriptionStream(streamId: $streamId)
897
897
  }
898
- `,variables:{streamId:e}})),n=Ue(this,cs,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=k(await Ue(this,Me,"f").mutate({mutation:T`
898
+ `,variables:{streamId:e}})),n=qe(this,cs,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=k(await qe(this,je,"f").mutate({mutation:I`
899
899
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
900
900
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
901
901
  }
902
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};Me=new WeakMap,cs=new WeakMap;var Rr=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},$e=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yt,us,Sa,ls,wa,vn,fs,Ea,Ua=class{constructor(e,r=!0){Yt.set(this,void 0),us.set(this,void 0),Sa.set(this,void 0),ls.set(this,void 0),wa.set(this,void 0),vn.set(this,void 0),fs.set(this,void 0),Ea.set(this,void 0),Rr(this,Yt,e,"f"),Rr(this,us,new Na($e(this,Yt,"f"),r),"f"),Rr(this,Sa,new Pu($e(this,Yt,"f")),"f"),Rr(this,ls,new Nu($e(this,Yt,"f")),"f"),Rr(this,wa,new Cu($e(this,Yt,"f")),"f"),Rr(this,Ea,new Qu($e(this,Yt,"f"),r),"f"),Rr(this,vn,new Is($e(this,Yt,"f"),r),"f"),$e(this,vn,"f").setExpressionClient($e(this,Sa,"f")),$e(this,vn,"f").setNeighbourhoodClient($e(this,wa,"f")),$e(this,vn,"f").setAIClient($e(this,Ea,"f")),Rr(this,fs,new Ru($e(this,Yt,"f"),r),"f")}get agent(){return $e(this,us,"f")}get expression(){return $e(this,Sa,"f")}get languages(){return $e(this,ls,"f")}get neighbourhood(){return $e(this,wa,"f")}get perspective(){return $e(this,vn,"f")}get runtime(){return $e(this,fs,"f")}get ai(){return $e(this,Ea,"f")}};Yt=new WeakMap,us=new WeakMap,Sa=new WeakMap,ls=new WeakMap,wa=new WeakMap,vn=new WeakMap,fs=new WeakMap,Ea=new WeakMap;var zu;(function(t){t.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",t.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",t.AgentIsUntrusted="AGENT_IS_UNTRUSTED",t.CapabilityRequested="CAPABILITY_REQUESTED",t.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(zu||(zu={}));var sl=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},cl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},xn=class{constructor(e,r){this.language=e,this.expression=r}};sl([y(),cl("design:type",er)],xn.prototype,"language",void 0);sl([y(),cl("design:type",String)],xn.prototype,"expression",void 0);xn=sl([W(),cl("design:paramtypes",[er,String])],xn);function pk(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function dk(t){if(t.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=t.substring(10);return new xn(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new er;return s.address=a,new xn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new er;return a.address="did",new xn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Tt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},or=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Cs=class{};Tt([y(),or("design:type",String)],Cs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Cs.prototype,"type",void 0);Cs=Tt([W()],Cs);var qa=class{};Tt([y(),or("design:type",String)],qa.prototype,"label",void 0);Tt([y(),or("design:type",String)],qa.prototype,"name",void 0);Tt([y(),or("design:type",Array)],qa.prototype,"parameters",void 0);qa=Tt([W()],qa);var Rs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Tt([y(),or("design:type",String)],Rs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Rs.prototype,"parametersStringified",void 0);Rs=Tt([ze(),or("design:paramtypes",[String,Object])],Rs);var Ps=class{};Tt([y(),or("design:type",String)],Ps.prototype,"did",void 0);Tt([y(),or("design:type",Dn)],Ps.prototype,"status",void 0);Ps=Tt([W()],Ps);var fd=class{},Vn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Li=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kr=class{};Vn([y(),Li("design:type",String)],Kr.prototype,"name",void 0);Vn([y(),Li("design:type",String)],Kr.prototype,"address",void 0);Vn([y(),Li("design:type",String)],Kr.prototype,"settings",void 0);Vn([y(),Li("design:type",kn)],Kr.prototype,"icon",void 0);Vn([y(),Li("design:type",kn)],Kr.prototype,"constructorIcon",void 0);Vn([y(),Li("design:type",kn)],Kr.prototype,"settingsIcon",void 0);Kr=Vn([W()],Kr);var ut=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},yt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},qt=class{};ut([y(),yt("design:type",String)],qt.prototype,"name",void 0);ut([y(),yt("design:type",String)],qt.prototype,"address",void 0);ut([y(),yt("design:type",String)],qt.prototype,"description",void 0);ut([y(),yt("design:type",String)],qt.prototype,"author",void 0);ut([y(),yt("design:type",Boolean)],qt.prototype,"templated",void 0);ut([y(),yt("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ut([y(),yt("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ut([y(),yt("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ut([y(),yt("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ut([W()],qt);var Ii=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ut([y(),yt("design:type",String)],Ii.prototype,"name",void 0);ut([y(),yt("design:type",String)],Ii.prototype,"description",void 0);ut([y(),yt("design:type",Array)],Ii.prototype,"possibleTemplateParams",void 0);ut([y(),yt("design:type",String)],Ii.prototype,"sourceCodeLink",void 0);Ii=ut([ze(),yt("design:paramtypes",[String,String])],Ii);var pd=class{},dd=class extends Yr(){},hd=class{},Vs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ul=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ls=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Vs([y(),ul("design:type",String)],Ls.prototype,"linkLanguage",void 0);Vs([y(),ul("design:type",nr)],Ls.prototype,"meta",void 0);Ls=Vs([W(),ul("design:paramtypes",[String,nr])],Ls);var Wu=class extends Yr(){};Wu=Vs([W()],Wu);var Qn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},zn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gu;(function(t){t.Private="PRIVATE",t.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",t.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",t.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",t.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",t.Synced="SYNCED"})(Gu||(Gu={}));var Hr=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=Gu.Private}};Qn([y(),zn("design:type",String)],Hr.prototype,"uuid",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"name",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"state",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"sharedUrl",void 0);Qn([y(),zn("design:type",Wu)],Hr.prototype,"neighbourhood",void 0);Qn([y(),zn("design:type",Array)],Hr.prototype,"owners",void 0);Hr=Qn([W(),zn("design:paramtypes",[String,String,String])],Hr);var Qs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Th=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Fs=class{};Qs([y(),Th("design:type",Array)],Fs.prototype,"additions",void 0);Qs([y(),Th("design:type",Array)],Fs.prototype,"removals",void 0);Fs=Qs([W()],Fs);var md=class extends Yr(){};md=Qs([W()],md);var yd=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},hi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},xa,bn,Ho="smart_literal://content";function j_(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var Ba=class{constructor(e,r){xa.set(this,void 0),bn.set(this,void 0),yd(this,xa,e,"f"),yd(this,bn,r,"f")}get base(){return hi(this,bn,"f")}static async create(e,r){let n=Ze.from(j_(10)).toUrl(),i=new Ba(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Ye({source:r,predicate:Ho}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Ye({predicate:Ho}))).map(n=>new Ba(e,n.data.source))}async get(){let e=await hi(this,xa,"f").getSingleTarget(new Ye({source:hi(this,bn,"f"),predicate:Ho}));if(!e)throw`No content for smart literal ${hi(this,bn,"f")}`;return Ze.fromUrl(e).get()}async set(e){let r=Ze.from(e);await hi(this,xa,"f").setSingleTarget(new On({source:hi(this,bn,"f"),predicate:Ho,target:r.toUrl()}))}};xa=new WeakMap,bn=new WeakMap;var gd=class{};function Ik(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function kk(t){return`triple(this, "${t}", _)`}function Ak(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(t&&t.where)for(let l in t.where){let d=t.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}t&&t.condition&&(c+=", "+t.condition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let p=d.Instance,f=new bi(a,p,s);await f.init(),o.push(f)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(t&&t.where){let l=[];for(let d of u){let p=!0;for(let f in t.where){let h=t.where[f];if(await d[f]!==h){p=!1;break}}p&&l.push(d)}return l}return u}}}function Ih(t){return function(e,r){if(typeof t.writable>"u"&&t.through&&(t.writable=!0),t.required&&!t.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!t.through&&!t.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},t.writable){let n=r;e[`set${Ur(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Ok(t){return function(e,r){if(!t.through&&!t.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!t.through)throw new Error("SubjectFlag requires a 'through' option");if(!t.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],through:t.through,required:!0,initial:t.value,flag:!0},e[r]=t.value,Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Dk(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${Ur(n)}`]=()=>{},e[`remove${Ur(n)}`]=()=>{},e[`setCollection${Ur(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function kh(t){let e="",r="abcdefghijklmnopqrstuvwxyz",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function U_(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",n=t.name,i=e.prototype,a=kh(8);r+=`subject_class("${n}", ${a}).
902
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};je=new WeakMap,cs=new WeakMap;var Rr=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Me=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yt,us,wa,ls,Ea,vn,fs,xa,qa=class{constructor(e,r=!0){Yt.set(this,void 0),us.set(this,void 0),wa.set(this,void 0),ls.set(this,void 0),Ea.set(this,void 0),vn.set(this,void 0),fs.set(this,void 0),xa.set(this,void 0),Rr(this,Yt,e,"f"),Rr(this,us,new Ca(Me(this,Yt,"f"),r),"f"),Rr(this,wa,new Pu(Me(this,Yt,"f")),"f"),Rr(this,ls,new Nu(Me(this,Yt,"f")),"f"),Rr(this,Ea,new Cu(Me(this,Yt,"f")),"f"),Rr(this,xa,new Qu(Me(this,Yt,"f"),r),"f"),Rr(this,vn,new Is(Me(this,Yt,"f"),r),"f"),Me(this,vn,"f").setExpressionClient(Me(this,wa,"f")),Me(this,vn,"f").setNeighbourhoodClient(Me(this,Ea,"f")),Me(this,vn,"f").setAIClient(Me(this,xa,"f")),Rr(this,fs,new Ru(Me(this,Yt,"f"),r),"f")}get agent(){return Me(this,us,"f")}get expression(){return Me(this,wa,"f")}get languages(){return Me(this,ls,"f")}get neighbourhood(){return Me(this,Ea,"f")}get perspective(){return Me(this,vn,"f")}get runtime(){return Me(this,fs,"f")}get ai(){return Me(this,xa,"f")}};Yt=new WeakMap,us=new WeakMap,wa=new WeakMap,ls=new WeakMap,Ea=new WeakMap,vn=new WeakMap,fs=new WeakMap,xa=new WeakMap;var zu;(function(t){t.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",t.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",t.AgentIsUntrusted="AGENT_IS_UNTRUSTED",t.CapabilityRequested="CAPABILITY_REQUESTED",t.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(zu||(zu={}));var sl=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},cl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},xn=class{constructor(e,r){this.language=e,this.expression=r}};sl([y(),cl("design:type",er)],xn.prototype,"language",void 0);sl([y(),cl("design:type",String)],xn.prototype,"expression",void 0);xn=sl([G(),cl("design:paramtypes",[er,String])],xn);function pk(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function dk(t){if(t.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=t.substring(10);return new xn(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new er;return s.address=a,new xn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new er;return a.address="did",new xn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Tt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},or=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Cs=class{};Tt([y(),or("design:type",String)],Cs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Cs.prototype,"type",void 0);Cs=Tt([G()],Cs);var Ba=class{};Tt([y(),or("design:type",String)],Ba.prototype,"label",void 0);Tt([y(),or("design:type",String)],Ba.prototype,"name",void 0);Tt([y(),or("design:type",Array)],Ba.prototype,"parameters",void 0);Ba=Tt([G()],Ba);var Rs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Tt([y(),or("design:type",String)],Rs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Rs.prototype,"parametersStringified",void 0);Rs=Tt([ze(),or("design:paramtypes",[String,Object])],Rs);var Ps=class{};Tt([y(),or("design:type",String)],Ps.prototype,"did",void 0);Tt([y(),or("design:type",Dn)],Ps.prototype,"status",void 0);Ps=Tt([G()],Ps);var fd=class{},Vn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Fi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kr=class{};Vn([y(),Fi("design:type",String)],Kr.prototype,"name",void 0);Vn([y(),Fi("design:type",String)],Kr.prototype,"address",void 0);Vn([y(),Fi("design:type",String)],Kr.prototype,"settings",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"icon",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"constructorIcon",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"settingsIcon",void 0);Kr=Vn([G()],Kr);var ut=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},yt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},qt=class{};ut([y(),yt("design:type",String)],qt.prototype,"name",void 0);ut([y(),yt("design:type",String)],qt.prototype,"address",void 0);ut([y(),yt("design:type",String)],qt.prototype,"description",void 0);ut([y(),yt("design:type",String)],qt.prototype,"author",void 0);ut([y(),yt("design:type",Boolean)],qt.prototype,"templated",void 0);ut([y(),yt("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ut([y(),yt("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ut([y(),yt("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ut([y(),yt("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ut([G()],qt);var Ii=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ut([y(),yt("design:type",String)],Ii.prototype,"name",void 0);ut([y(),yt("design:type",String)],Ii.prototype,"description",void 0);ut([y(),yt("design:type",Array)],Ii.prototype,"possibleTemplateParams",void 0);ut([y(),yt("design:type",String)],Ii.prototype,"sourceCodeLink",void 0);Ii=ut([ze(),yt("design:paramtypes",[String,String])],Ii);var pd=class{},dd=class extends Yr(){},hd=class{},Vs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ul=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Fs=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Vs([y(),ul("design:type",String)],Fs.prototype,"linkLanguage",void 0);Vs([y(),ul("design:type",nr)],Fs.prototype,"meta",void 0);Fs=Vs([G(),ul("design:paramtypes",[String,nr])],Fs);var Gu=class extends Yr(){};Gu=Vs([G()],Gu);var Qn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},zn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Wu;(function(t){t.Private="PRIVATE",t.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",t.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",t.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",t.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",t.Synced="SYNCED"})(Wu||(Wu={}));var Hr=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=Wu.Private}};Qn([y(),zn("design:type",String)],Hr.prototype,"uuid",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"name",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"state",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"sharedUrl",void 0);Qn([y(),zn("design:type",Gu)],Hr.prototype,"neighbourhood",void 0);Qn([y(),zn("design:type",Array)],Hr.prototype,"owners",void 0);Hr=Qn([G(),zn("design:paramtypes",[String,String,String])],Hr);var Qs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Th=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ls=class{};Qs([y(),Th("design:type",Array)],Ls.prototype,"additions",void 0);Qs([y(),Th("design:type",Array)],Ls.prototype,"removals",void 0);Ls=Qs([G()],Ls);var md=class extends Yr(){};md=Qs([G()],md);var yd=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},hi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ta,bn,Ho="smart_literal://content";function j_(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var Va=class{constructor(e,r){Ta.set(this,void 0),bn.set(this,void 0),yd(this,Ta,e,"f"),yd(this,bn,r,"f")}get base(){return hi(this,bn,"f")}static async create(e,r){let n=Ze.from(j_(10)).toUrl(),i=new Va(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Ye({source:r,predicate:Ho}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Ye({predicate:Ho}))).map(n=>new Va(e,n.data.source))}async get(){let e=await hi(this,Ta,"f").getSingleTarget(new Ye({source:hi(this,bn,"f"),predicate:Ho}));if(!e)throw`No content for smart literal ${hi(this,bn,"f")}`;return Ze.fromUrl(e).get()}async set(e){let r=Ze.from(e);await hi(this,Ta,"f").setSingleTarget(new On({source:hi(this,bn,"f"),predicate:Ho,target:r.toUrl()}))}};Ta=new WeakMap,bn=new WeakMap;var gd=class{};function Ik(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function kk(t){return`triple(this, "${t}", _)`}function Ak(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(t&&t.where)for(let l in t.where){let d=t.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}t&&t.condition&&(c+=", "+t.condition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let p=d.Instance,f=new bi(a,p,s);await f.init(),o.push(f)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(t&&t.where){let l=[];for(let d of u){let p=!0;for(let f in t.where){let h=t.where[f];if(await d[f]!==h){p=!1;break}}p&&l.push(d)}return l}return u}}}function Ih(t){return function(e,r){if(typeof t.writable>"u"&&t.through&&(t.writable=!0),t.required&&!t.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!t.through&&!t.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},t.writable){let n=r;e[`set${Ur(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Ok(t){return function(e,r){if(!t.through&&!t.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!t.through)throw new Error("SubjectFlag requires a 'through' option");if(!t.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],through:t.through,required:!0,initial:t.value,flag:!0},e[r]=t.value,Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Dk(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${Ur(n)}`]=()=>{},e[`remove${Ur(n)}`]=()=>{},e[`setCollection${Ur(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function kh(t){let e="",r="abcdefghijklmnopqrstuvwxyz",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function U_(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",n=t.name,i=e.prototype,a=kh(8);r+=`subject_class("${n}", ${a}).
903
903
  `;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=i.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
904
- `,{through:g,initial:w,required:b,resolveLanguage:S,writable:_,flag:A,getter:R,setter:I,local:C}=l[h];if(S&&(m+=`property_resolve(${a}, "${h}").
905
- `,m+=`property_resolve_language(${a}, "${h}", "${S}").
904
+ `,{through:g,initial:_,required:S,resolveLanguage:w,writable:b,flag:A,getter:R,setter:E,local:C}=l[h];if(w&&(m+=`property_resolve(${a}, "${h}").
905
+ `,m+=`property_resolve_language(${a}, "${h}", "${w}").
906
906
  `),R?m+=`property_getter(${a}, Base, "${h}", Value) :- ${R}.
907
907
  `:g&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${g}", Value).
908
- `,b&&(A?c.push(`triple(Base, "${g}", "${w}")`):c.push(`triple(Base, "${g}", _)`))),I)m+=`property_setter(${a}, "${h}", Actions) :- ${I}.
909
- `;else if(_&&g&&typeof i[Zu(h)]=="function"){let L=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...C&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${fn(L)}').
910
- `}u.push(m),w&&(s.push({action:"addLink",source:"this",predicate:g,target:w}),o.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let d=[],p=i.__collections||{};for(let h in p){let m=`collection(${a}, "${h}").
911
- `,{through:g,where:w,local:b}=p[h];if(g){if(w){if(!w.isInstance&&!w.condition)throw"'where' needs one of 'isInstance' or 'condition'";let R=[];if(w.isInstance){let C;w.isInstance.name?C=w.isInstance.name:C=w.isInstance,R.push(`instance(OtherClass, Target), subject_class("${C}", OtherClass)`)}w.condition&&R.push(w.condition);let I=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${g}", Target), ${I}), List).
908
+ `,S&&(A?c.push(`triple(Base, "${g}", "${_}")`):c.push(`triple(Base, "${g}", _)`))),E)m+=`property_setter(${a}, "${h}", Actions) :- ${E}.
909
+ `;else if(b&&g&&typeof i[Zu(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...C&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${fn(P)}').
910
+ `}u.push(m),_&&(s.push({action:"addLink",source:"this",predicate:g,target:_}),o.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let d=[],p=i.__collections||{};for(let h in p){let m=`collection(${a}, "${h}").
911
+ `,{through:g,where:_,local:S}=p[h];if(g){if(_){if(!_.isInstance&&!_.condition)throw"'where' needs one of 'isInstance' or 'condition'";let R=[];if(_.isInstance){let C;_.isInstance.name?C=_.isInstance.name:C=_.isInstance,R.push(`instance(OtherClass, Target), subject_class("${C}", OtherClass)`)}_.condition&&R.push(_.condition);let E=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${g}", Target), ${E}), List).
912
912
  `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${g}", C), List).
913
- `;let S=[{action:"addLink",source:"this",predicate:g,target:"value",...b&&{local:!0}}],_=[{action:"removeLink",source:"this",predicate:g,target:"value"}],A=[{action:"collectionSetter",source:"this",predicate:g,target:"value",...b&&{local:!0}}];m+=`collection_adder(${a}, "${vi(h)}", '${fn(S)}').
914
- `,m+=`collection_remover(${a}, "${vi(h)}", '${fn(_)}').
913
+ `;let w=[{action:"addLink",source:"this",predicate:g,target:"value",...S&&{local:!0}}],b=[{action:"removeLink",source:"this",predicate:g,target:"value"}],A=[{action:"collectionSetter",source:"this",predicate:g,target:"value",...S&&{local:!0}}];m+=`collection_adder(${a}, "${vi(h)}", '${fn(w)}').
914
+ `,m+=`collection_remover(${a}, "${vi(h)}", '${fn(b)}').
915
915
  `,m+=`collection_setter(${a}, "${vi(h)}", '${fn(A)}').
916
916
  `}d.push(m)}let f=fn(s);if(r+=`constructor(${a}, '${f}').
917
917
  `,c.length>0){let h=c.join(", ");r+=`instance(${a}, Base) :- ${h}.
@@ -1507,7 +1507,7 @@ input VoiceActivityParamsInput {
1507
1507
  startWindow: Float
1508
1508
  timeBeforeSpeech: Float
1509
1509
  }
1510
- `,N=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},v=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},J=function(t,e){return function(r,n){e(r,n,t)}},Ka=new Qr;Ka.author="did:ad4m:test";Ka.timestamp=Date.now();Ka.data={source:"root",target:"neighbourhood://Qm12345"};Ka.proof={signature:"",key:"",valid:!0};var Mr=new Dn;Mr.author="did:ad4m:test";Mr.timestamp=Date.now().toString();Mr.proof=new vr("","");Mr.data=new nr([Ka]);var $s=class{};N([y(),v("design:type",String)],$s.prototype,"recipient",void 0);N([y(),v("design:type",Dn)],$s.prototype,"message",void 0);$s=N([W()],$s);var ki=class{};N([y(),v("design:type",String)],ki.prototype,"ad4mExecutorVersion",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isInitialized",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isUnlocked",void 0);ki=N([W()],ki);var Fn=class{};N([y(),v("design:type",String)],Fn.prototype,"title",void 0);N([y(),v("design:type",String)],Fn.prototype,"message",void 0);N([y(),v("design:type",String)],Fn.prototype,"type",void 0);N([y(),v("design:type",String)],Fn.prototype,"addon",void 0);Fn=N([W()],Fn);var Pt=class{};N([y(),v("design:type",String)],Pt.prototype,"description",void 0);N([y(),v("design:type",String)],Pt.prototype,"appName",void 0);N([y(),v("design:type",String)],Pt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],Pt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=N([ze()],Pt);var wt=class{};N([y(),v("design:type",String)],wt.prototype,"id",void 0);N([y(),v("design:type",Boolean)],wt.prototype,"granted",void 0);N([y(),v("design:type",String)],wt.prototype,"description",void 0);N([y(),v("design:type",String)],wt.prototype,"appName",void 0);N([y(),v("design:type",String)],wt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],wt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],wt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],wt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],wt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],wt.prototype,"webhookAuth",void 0);wt=N([W()],wt);var Ai=class{};N([y(),v("design:type",wt)],Ai.prototype,"notification",void 0);N([y(),v("design:type",String)],Ai.prototype,"perspectiveId",void 0);N([y(),v("design:type",String)],Ai.prototype,"triggerMatch",void 0);Ai=N([W()],Ai);var Qe=class{};N([y(),v("design:type",Number)],Qe.prototype,"total",void 0);N([y(),v("design:type",Number)],Qe.prototype,"imported",void 0);N([y(),v("design:type",Number)],Qe.prototype,"failed",void 0);N([y(),v("design:type",Number)],Qe.prototype,"omitted",void 0);N([y(),v("design:type",Array)],Qe.prototype,"errors",void 0);Qe=N([W()],Qe);var Et=class{};N([y(),v("design:type",Qe)],Et.prototype,"perspectives",void 0);N([y(),v("design:type",Qe)],Et.prototype,"links",void 0);N([y(),v("design:type",Qe)],Et.prototype,"expressions",void 0);N([y(),v("design:type",Qe)],Et.prototype,"perspectiveDiffs",void 0);N([y(),v("design:type",Qe)],Et.prototype,"notifications",void 0);N([y(),v("design:type",Qe)],Et.prototype,"models",void 0);N([y(),v("design:type",Qe)],Et.prototype,"defaultModels",void 0);N([y(),v("design:type",Qe)],Et.prototype,"tasks",void 0);N([y(),v("design:type",Qe)],Et.prototype,"friends",void 0);N([y(),v("design:type",Qe)],Et.prototype,"trustedAgents",void 0);N([y(),v("design:type",Qe)],Et.prototype,"knownLinkLanguages",void 0);Et=N([W()],Et);var Oi=class{};N([y(),v("design:type",String)],Oi.prototype,"email",void 0);N([y(),v("design:type",String)],Oi.prototype,"did",void 0);N([y(),v("design:type",String)],Oi.prototype,"lastSeen",void 0);N([y(),v("design:type",Number)],Oi.prototype,"perspectiveCount",void 0);Oi=N([W()],Oi);var $n=class{};N([y(),v("design:type",Boolean)],$n.prototype,"success",void 0);N([y(),v("design:type",String)],$n.prototype,"message",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"requiresPassword",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"isExistingUser",void 0);$n=N([W()],$n);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,r,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Mr}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[Mr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Mr}]}runtimeMessageReceived(){return Mr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:zu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,r){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,r){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,r){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,r,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,r,n){return new Nn("did:key:test123",!0)}runtimeLoginUser(e,r){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,r,n){return!0}};N([he(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeQuit",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeOpenLink",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ki)],q.prototype,"runtimeInfo",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"addTrustedAgents",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"deleteTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],q.prototype,"getTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],q.prototype,"runtimeKnownLinkLanguageTemplates",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],q.prototype,"runtimeFriends",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"runtimeAddFriends",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],q.prototype,"runtimeRemoveFriends",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],q.prototype,"runtimeHcAgentInfos",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],q.prototype,"runtimeGetNetworkMetrics",null);N([he(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeRestartHolochain",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],q.prototype,"runtimeHcAddAgentInfos",null);N([xt(),J(0,H()),J(1,H()),J(2,H()),J(3,H()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],q.prototype,"runtimeVerifyStringSignedByDid",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[nr]),v("design:returntype",Boolean)],q.prototype,"runtimeSetStatus",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Dn)],q.prototype,"runtimeFriendStatus",null);N([he(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Ss]),v("design:returntype",Boolean)],q.prototype,"runtimeFriendSendMessage",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],q.prototype,"runtimeMessageInbox",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],q.prototype,"runtimeMessageOutbox",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Dn)],q.prototype,"runtimeMessageReceived",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Fn)],q.prototype,"exceptionOccurred",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Pt]),v("design:returntype",String)],q.prototype,"runtimeRequestInstallNotification",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],q.prototype,"runtimeNotifications",null);N([he(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Pt]),v("design:returntype",Boolean)],q.prototype,"runtimeUpdateNotification",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeRemoveNotification",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeGrantNotification",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ai)],q.prototype,"runtimeNotificationTriggered",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeExportDb",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeImportDb",null);N([he(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],q.prototype,"runtimeExportPerspective",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeImportPerspective",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeMultiUserEnabled",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],q.prototype,"runtimeSetMultiUserEnabled",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],q.prototype,"runtimeListUsers",null);N([he(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,ir]),v("design:returntype",$n)],q.prototype,"runtimeRequestLoginVerification",null);N([he(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],q.prototype,"runtimeVerifyEmailCode",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],q.prototype,"runtimeTestEmail",null);N([he(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,ir]),v("design:returntype",Nn)],q.prototype,"runtimeCreateUser",null);N([he(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],q.prototype,"runtimeLoginUser",null);N([he(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeEnable",null);N([he(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeDisable",null);N([he(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],q.prototype,"runtimeEmailTestGetCode",null);N([he(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],q.prototype,"runtimeEmailTestClearCodes",null);N([he(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],q.prototype,"runtimeEmailTestSetExpiry",null);q=N([bg()],q);var aa=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ye=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},st,ps,ds,Be;function hs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function vd(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function bd(){return`
1510
+ `,N=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},v=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},J=function(t,e){return function(r,n){e(r,n,t)}},Ha=new Qr;Ha.author="did:ad4m:test";Ha.timestamp=Date.now();Ha.data={source:"root",target:"neighbourhood://Qm12345"};Ha.proof={signature:"",key:"",valid:!0};var Mr=new Dn;Mr.author="did:ad4m:test";Mr.timestamp=Date.now().toString();Mr.proof=new vr("","");Mr.data=new nr([Ha]);var $s=class{};N([y(),v("design:type",String)],$s.prototype,"recipient",void 0);N([y(),v("design:type",Dn)],$s.prototype,"message",void 0);$s=N([G()],$s);var ki=class{};N([y(),v("design:type",String)],ki.prototype,"ad4mExecutorVersion",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isInitialized",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isUnlocked",void 0);ki=N([G()],ki);var Ln=class{};N([y(),v("design:type",String)],Ln.prototype,"title",void 0);N([y(),v("design:type",String)],Ln.prototype,"message",void 0);N([y(),v("design:type",String)],Ln.prototype,"type",void 0);N([y(),v("design:type",String)],Ln.prototype,"addon",void 0);Ln=N([G()],Ln);var Pt=class{};N([y(),v("design:type",String)],Pt.prototype,"description",void 0);N([y(),v("design:type",String)],Pt.prototype,"appName",void 0);N([y(),v("design:type",String)],Pt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],Pt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=N([ze()],Pt);var wt=class{};N([y(),v("design:type",String)],wt.prototype,"id",void 0);N([y(),v("design:type",Boolean)],wt.prototype,"granted",void 0);N([y(),v("design:type",String)],wt.prototype,"description",void 0);N([y(),v("design:type",String)],wt.prototype,"appName",void 0);N([y(),v("design:type",String)],wt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],wt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],wt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],wt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],wt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],wt.prototype,"webhookAuth",void 0);wt=N([G()],wt);var Ai=class{};N([y(),v("design:type",wt)],Ai.prototype,"notification",void 0);N([y(),v("design:type",String)],Ai.prototype,"perspectiveId",void 0);N([y(),v("design:type",String)],Ai.prototype,"triggerMatch",void 0);Ai=N([G()],Ai);var Qe=class{};N([y(),v("design:type",Number)],Qe.prototype,"total",void 0);N([y(),v("design:type",Number)],Qe.prototype,"imported",void 0);N([y(),v("design:type",Number)],Qe.prototype,"failed",void 0);N([y(),v("design:type",Number)],Qe.prototype,"omitted",void 0);N([y(),v("design:type",Array)],Qe.prototype,"errors",void 0);Qe=N([G()],Qe);var Et=class{};N([y(),v("design:type",Qe)],Et.prototype,"perspectives",void 0);N([y(),v("design:type",Qe)],Et.prototype,"links",void 0);N([y(),v("design:type",Qe)],Et.prototype,"expressions",void 0);N([y(),v("design:type",Qe)],Et.prototype,"perspectiveDiffs",void 0);N([y(),v("design:type",Qe)],Et.prototype,"notifications",void 0);N([y(),v("design:type",Qe)],Et.prototype,"models",void 0);N([y(),v("design:type",Qe)],Et.prototype,"defaultModels",void 0);N([y(),v("design:type",Qe)],Et.prototype,"tasks",void 0);N([y(),v("design:type",Qe)],Et.prototype,"friends",void 0);N([y(),v("design:type",Qe)],Et.prototype,"trustedAgents",void 0);N([y(),v("design:type",Qe)],Et.prototype,"knownLinkLanguages",void 0);Et=N([G()],Et);var Oi=class{};N([y(),v("design:type",String)],Oi.prototype,"email",void 0);N([y(),v("design:type",String)],Oi.prototype,"did",void 0);N([y(),v("design:type",String)],Oi.prototype,"lastSeen",void 0);N([y(),v("design:type",Number)],Oi.prototype,"perspectiveCount",void 0);Oi=N([G()],Oi);var $n=class{};N([y(),v("design:type",Boolean)],$n.prototype,"success",void 0);N([y(),v("design:type",String)],$n.prototype,"message",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"requiresPassword",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"isExistingUser",void 0);$n=N([G()],$n);var B=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,r,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Mr}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[Mr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Mr}]}runtimeMessageReceived(){return Mr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:zu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,r){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,r){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,r){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,r,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,r,n){return new Nn("did:key:test123",!0)}runtimeLoginUser(e,r){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,r,n){return!0}};N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeQuit",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeOpenLink",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ki)],B.prototype,"runtimeInfo",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"addTrustedAgents",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"deleteTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"getTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeKnownLinkLanguageTemplates",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeFriends",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeAddFriends",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeRemoveFriends",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],B.prototype,"runtimeHcAgentInfos",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],B.prototype,"runtimeGetNetworkMetrics",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeRestartHolochain",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],B.prototype,"runtimeHcAddAgentInfos",null);N([xt(),J(0,H()),J(1,H()),J(2,H()),J(3,H()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],B.prototype,"runtimeVerifyStringSignedByDid",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[nr]),v("design:returntype",Boolean)],B.prototype,"runtimeSetStatus",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Dn)],B.prototype,"runtimeFriendStatus",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Ss]),v("design:returntype",Boolean)],B.prototype,"runtimeFriendSendMessage",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],B.prototype,"runtimeMessageInbox",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],B.prototype,"runtimeMessageOutbox",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Dn)],B.prototype,"runtimeMessageReceived",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ln)],B.prototype,"exceptionOccurred",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Pt]),v("design:returntype",String)],B.prototype,"runtimeRequestInstallNotification",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeNotifications",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Pt]),v("design:returntype",Boolean)],B.prototype,"runtimeUpdateNotification",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeRemoveNotification",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeGrantNotification",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ai)],B.prototype,"runtimeNotificationTriggered",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeExportDb",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeImportDb",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],B.prototype,"runtimeExportPerspective",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeImportPerspective",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeMultiUserEnabled",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],B.prototype,"runtimeSetMultiUserEnabled",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeListUsers",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,ir]),v("design:returntype",$n)],B.prototype,"runtimeRequestLoginVerification",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],B.prototype,"runtimeVerifyEmailCode",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeTestEmail",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,ir]),v("design:returntype",Nn)],B.prototype,"runtimeCreateUser",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],B.prototype,"runtimeLoginUser",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeEnable",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeDisable",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],B.prototype,"runtimeEmailTestGetCode",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestClearCodes",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestSetExpiry",null);B=N([bg()],B);var oa=function(t,e,r,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"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},de=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},st,ps,ds,Fe;function hs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function vd(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function bd(){return`
1511
1511
  findall(
1512
1512
  [T, A],
1513
1513
  link(Base, _, _, T, A),
@@ -1529,37 +1529,37 @@ input VoiceActivityParamsInput {
1529
1529
  collection(SubjectClass, CollectionName),
1530
1530
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1531
1531
  ), Collections)
1532
- `}function _d(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,n])=>{let i=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=hs(r);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:p}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${r}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${r} >= ${c[0]}, Value${r} =< ${c[1]}`;let f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:p,symbol:">="}];for(let{value:h,symbol:m}of f)if(h!==void 0)return i?`${o} ${m} ${h}`:`${a}, Value${r} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function Sd(t){return t?"length(UnsortedInstances, TotalCount)":""}function wd(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function Ed(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function xd(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function Td(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}else return t.replace(/\/+$/,"")}function ll(t){if(!!t){if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t.find(r=>r!=="null")||t[0]}}function Ah(t,e){return ll(t.type)===e}function Id(t){return Ah(t,"array")}function kd(t){return Ah(t,"object")}function V_(t){let e=ll(t.type);return e==="number"||e==="integer"}var Tn=class{static async getClassName(e){if(this===Tn)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]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let r=e.className,n={},i=e.__properties||{};for(let[l,d]of Object.entries(i)){let p=d;n[l]={name:l,predicate:p.through||"",required:p.required||!1,writable:p.writable||!1,...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.getter!==void 0&&{getter:p.getter},...p.setter!==void 0&&{setter:p.setter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=e.__collections||{};for(let[l,d]of Object.entries(o)){let p=d;a[l]={name:l,predicate:p.through||"",...p.where!==void 0&&{where:p.where},...p.local!==void 0&&{local:p.local}}}let s=Object.keys(n).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let l=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(l.properties)for(let[p,f]of Object.entries(l.properties)){let h=Id(f),m=this.determinePredicate(l,p,f,this.determineNamespace(l,d),d);if(h)a[p]={name:p,predicate:m,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let g=l.required?.includes(p)||!1;n[p]={name:p,predicate:m,required:g,writable:f["x-ad4m"]?.writable!==!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:r,properties:n,collections:a}}constructor(e,r,n){st.set(this,void 0),ps.set(this,void 0),ds.set(this,void 0),Be.set(this,void 0),aa(this,st,r||Ze.from(kh(24)).toUrl(),"f"),aa(this,Be,e,"f"),aa(this,ds,n||"ad4m://self","f")}get baseExpression(){return ye(this,st,"f")}get perspective(){return ye(this,Be,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,r){if(r.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(r.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!r.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}generateCollectionAction(e,r){let n=this.getCollectionMetadata(e);if(!n)throw new Error(`Collection "${e}" has no metadata defined`);if(!n.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[r],source:"this",predicate:n.through,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,r,n){let i=Object.fromEntries(await Promise.all(n.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let l=Array.from(o,f=>f.codePointAt(0)),d=l.every(f=>f<=255),p=l.some(f=>f>=128);if(d&&p)try{let f=Uint8Array.from(l),h=new TextDecoder("utf-8",{fatal:!0}).decode(f);h!==o&&(c=h)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:f})}}if(s){let l=await e.getExpression(o);if(l)try{c=JSON.parse(l.data)}catch{c=l.data}}let u=r.__properties?.[a]?.transform;return u&&typeof u=="function"&&(c=u(c)),[a,c]})));Object.assign(r,i)}async getData(){try{let e=this.constructor,r=e.getModelMetadata(),i=`
1532
+ `}function _d(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,n])=>{let i=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=hs(r);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:p}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${r}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${r} >= ${c[0]}, Value${r} =< ${c[1]}`;let f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:p,symbol:">="}];for(let{value:h,symbol:m}of f)if(h!==void 0)return i?`${o} ${m} ${h}`:`${a}, Value${r} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function Sd(t){return t?"length(UnsortedInstances, TotalCount)":""}function wd(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function Ed(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function xd(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function Td(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}else return t.replace(/\/+$/,"")}function ll(t){if(!!t){if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t.find(r=>r!=="null")||t[0]}}function Ah(t,e){return ll(t.type)===e}function Id(t){return Ah(t,"array")}function kd(t){return Ah(t,"object")}function V_(t){let e=ll(t.type);return e==="number"||e==="integer"}var Tn=class{static async getClassName(e){if(this===Tn)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 @ModelOptions");let r=e.className,n={},i=e.__properties||{};for(let[l,d]of Object.entries(i)){let p=d;n[l]={name:l,predicate:p.through||"",required:p.required||!1,writable:p.writable||!1,...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.getter!==void 0&&{getter:p.getter},...p.surrealGetter!==void 0&&{surrealGetter:p.surrealGetter},...p.setter!==void 0&&{setter:p.setter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=e.__collections||{};for(let[l,d]of Object.entries(o)){let p=d;a[l]={name:l,predicate:p.through||"",...p.where!==void 0&&{where:p.where},...p.local!==void 0&&{local:p.local},...p.surrealGetter!==void 0&&{surrealGetter:p.surrealGetter}}}let s=Object.keys(n).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let l=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(l.properties)for(let[p,f]of Object.entries(l.properties)){let h=Id(f),m=this.determinePredicate(l,p,f,this.determineNamespace(l,d),d);if(h)a[p]={name:p,predicate:m,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let g=l.required?.includes(p)||!1;n[p]={name:p,predicate:m,required:g,writable:f["x-ad4m"]?.writable!==!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:r,properties:n,collections:a}}constructor(e,r,n){st.set(this,void 0),ps.set(this,void 0),ds.set(this,void 0),Fe.set(this,void 0),oa(this,st,r||Ze.from(kh(24)).toUrl(),"f"),oa(this,Fe,e,"f"),oa(this,ds,n||"ad4m://self","f")}get baseExpression(){return de(this,st,"f")}get perspective(){return de(this,Fe,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,r){if(r.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(r.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!r.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}generateCollectionAction(e,r){let n=this.getCollectionMetadata(e);if(!n)throw new Error(`Collection "${e}" has no metadata defined`);if(!n.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[r],source:"this",predicate:n.through,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,r,n){let i=Object.fromEntries(await Promise.all(n.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let l=Array.from(o,f=>f.codePointAt(0)),d=l.every(f=>f<=255),p=l.some(f=>f>=128);if(d&&p)try{let f=Uint8Array.from(l),h=new TextDecoder("utf-8",{fatal:!0}).decode(f);h!==o&&(c=h)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:f})}}if(s){let l=await e.getExpression(o);if(l)try{c=JSON.parse(l.data)}catch{c=l.data}}let u=r.__properties?.[a]?.transform;return u&&typeof u=="function"&&(c=u(c)),[a,c]})));Object.assign(r,i)}async getData(){try{let e=this.constructor,r=e.getModelMetadata(),i=`
1533
1533
  SELECT id, predicate, out.uri AS target, author, timestamp
1534
1534
  FROM link
1535
- WHERE in.uri = ${e.formatSurrealValue(ye(this,st,"f"))}
1535
+ WHERE in.uri = ${e.formatSurrealValue(de(this,st,"f"))}
1536
1536
  ORDER BY timestamp ASC
1537
- `,a=await ye(this,Be,"f").querySurrealDB(i);if(a&&a.length>0){let o=null,s=null;for(let[c,u]of Object.entries(r.properties)){let l=a.filter(d=>d.predicate===u.predicate);if(l.length>0){let d=l[l.length-1],p=d.target;if(d.timestamp&&(!o||d.timestamp>o)&&(o=d.timestamp,s=d.author),u.resolveLanguage&&u.resolveLanguage!=="literal")try{let f=await ye(this,Be,"f").getExpression(p);if(f)try{p=JSON.parse(f.data)}catch{p=f.data}}catch(f){console.warn(`Failed to resolve expression for ${c}:`,f)}else if(typeof p=="string"&&p.startsWith("literal://"))try{let f=Ze.fromUrl(p).get();p=f.data!==void 0?f.data:f}catch{}u.transform&&typeof u.transform=="function"&&(p=u.transform(p)),this[c]=p}}for(let[c,u]of Object.entries(r.collections)){let l=a.filter(d=>d.predicate===u.predicate);this[c]=l.map(d=>d.target)}s&&(this.author=s),o&&(this.timestamp=o)}}catch(e){console.error(`SurrealDB getData also failed for ${ye(this,st,"f")}:`,e)}return this}static async queryToProlog(e,r,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=r,p=n||await this.getClassName(e),f=[bd(),vd(i),q_(a),B_(o),_d(s)],h=[Sd(d),wd(c),Ed(u),xd(l)];return`
1537
+ `,a=await de(this,Fe,"f").querySurrealDB(i);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,d]of Object.entries(r.properties)){if(d.surrealGetter)continue;let p=a.filter(f=>f.predicate===d.predicate);if(p.length>0){let f=p[p.length-1],h=f.target;if(f.timestamp&&((!o||f.timestamp<o)&&(o=f.timestamp,u=f.author),(!s||f.timestamp>s)&&(s=f.timestamp,c=f.author)),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await de(this,Fe,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let m=Ze.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}d.transform&&typeof d.transform=="function"&&(h=d.transform(h)),this[l]=h}}for(let[l,d]of Object.entries(r.collections)){if(d.surrealGetter)continue;let f=a.filter(h=>h.predicate===d.predicate).map(h=>h.target);if(d.where?.isInstance&&f.length>0)try{let h=typeof d.where.isInstance=="string"?d.where.isInstance:d.where.isInstance.name,m=await de(this,Fe,"f").getSubjectClassMetadataFromSDNA(h);m&&(f=await de(this,Fe,"f").batchCheckSubjectInstances(f,m))}catch{}this[l]=f}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateSurrealGettersForInstance(this,de(this,Fe,"f"),r)}catch(e){console.error(`SurrealDB getData also failed for ${de(this,st,"f")}:`,e)}return this}static async queryToProlog(e,r,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=r,p=n||await this.getClassName(e),f=[bd(),vd(i),q_(a),B_(o),_d(s)],h=[Sd(d),wd(c),Ed(u),xd(l)];return`
1538
1538
  findall([Base, Properties, Collections, Timestamp, Author], (
1539
1539
  subject_class("${p}", SubjectClass),
1540
1540
  instance(SubjectClass, Base),
1541
1541
  ${f.filter(g=>g).join(", ")}
1542
1542
  ), UnsortedInstances),
1543
1543
  ${h.filter(g=>g).join(", ")}
1544
- `}static async queryToSurrealQL(e,r){let n=this.getModelMetadata(),{source:i,where:a,order:o,offset:s,limit:c}=r,u=[];i&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(i)} AND predicate = 'ad4m://has_child']) > 0`);for(let[f,h]of Object.entries(n.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`));if(u.length===0){for(let[f,h]of Object.entries(n.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(n,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1544
+ `}static async evaluateSurrealGettersForInstance(e,r,n){let i=this.formatSurrealValue(e.baseExpression);for(let[a,o]of Object.entries(n.properties))if(o.surrealGetter)try{let s=o.surrealGetter.replace(/Base/g,i),c=await r.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null&&c[0].value!=="None"&&c[0].value!==""&&(e[a]=c[0].value)}catch(s){console.warn(`Failed to evaluate surrealGetter for ${a}:`,s)}for(let[a,o]of Object.entries(n.collections))if(o.surrealGetter)try{let s=o.surrealGetter.replace(/Base/g,i),c=await r.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);if(c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null){let u=c[0].value;e[a]=Array.isArray(u)?u.filter(l=>l&&l!==""&&l!=="None"):u}}catch(s){console.warn(`Failed to evaluate surrealGetter for ${a}:`,s)}}static async queryToSurrealQL(e,r){let n=this.getModelMetadata(),{source:i,where:a,order:o,offset:s,limit:c}=r,u=[];i&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(i)} AND predicate = 'ad4m://has_child']) > 0`);for(let[f,h]of Object.entries(n.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`));if(u.length===0){for(let[f,h]of Object.entries(n.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(n,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1545
1545
  SELECT
1546
1546
  id AS source,
1547
1547
  uri AS source_uri,
1548
1548
  ->link[WHERE perspective = $perspective] AS links
1549
1549
  FROM node
1550
1550
  WHERE ${d.join(" AND ")}
1551
- `.trim()}static buildGraphTraversalWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","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 s=e.properties[i];if(!s)continue;let c=we(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${l}]]) > 0`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${p}]]) = 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)}]) = 0`);(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(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","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=we(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).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 p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${p}])`)}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,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(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.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(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 LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),i.join(`,
1552
- `)}static buildSurrealSelectFieldsWithAggregation(e,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(c.predicate);i.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS timestamp"),i.join(`,
1553
- `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(r=>this.formatSurrealValue(r)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,r,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=[...r?.properties||[],...r?.collections||[]];return{results:(await Promise.all(n[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);i.length&&Object.keys(d).forEach(f=>{i.includes(f)||delete d[f]});let p=[...s,...c,["timestamp",u],["author",l]];return await Tn.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:n[0].TotalCount}}static async instancesFromSurrealResult(e,r,n){if(!n||n.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),a=r?.properties||[],o=r?.collections||[],s=[];for(let p of n){let f;try{if(f=p.source_uri,!f)continue;let h=p.links||[],m=new this(e,f),g=null,w=null;for(let b=0;b<h.length;b++){let S=h[b],_=S.predicate,A=S.target;if(A==="None")continue;S.timestamp&&(!g||S.timestamp>g)&&(g=S.timestamp,w=S.author);let R=!1;for(let[I,C]of Object.entries(i.properties))if(C.predicate===_){let F=m[I],L=typeof F=="object"&&F!==null&&!Array.isArray(F)&&Object.keys(F).length===0;if(!F||F===""||F===0||L){let M=A;if(A!=null&&A!==""){if(C.resolveLanguage!=null&&C.resolveLanguage!=="literal"&&typeof A=="string")try{let le=await e.getExpression(A);if(le)try{M=JSON.parse(le.data)}catch{M=le.data}}catch(le){console.warn(`Failed to resolve expression for ${I} with target "${A}":`,le),console.warn("Falling back to raw value"),M=A}else if(typeof A=="string"&&A.startsWith("literal://"))try{let le=Ze.fromUrl(A).get();le.data!==void 0?M=le.data:M=le}catch{M=A}else if(typeof A=="string"){let le=typeof m[I];le==="number"?M=Number(A):le==="boolean"&&(M=A==="true"||A==="1")}}C.transform&&typeof C.transform=="function"&&(M=C.transform(M)),m[I]=M}R=!0;break}if(!R){for(let[I,C]of Object.entries(i.collections))if(C.predicate===_){m[I]||(m[I]=[]);let F=`__${I}_timestamps`,L=`__${I}_indices`;m[F]||(m[F]=[]),m[L]||(m[L]=[]),m[I].includes(A)||(m[I].push(A),m[F].push(S.timestamp||""),m[L].push(b));break}}}if(w&&g)if(m.author=w,typeof g=="string"&&g.includes("T"))m.timestamp=new Date(g).getTime();else if(typeof g=="string"){let b=parseInt(g,10);m.timestamp=isNaN(b)?g:b}else m.timestamp=g;for(let[b,S]of Object.entries(i.collections)){let _=`__${b}_timestamps`,A=`__${b}_indices`;if(m[b]&&m[_]){let R=m[b].map((I,C)=>({value:I,timestamp:m[_][C]||"",originalIndex:m[A]?.[C]??C}));R.sort((I,C)=>{let F=String(I.timestamp||""),L=String(C.timestamp||""),M=F.localeCompare(L);return M!==0?M:I.originalIndex-C.originalIndex}),m[b]=R.map(I=>I.value),delete m[_],delete m[A]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(S=>{!b.includes(S)&&S!=="timestamp"&&S!=="author"&&S!=="baseExpression"&&delete m[S]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${f}:`,h)}}let c=s;r.where&&(c=s.filter(p=>{for(let[f,h]of Object.entries(r.where))if(f!=="base"){if(f==="author"||f==="timestamp"){if(!this.matchesCondition(p[f],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(p[f],h))return!1}}return!0}));let u=r.order||(r.limit!==void 0||r.offset!==void 0?{timestamp:"ASC"}:null);if(u){let p=Object.keys(u)[0],f=Object.values(u)[0];c.sort((h,m)=>{let g=h[p],w=m[p];if(g===void 0&&w===void 0)return 0;if(g===void 0)return f==="ASC"?1:-1;if(w===void 0)return f==="ASC"?-1:1;let b=0;return typeof g=="number"&&typeof w=="number"?b=g-w:typeof g=="string"&&typeof w=="string"?b=g.localeCompare(w):b=String(g).localeCompare(String(w)),f==="DESC"?-b:b})}let l=c.length,d=c;if(r.offset!==void 0||r.limit!==void 0){let p=r.offset||0,f=r.limit?p+r.limit:void 0;d=c.slice(p,f)}return{results:d,totalCount:l}}static matchesCondition(e,r){if(Array.isArray(r))return r.includes(e);if(typeof r=="object"&&r!==null){let n=r;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===r}static async findAll(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{results:o}=await this.instancesFromSurrealResult(e,r,a);return o}else{let i=await this.queryToProlog(e,r),a=await e.infer(i),{results:o}=await this.instancesFromPrologResult(e,r,a);return o}}static async findAllAndCount(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i);return await this.instancesFromSurrealResult(e,r,a)}else{let i=await this.queryToProlog(e,r),a=await e.infer(i);return await this.instancesFromPrologResult(e,r,a)}}static async paginate(e,r,n,i,a=!0){let o={...i||{},limit:r,offset:r*(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:r,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:r,pageNumber:n}}}static async countQueryToProlog(e,r={},n){let{source:i,where:a}=r,o=n||await this.getClassName(e),s=[bd(),vd(i),_d(a)],c=[Sd(!0),wd(),Ed(),xd()];return`
1551
+ `.trim()}static buildGraphTraversalWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","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 s=e.properties[i];if(!s)continue;let c=we(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${l}]]) > 0`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${p}]]) = 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)}]) = 0`);(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(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","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=we(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).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 p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${p}])`)}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,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(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.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(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(`,
1552
+ `)}static buildSurrealSelectFieldsWithAggregation(e,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(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(`,
1553
+ `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(r=>this.formatSurrealValue(r)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,r,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=[...r?.properties||[],...r?.collections||[]];return{results:(await Promise.all(n[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);i.length&&Object.keys(d).forEach(f=>{i.includes(f)||delete d[f]});let p=[...s,...c,["timestamp",u],["author",l]];return await Tn.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:n[0].TotalCount}}static async instancesFromSurrealResult(e,r,n){if(!n||n.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),a=r?.properties||[],o=r?.collections||[],s=[];for(let p of n){let f;try{if(f=p.source_uri,!f)continue;let h=p.links||[],m=new this(e,f),g=null,_=null,S=null,w=null;for(let b=0;b<h.length;b++){let A=h[b],R=A.predicate,E=A.target;if(E==="None")continue;A.timestamp&&((!g||A.timestamp<g)&&(g=A.timestamp,S=A.author),(!_||A.timestamp>_)&&(_=A.timestamp,w=A.author));let C=!1;for(let[F,P]of Object.entries(i.properties))if(!P.surrealGetter&&P.predicate===R){let M=m[F],Ee=typeof M=="object"&&M!==null&&!Array.isArray(M)&&Object.keys(M).length===0;if(!M||M===""||M===0||Ee){let ne=E;if(E!=null&&E!==""){if(P.resolveLanguage!=null&&P.resolveLanguage!=="literal"&&typeof E=="string")try{let j=await e.getExpression(E);if(j)try{ne=JSON.parse(j.data)}catch{ne=j.data}}catch(j){console.warn(`Failed to resolve expression for ${F} with target "${E}":`,j),console.warn("Falling back to raw value"),ne=E}else if(typeof E=="string"&&E.startsWith("literal://"))try{let j=Ze.fromUrl(E).get();j.data!==void 0?ne=j.data:ne=j}catch{ne=E}else if(typeof E=="string"){let j=typeof m[F];j==="number"?ne=Number(E):j==="boolean"&&(ne=E==="true"||E==="1")}}P.transform&&typeof P.transform=="function"&&(ne=P.transform(ne)),m[F]=ne}C=!0;break}if(!C){for(let[F,P]of Object.entries(i.collections))if(!P.surrealGetter&&P.predicate===R){m[F]||(m[F]=[]);let M=`__${F}_timestamps`,Ee=`__${F}_indices`;m[M]||(m[M]=[]),m[Ee]||(m[Ee]=[]),m[F].includes(E)||(m[F].push(E),m[M].push(A.timestamp||""),m[Ee].push(b));break}}}if(S&&(m.author=S),g)if(typeof g=="string"&&g.includes("T"))m.createdAt=new Date(g).getTime();else if(typeof g=="string"){let b=parseInt(g,10);m.createdAt=isNaN(b)?g:b}else m.createdAt=g;if(_)if(typeof _=="string"&&_.includes("T"))m.updatedAt=new Date(_).getTime();else if(typeof _=="string"){let b=parseInt(_,10);m.updatedAt=isNaN(b)?_:b}else m.updatedAt=_;for(let[b,A]of Object.entries(i.collections)){let R=`__${b}_timestamps`,E=`__${b}_indices`;if(m[b]&&m[R]){let C=m[b].map((F,P)=>({value:F,timestamp:m[R][P]||"",originalIndex:m[E]?.[P]??P}));C.sort((F,P)=>{let M=String(F.timestamp||""),Ee=String(P.timestamp||""),ne=M.localeCompare(Ee);return ne!==0?ne:F.originalIndex-P.originalIndex}),m[b]=C.map(F=>F.value).filter(F=>F&&F!==""&&F!=="None"),delete m[R],delete m[E]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(A=>{!b.includes(A)&&A!=="timestamp"&&A!=="author"&&A!=="baseExpression"&&delete m[A]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${f}:`,h)}}for(let p of s)await this.evaluateSurrealGettersForInstance(p,e,i);for(let p of s)for(let[f,h]of Object.entries(i.collections))if(h.where?.isInstance&&p[f]?.length>0)try{let m=h.where.isInstance,g=p[f],_=typeof m=="string"?m:m.prototype?.className||m.name,S=await e.getSubjectClassMetadataFromSDNA(_);if(!S)continue;let w=await e.batchCheckSubjectInstances(g,S);p[f]=w}catch{}for(let p of s)await this.evaluateSurrealGettersForInstance(p,e,i);let c=s;r.where&&(c=s.filter(p=>{for(let[f,h]of Object.entries(r.where))if(f!=="base"){if(f==="author"||f==="timestamp"){if(!this.matchesCondition(p[f],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(p[f],h))return!1}}return!0}));let u=r.order||(r.limit!==void 0||r.offset!==void 0?{timestamp:"ASC"}:null);if(u){let p=Object.keys(u)[0],f=Object.values(u)[0];c.sort((h,m)=>{let g=h[p],_=m[p];if(g===void 0&&_===void 0)return 0;if(g===void 0)return f==="ASC"?1:-1;if(_===void 0)return f==="ASC"?-1:1;let S=0;return typeof g=="number"&&typeof _=="number"?S=g-_:typeof g=="string"&&typeof _=="string"?S=g.localeCompare(_):S=String(g).localeCompare(String(_)),f==="DESC"?-S:S})}let l=c.length,d=c;if(r.offset!==void 0||r.limit!==void 0){let p=r.offset||0,f=r.limit?p+r.limit:void 0;d=c.slice(p,f)}return{results:d,totalCount:l}}static matchesCondition(e,r){if(Array.isArray(r))return r.includes(e);if(typeof r=="object"&&r!==null){let n=r;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===r}static async findAll(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{results:o}=await this.instancesFromSurrealResult(e,r,a);return o}else{let i=await this.queryToProlog(e,r),a=await e.infer(i),{results:o}=await this.instancesFromPrologResult(e,r,a);return o}}static async findAllAndCount(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i);return await this.instancesFromSurrealResult(e,r,a)}else{let i=await this.queryToProlog(e,r),a=await e.infer(i);return await this.instancesFromPrologResult(e,r,a)}}static async paginate(e,r,n,i,a=!0){let o={...i||{},limit:r,offset:r*(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:r,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:r,pageNumber:n}}}static async countQueryToProlog(e,r={},n){let{source:i,where:a}=r,o=n||await this.getClassName(e),s=[bd(),vd(i),_d(a)],c=[Sd(!0),wd(),Ed(),xd()];return`
1554
1554
  findall([Base, Properties, Collections, Timestamp, Author], (
1555
1555
  subject_class("${o}", SubjectClass),
1556
1556
  instance(SubjectClass, Base),
1557
1557
  ${s.filter(l=>l).join(", ")}
1558
1558
  ), UnsortedInstances),
1559
1559
  ${c.filter(l=>l).join(", ")}
1560
- `}static async countQueryToSurrealQL(e,r){let n={...r};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{totalCount:o}=await this.instancesFromSurrealResult(e,r,a);return o}else return(await e.infer(await this.countQueryToProlog(e,r)))?.[0]?.TotalCount||0}async setProperty(e,r,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;o&&(r=await ye(this,Be,"f").createExpression(r,o)),await ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:r}],n)}async setCollectionSetter(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");r!=null&&(Array.isArray(r)?await ye(this,Be,"f").executeAction(a,ye(this,st,"f"),r.map(o=>({name:"value",value:o})),n):await ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:r}],n))}async setCollectionAdder(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:o}],n))):await ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:r}],n))}async setCollectionRemover(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:o}],n))):await ye(this,Be,"f").executeAction(a,ye(this,st,"f"),[{name:"value",value:r}],n))}async save(e){let r=!1;e||(e=await this.perspective.createBatch(),r=!0);let n={};for(let[i,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(n[i]=a);await this.perspective.createSubject(this,ye(this,st,"f"),n,e),await ye(this,Be,"f").add(new On({source:ye(this,ds,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),r&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},r=Object.entries(this);for(let[n,i]of r)i!=null&&n!=="author"&&n!=="timestamp"&&(e[n]=i);return e}async innerUpdate(e=!0,r){aa(this,ps,await ye(this,Be,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let n=Object.entries(this);for(let[i,a]of n)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(i,a.value,r);break;case"adder":await this.setCollectionAdder(i,a.value,r);break;case"remover":await this.setCollectionRemover(i,a.value,r);break;default:await this.setCollectionSetter(i,a.value,r);break}else if(Array.isArray(a))await this.setCollectionSetter(i,a,r);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(i))continue;await this.setProperty(i,a,r)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return aa(this,ps,await ye(this,Be,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await ye(this,Be,"f").removeSubject(this,ye(this,st,"f"),e)}static query(e,r){return new Ku(e,this,r)}static fromJSONSchema(e,r){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,r),i=class extends Tn{};if(!r.name||r.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=r.name,i.prototype.className=r.name;let a={},o={};if(e.properties)for(let[u,l]of Object.entries(e.properties)){let d=this.determinePredicate(e,u,l,n,r),p=e.required?.includes(u)||!1,f=ll(l.type);if(Id(l)){o[u]={through:d,local:this.getPropertyOption(u,l,r,"local")},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${hs(u)}`,g=`remove${hs(u)}`,w=`setCollection${hs(u)}`;i.prototype[m]=function(){},i.prototype[g]=function(){},i.prototype[w]=function(){}}else{let m=this.getPropertyOption(u,l,r,"resolveLanguage");!m&&r.resolveLanguage&&(m=r.resolveLanguage);let g=this.getPropertyOption(u,l,r,"local"),w=this.getPropertyOption(u,l,r,"writable",!0),b=this.getPropertyOption(u,l,r,"initial");if(kd(l)&&!m&&(m="literal",console.warn(`Property "${u}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&V_(l)&&(m="literal"),p&&!b&&(kd(l)?b="literal://json:{}":b="ad4m://undefined"),a[u]={through:d,required:p,writable:w,...m&&{resolveLanguage:m},...g!==void 0&&{local:g},...b&&{initial:b}},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),w){let S=Zu(u);i.prototype[S]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(n.includes("://")){let[d,p]=n.split("://"),f=(p||"").replace(/\/+$/,"");f?l=`${d}://${f}/instance`:l=`${d}://instance`}else l=`${n.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(i.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return i.prototype.__properties=a,i.prototype.__collections=o,i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=r,U_({name:r.name})(i),i}static determineNamespace(e,r){if(r.namespace)return r.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:
1560
+ `}static async countQueryToSurrealQL(e,r){let n={...r};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{totalCount:o}=await this.instancesFromSurrealResult(e,r,a);return o}else return(await e.infer(await this.countQueryToProlog(e,r)))?.[0]?.TotalCount||0}async setProperty(e,r,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;o&&(r=await de(this,Fe,"f").createExpression(r,o)),await de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:r}],n)}async setCollectionSetter(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");r!=null&&(Array.isArray(r)?await de(this,Fe,"f").executeAction(a,de(this,st,"f"),r.map(o=>({name:"value",value:o})),n):await de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:r}],n))}async setCollectionAdder(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:o}],n))):await de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:r}],n))}async setCollectionRemover(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:o}],n))):await de(this,Fe,"f").executeAction(a,de(this,st,"f"),[{name:"value",value:r}],n))}async save(e){let r=!1;e||(e=await this.perspective.createBatch(),r=!0);let n={};for(let[i,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(n[i]=a);await this.perspective.createSubject(this,de(this,st,"f"),n,e),await de(this,Fe,"f").add(new On({source:de(this,ds,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),r&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},r=Object.entries(this);for(let[n,i]of r)i!=null&&n!=="author"&&n!=="timestamp"&&(e[n]=i);return e}async innerUpdate(e=!0,r){oa(this,ps,await de(this,Fe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let n=Object.entries(this);for(let[i,a]of n)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(i,a.value,r);break;case"adder":await this.setCollectionAdder(i,a.value,r);break;case"remover":await this.setCollectionRemover(i,a.value,r);break;default:await this.setCollectionSetter(i,a.value,r);break}else if(Array.isArray(a))await this.setCollectionSetter(i,a,r);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(i))continue;await this.setProperty(i,a,r)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return oa(this,ps,await de(this,Fe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await de(this,Fe,"f").removeSubject(this,de(this,st,"f"),e)}static query(e,r){return new Ku(e,this,r)}static fromJSONSchema(e,r){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,r),i=class extends Tn{};if(!r.name||r.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=r.name,i.prototype.className=r.name;let a={},o={};if(e.properties)for(let[u,l]of Object.entries(e.properties)){let d=this.determinePredicate(e,u,l,n,r),p=e.required?.includes(u)||!1,f=ll(l.type);if(Id(l)){o[u]={through:d,local:this.getPropertyOption(u,l,r,"local")},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${hs(u)}`,g=`remove${hs(u)}`,_=`setCollection${hs(u)}`;i.prototype[m]=function(){},i.prototype[g]=function(){},i.prototype[_]=function(){}}else{let m=this.getPropertyOption(u,l,r,"resolveLanguage");!m&&r.resolveLanguage&&(m=r.resolveLanguage);let g=this.getPropertyOption(u,l,r,"local"),_=this.getPropertyOption(u,l,r,"writable",!0),S=this.getPropertyOption(u,l,r,"initial");if(kd(l)&&!m&&(m="literal",console.warn(`Property "${u}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&V_(l)&&(m="literal"),p&&!S&&(kd(l)?S="literal://json:{}":S="ad4m://undefined"),a[u]={through:d,required:p,writable:_,...m&&{resolveLanguage:m},...g!==void 0&&{local:g},...S&&{initial:S}},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),_){let w=Zu(u);i.prototype[w]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(n.includes("://")){let[d,p]=n.split("://"),f=(p||"").replace(/\/+$/,"");f?l=`${d}://${f}/instance`:l=`${d}://instance`}else l=`${n.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(i.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return i.prototype.__properties=a,i.prototype.__collections=o,i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=r,U_({name:r.name})(i),i}static determineNamespace(e,r){if(r.namespace)return r.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:
1561
1561
  - options.namespace
1562
1562
  - schema["x-ad4m"].namespace
1563
1563
  - schema.title
1564
- - valid schema.$id`)}static determinePredicate(e,r,n,i,a){if(a.propertyMapping?.[r])return a.propertyMapping[r];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=Td(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}",r)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",r);let o=Td(i);return o.includes("://")?`${o}${r}`:`${o}://${r}`}static getPropertyOption(e,r,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:r["x-ad4m"]?.[i]!==void 0?r["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""}}};st=new WeakMap,ps=new WeakMap,ds=new WeakMap,Be=new WeakMap;Tn.classNamesByClass=new WeakMap;var Ku=class{constructor(e,r,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,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}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return n}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);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 r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);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 i}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let n={...this.queryParams||{},limit:e,offset:e*(r-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:r}}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:r}}}async paginateSubscribe(e,r,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(r-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 u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}}};var Q_=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function fl(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of Q_(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var z_=12e3,pl=class extends EventTarget{constructor(r){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;fl(this),this.options=r,this.port=r.port||parseInt(Lo("ad4m-port"))||z_,this.url=r.url||Lo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Lo("ad4m-token")||"",this.embedded=up(),this.embedded&&this.initializeEmbeddedMode()}connect(){return Se(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((r,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"),r(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"),r(this.ad4mClient)):this.ad4mClient&&this.authState!=="authenticated"&&(clearTimeout(i),n(new Error(`Embedded auth state: ${this.authState}`)))});try{return yield lp(this.url),fr("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(r){throw console.error("[Ad4m Connect] Connection failed:",r),this.notifyConnectionChange("error"),r}})}buildClient(){return Se(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=tu({url:this.url,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:r=>{this.activeSocket=r},error:r=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:r=>Se(this,null,function*(){if(!(r.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 Ua(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(r){return new Xc({link:new cp(r),cache:new Ao({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(r,n){return Se(this,null,function*(){let i=tu({url:r,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new Ua(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return Se(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(r){console.error("[Ad4m Connect] Authentication check failed:",r);let n="Cannot extractByTags from a ciphered wallet. You must unlock first.";return r.message===n?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return Se(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="",Fo("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",r=>Se(this,null,function*(){var n;if(((n=r.data)==null?void 0:n.type)==="AD4M_CONFIG"){if(r.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&&(!r.origin||!this.options.allowedOrigins.includes(r.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",r.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${r.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:r.data.port,hasToken:!!r.data.token});let{port:i,token:a}=r.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`,fr("ad4m-port",o.toString()),s?fr("ad4m-token",s):Fo("ad4m-token"),fr("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(r=!1){return Se(this,null,function*(){return r&&(this.token="",Fo("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(r){return Se(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,r);return this.token=n,fr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.info()})),!0}catch(r){return console.error("[Ad4m Connect] Failed to verify AD4M API:",r),!1}})}isMultiUser(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.multiUserEnabled()}))}catch(r){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",r),!1}})}submitEmail(r){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,n=>Se(this,null,function*(){return yield n.agent.requestLoginVerification(r,this.buildAppInfo())}))}catch(n){return{success:!1,message:n.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.verifyEmailCode(r,n,"login")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Email code verification failed:",i),!1}})}loginWithPassword(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.loginUser(r,n)}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){let o=yield a.agent.createUser(r,n);if(o.success)return yield a.agent.loginUser(r,n);throw new Error(o.error||"Failed to create account")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Account creation error:",i),!1}})}resolveEmbedded(r){this.embeddedResolve&&(this.embeddedResolve(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(r){this.embeddedReject&&(this.embeddedReject(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(r){this.connectionState!==r&&(this.connectionState=r,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:r})))}notifyAuthChange(r){if(this.authState!==r&&(this.authState=r,this.dispatchEvent(new CustomEvent("authstatechange",{detail:r})),this.embedded&&(r==="authenticated"&&this.resolveEmbedded(this.ad4mClient),r==="unauthenticated"||r==="locked"))){let n=r==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(n))}}notifyConfigChange(r,n){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:r,value:n}}))}};export{pl as default};
1564
+ - valid schema.$id`)}static determinePredicate(e,r,n,i,a){if(a.propertyMapping?.[r])return a.propertyMapping[r];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=Td(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}",r)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",r);let o=Td(i);return o.includes("://")?`${o}${r}`:`${o}://${r}`}static getPropertyOption(e,r,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:r["x-ad4m"]?.[i]!==void 0?r["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""}}};st=new WeakMap,ps=new WeakMap,ds=new WeakMap,Fe=new WeakMap;Tn.classNamesByClass=new WeakMap;var Ku=class{constructor(e,r,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,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}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return n}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);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 r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);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 i}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let n={...this.queryParams||{},limit:e,offset:e*(r-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:r}}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:r}}}async paginateSubscribe(e,r,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(r-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 u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}}};var Q_=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function fl(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of Q_(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var z_=12e3,pl=class extends EventTarget{constructor(r){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;fl(this),this.options=r,this.port=r.port||parseInt(Lo("ad4m-port"))||z_,this.url=r.url||Lo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Lo("ad4m-token")||"",this.embedded=up(),this.embedded&&this.initializeEmbeddedMode()}connect(){return Se(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((r,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"),r(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"),r(this.ad4mClient)):(clearTimeout(i),n(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield lp(this.url),fr("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(r){throw console.error("[Ad4m Connect] Connection failed:",r),this.notifyConnectionChange("error"),r}})}buildClient(){return Se(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=tu({url:this.url,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:r=>{this.activeSocket=r},error:r=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:r=>Se(this,null,function*(){if(!(r.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 qa(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(r){return new Xc({link:new cp(r),cache:new Oo({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(r,n){return Se(this,null,function*(){let i=tu({url:r,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new qa(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return Se(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(r){console.error("[Ad4m Connect] Authentication check failed:",r);let n="Cannot extractByTags from a ciphered wallet. You must unlock first.";return r.message===n?(this.notifyAuthChange("locked"),!0):(r.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",ra("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return Se(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="",ra("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",r=>Se(this,null,function*(){var n;if(((n=r.data)==null?void 0:n.type)==="AD4M_CONFIG"){if(r.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&&(!r.origin||!this.options.allowedOrigins.includes(r.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",r.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${r.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:r.data.port,hasToken:!!r.data.token});let{port:i,token:a}=r.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`,fr("ad4m-port",o.toString()),s?fr("ad4m-token",s):ra("ad4m-token"),fr("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(r=!1){return Se(this,null,function*(){return r&&(this.token="",ra("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(r){return Se(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,r);return this.token=n,fr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.info()})),!0}catch(r){return console.error("[Ad4m Connect] Failed to verify AD4M API:",r),!1}})}isMultiUser(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.multiUserEnabled()}))}catch(r){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",r),!1}})}submitEmail(r){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,n=>Se(this,null,function*(){return yield n.agent.requestLoginVerification(r,this.buildAppInfo())}))}catch(n){return{success:!1,message:n.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.verifyEmailCode(r,n,"login")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Email code verification failed:",i),!1}})}loginWithPassword(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.loginUser(r,n)}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){let o=yield a.agent.createUser(r,n);if(o.success)return yield a.agent.loginUser(r,n);throw new Error(o.error||"Failed to create account")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Account creation error:",i),!1}})}resolveEmbedded(r){this.embeddedResolve&&(this.embeddedResolve(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(r){this.embeddedReject&&(this.embeddedReject(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(r){this.connectionState!==r&&(this.connectionState=r,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:r})))}notifyAuthChange(r){if(this.authState=r,this.dispatchEvent(new CustomEvent("authstatechange",{detail:r})),this.embedded&&(r==="authenticated"&&this.resolveEmbedded(this.ad4mClient),r==="unauthenticated"||r==="locked")){let n=r==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(n))}}notifyConfigChange(r,n){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:r,value:n}}))}};export{pl as default};
1565
1565
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */