@coasys/ad4m-connect 0.13.0-test-2 → 0.13.0-test-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/icons/CheckCircleIcon.d.ts +1 -0
- package/dist/components/icons/TickIcon.d.ts +1 -0
- package/dist/components/shared/Ad4mLogo.d.ts +1 -0
- package/dist/components/shared/AppLogo.d.ts +1 -0
- package/dist/components/shared/Header.d.ts +1 -0
- package/dist/components/shared/Logo.d.ts +1 -0
- package/dist/components/states/ErrorState.d.ts +6 -0
- package/dist/components/views/ConnectionOverview.d.ts +22 -0
- package/dist/components/views/Hosting.d.ts +22 -0
- package/dist/components/views/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/RemoteConnection.d.ts +19 -0
- package/dist/components/views/RequestCapability.d.ts +16 -0
- package/dist/components/views/ScanQRCode.d.ts +14 -0
- package/dist/components/views/Settings.d.ts +19 -0
- package/dist/components/views/Start.d.ts +19 -0
- package/dist/components/views/old/Hosting.d.ts +22 -0
- package/dist/components/views/old/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/old/RemoteConnection.d.ts +19 -0
- package/dist/components/views/old/RequestCapability.d.ts +16 -0
- package/dist/components/views/old/ScanQRCode.d.ts +14 -0
- package/dist/components/views/old/Settings.d.ts +19 -0
- package/dist/components/views/old/Start.d.ts +19 -0
- package/dist/core.js +350 -289
- package/dist/index.js +472 -411
- package/dist/old/components/InvalidToken.d.ts +0 -0
- package/dist/old/components/VerifyCode.d.ts +0 -0
- package/dist/old/core.d.ts +0 -0
- package/dist/old/electron.d.ts +0 -0
- package/dist/old/state/ConnectState.d.ts +0 -0
- package/dist/old/state/index.d.ts +0 -0
- package/dist/old/utils.d.ts +0 -0
- package/dist/old/views/Hosting.d.ts +0 -0
- package/dist/old/views/MultiUserAuth.d.ts +0 -0
- package/dist/old/views/RemoteConnection.d.ts +0 -0
- package/dist/old/views/RequestCapability.d.ts +0 -0
- package/dist/old/views/ScanQRCode.d.ts +0 -0
- package/dist/old/views/Settings.d.ts +0 -0
- package/dist/old/views/Start.d.ts +0 -0
- package/dist/old/web.d.ts +0 -0
- package/dist/state/ConnectState.d.ts +101 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/web.js +474 -413
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var Kp=Object.defineProperty,Yg=Object.defineProperties,Xg=Object.getOwnPropertyDescriptor,ey=Object.getOwnPropertyDescriptors;var Wp=Object.getOwnPropertySymbols,ty=Object.getPrototypeOf,ry=Object.prototype.hasOwnProperty,iy=Object.prototype.propertyIsEnumerable,ny=Reflect.get;var Gp=(r,e,t)=>e in r?Kp(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jp=(r,e)=>{for(var t in e||={})ry.call(e,t)&&Gp(r,t,e[t]);if(Wp)for(var t of Wp(e))iy.call(e,t)&&Gp(r,t,e[t]);return r},Zp=(r,e)=>Yg(r,ey(e));var F=(r,e,t,i)=>{for(var n=i>1?void 0:i?Xg(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&Kp(e,t,n),n};var Yp=(r,e,t)=>ny(ty(r),t,e);var V=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(l){n(l)}},o=c=>{try{s(t.throw(c))}catch(l){n(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var cl=function(r,e){return cl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},cl(r,e)};function Pe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");cl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var E=function(){return E=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},E.apply(this,arguments)};function cr(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Xt(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?a(u.value):n(u.value).then(s,c)}l((i=i.apply(r,e||[])).next())})}function er(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,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(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(t=0)),t;)try{if(i=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(u){l=[6,u],n=0}finally{i=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Vr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var ll="Invariant Violation",Xp=Object.setPrototypeOf,ay=Xp===void 0?function(r,e){return r.__proto__=e,r}:Xp,ee=function(r){Pe(e,r);function e(t){t===void 0&&(t=ll);var i=r.call(this,typeof t=="number"?ll+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=ll,ay(i,e.prototype),i}return e}(Error);function D(r,e){if(!r)throw new ee(e)}var is=["debug","log","warn","error","silent"],ul=is.indexOf("log");function rs(r){return function(){if(is.indexOf(r)>=ul){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=rs("debug"),r.log=rs("log"),r.warn=rs("warn"),r.error=rs("error")})(D||(D={}));function ed(r){var e=is[ul];return ul=Math.max(0,is.indexOf(r)),e}function Je(r){try{return r()}catch{}}var ns=Je(function(){return globalThis})||Je(function(){return window})||Je(function(){return self})||Je(function(){return global})||Je(function(){return Je.constructor("return this")()});var td="__",rd=[td,td].join("DEV");function oy(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(ns,rd,{value:Je(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),ns[rd]}}var Ii=oy();function Qr(r){try{return r()}catch{}}var pl=Qr(function(){return globalThis})||Qr(function(){return window})||Qr(function(){return self})||Qr(function(){return global})||Qr(function(){return Qr.constructor("return this")()}),dl=!1;function sy(){pl&&!Qr(function(){return"production"})&&!Qr(function(){return process})&&(Object.defineProperty(pl,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),dl=!0)}sy();function fl(){dl&&(delete pl.process,dl=!1)}var g_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",y_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",id=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var je=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 hl(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var cy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ka=cy;function as(r){var e=r.prototype.toJSON;typeof e=="function"||hl(0),r.prototype.inspect=e,ka&&(r.prototype[ka]=e)}var nd=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();as(nd);var ad=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();as(ad);function ml(r){return r!=null&&typeof r.kind=="string"}function os(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?os=function(t){return typeof t}:os=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},os(r)}var ly=10,od=2;function Aa(r){return ss(r,[])}function ss(r,e){switch(os(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":uy(r,e);default:return String(r)}}function uy(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=fy(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:ss(n,t)}else if(Array.isArray(r))return dy(r,t);return py(r,t)}function py(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>od)return"["+hy(r)+"]";var i=t.map(function(n){var a=ss(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function dy(r,e){if(r.length===0)return"[]";if(e.length>od)return"[Array]";for(var t=Math.min(ly,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(ss(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function fy(r){var e=r[String(ka)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function hy(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function Ia(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function sd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function my(r,e,t){return e&&sd(r.prototype,e),t&&sd(r,t),r}var cs=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Ia(0,"Body must be a string. Received: ".concat(Aa(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||Ia(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ia(0,"column in locationOffset is 1-indexed and must be positive.")}return my(r,[{key:id,get:function(){return"Source"}}]),r}();function cd(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
|
|
1
|
+
var td=Object.defineProperty,ny=Object.defineProperties,ay=Object.getOwnPropertyDescriptor,oy=Object.getOwnPropertyDescriptors;var Xp=Object.getOwnPropertySymbols,sy=Object.getPrototypeOf,cy=Object.prototype.hasOwnProperty,ly=Object.prototype.propertyIsEnumerable,uy=Reflect.get;var ed=(r,e,t)=>e in r?td(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,rd=(r,e)=>{for(var t in e||={})cy.call(e,t)&&ed(r,t,e[t]);if(Xp)for(var t of Xp(e))ly.call(e,t)&&ed(r,t,e[t]);return r},id=(r,e)=>ny(r,oy(e));var M=(r,e,t,i)=>{for(var n=i>1?void 0:i?ay(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&td(e,t,n),n};var nd=(r,e,t)=>uy(sy(r),t,e);var Q=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(l){n(l)}},o=c=>{try{s(t.throw(c))}catch(l){n(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var ul=function(r,e){return ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},ul(r,e)};function Re(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ul(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var k=function(){return k=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},k.apply(this,arguments)};function lr(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function er(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{l(i.next(u))}catch(f){o(f)}}function c(u){try{l(i.throw(u))}catch(f){o(f)}}function l(u){u.done?a(u.value):n(u.value).then(s,c)}l((i=i.apply(r,e||[])).next())})}function tr(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,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(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(t=0)),t;)try{if(i=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(u){l=[6,u],n=0}finally{i=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Qr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var pl="Invariant Violation",ad=Object.setPrototypeOf,py=ad===void 0?function(r,e){return r.__proto__=e,r}:ad,re=function(r){Re(e,r);function e(t){t===void 0&&(t=pl);var i=r.call(this,typeof t=="number"?pl+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=pl,py(i,e.prototype),i}return e}(Error);function F(r,e){if(!r)throw new re(e)}var as=["debug","log","warn","error","silent"],dl=as.indexOf("log");function ns(r){return function(){if(as.indexOf(r)>=dl){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=ns("debug"),r.log=ns("log"),r.warn=ns("warn"),r.error=ns("error")})(F||(F={}));function od(r){var e=as[dl];return dl=Math.max(0,as.indexOf(r)),e}function Je(r){try{return r()}catch{}}var os=Je(function(){return globalThis})||Je(function(){return window})||Je(function(){return self})||Je(function(){return global})||Je(function(){return Je.constructor("return this")()});var sd="__",cd=[sd,sd].join("DEV");function dy(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(os,cd,{value:Je(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),os[cd]}}var Ci=dy();function Hr(r){try{return r()}catch{}}var fl=Hr(function(){return globalThis})||Hr(function(){return window})||Hr(function(){return self})||Hr(function(){return global})||Hr(function(){return Hr.constructor("return this")()}),hl=!1;function fy(){fl&&!Hr(function(){return"production"})&&!Hr(function(){return process})&&(Object.defineProperty(fl,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),hl=!0)}fy();function ml(){hl&&(delete fl.process,hl=!1)}var E_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",A_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",ld=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var je=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 gl(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var hy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ia=hy;function ss(r){var e=r.prototype.toJSON;typeof e=="function"||gl(0),r.prototype.inspect=e,Ia&&(r.prototype[Ia]=e)}var ud=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();ss(ud);var pd=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();ss(pd);function yl(r){return r!=null&&typeof r.kind=="string"}function cs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?cs=function(t){return typeof t}:cs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cs(r)}var my=10,dd=2;function Ta(r){return ls(r,[])}function ls(r,e){switch(cs(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":gy(r,e);default:return String(r)}}function gy(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=by(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:ls(n,t)}else if(Array.isArray(r))return vy(r,t);return yy(r,t)}function yy(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>dd)return"["+wy(r)+"]";var i=t.map(function(n){var a=ls(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function vy(r,e){if(r.length===0)return"[]";if(e.length>dd)return"[Array]";for(var t=Math.min(my,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(ls(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function by(r){var e=r[String(Ia)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function wy(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function Ca(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function fd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Sy(r,e,t){return e&&fd(r.prototype,e),t&&fd(r,t),r}var us=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Ca(0,"Body must be a string. Received: ".concat(Ta(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||Ca(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Ca(0,"column in locationOffset is 1-indexed and must be positive.")}return Sy(r,[{key:ld,get:function(){return"Source"}}]),r}();function hd(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
|
|
2
2
|
`)===-1,n=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!i||a||o||t,c="";return s&&!(i&&n)&&(c+=`
|
|
3
3
|
`+e),c+=e?r.replace(/\n/g,`
|
|
4
4
|
`+e):r,s&&(c+=`
|
|
5
|
-
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var
|
|
5
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var _y={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"]},$i=Object.freeze({});function st(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:_y,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,l=void 0,u=void 0,f=[],d=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(l=d.length===0?void 0:f[f.length-1],c=u,u=d.pop(),m){if(n)c=c.slice();else{for(var g={},_=0,w=Object.keys(c);_<w.length;_++){var y=w[_];g[y]=c[y]}c=g}for(var b=0,A=0;A<s.length;A++){var T=s[A][0],x=s[A][1];n&&(T-=b),n&&x===null?(c.splice(T,1),b++):c[T]=x}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(l=u?n?o:a[o]:void 0,c=u?u[l]:p,c==null)continue;u&&f.push(l)}var O=void 0;if(!Array.isArray(c)){if(!yl(c))throw new Error("Invalid AST Node: ".concat(Ta(c),"."));var D=vl(e,c.kind,h);if(D){if(O=D.call(e,c,l,u,f,d),O===$i)break;if(O===!1){if(!h){f.pop();continue}}else if(O!==void 0&&(s.push([l,O]),!h))if(yl(O))c=O;else{f.pop();continue}}}if(O===void 0&&m&&s.push([l,c]),h)f.pop();else{var P;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(c),a=n?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],u&&d.push(u),u=c}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function vl(r,e,t){var i=r[e];if(i){if(!t&&typeof i=="function")return i;var n=t?i.leave:i.enter;if(typeof n=="function")return n}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Pn(r){return st(r,{leave:Ey})}var xy=80,Ey={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return q(e.definitions,`
|
|
6
6
|
|
|
7
7
|
`)+`
|
|
8
|
-
`},OperationDefinition:function(e){var t=e.operation,i=e.name,n
|
|
9
|
-
`,
|
|
8
|
+
`},OperationDefinition:function(e){var t=e.operation,i=e.name,n=Oe("(",q(e.variableDefinitions,", "),")"),a=q(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&t==="query"?o:q([t,q([i,n]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return t+": "+i+Oe(" = ",n)+Oe(" ",q(a," "))},SelectionSet:function(e){var t=e.selections;return ir(t)},Field:function(e){var t=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Oe("",t,": ")+i,c=s+Oe("(",q(n,", "),")");return c.length>xy&&(c=s+Oe(`(
|
|
9
|
+
`,ps(q(n,`
|
|
10
10
|
`)),`
|
|
11
|
-
)`)),
|
|
12
|
-
`,
|
|
11
|
+
)`)),q([c,q(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+Oe(" ",q(i," "))},InlineFragment:function(e){var t=e.typeCondition,i=e.directives,n=e.selectionSet;return q(["...",Oe("on ",t),q(i," "),n]," ")},FragmentDefinition:function(e){var t=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Oe("(",q(n,", "),")")," ")+"on ".concat(i," ").concat(Oe("",q(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var i=e.value,n=e.block;return n?hd(i,t==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+q(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+q(t,", ")+"}"},ObjectField:function(e){var t=e.name,i=e.value;return t+": "+i},Directive:function(e){var t=e.name,i=e.arguments;return"@"+t+Oe("(",q(i,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:rr(function(r){var e=r.directives,t=r.operationTypes;return q(["schema",q(e," "),ir(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,i=e.type;return t+": "+i},ScalarTypeDefinition:rr(function(r){var e=r.name,t=r.directives;return q(["scalar",e,q(t," ")]," ")}),ObjectTypeDefinition:rr(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return q(["type",e,Oe("implements ",q(t," & ")),q(i," "),ir(n)]," ")}),FieldDefinition:rr(function(r){var e=r.name,t=r.arguments,i=r.type,n=r.directives;return e+(md(t)?Oe(`(
|
|
12
|
+
`,ps(q(t,`
|
|
13
13
|
`)),`
|
|
14
|
-
)`)
|
|
15
|
-
`,
|
|
14
|
+
)`):Oe("(",q(t,", "),")"))+": "+i+Oe(" ",q(n," "))}),InputValueDefinition:rr(function(r){var e=r.name,t=r.type,i=r.defaultValue,n=r.directives;return q([e+": "+t,Oe("= ",i),q(n," ")]," ")}),InterfaceTypeDefinition:rr(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return q(["interface",e,Oe("implements ",q(t," & ")),q(i," "),ir(n)]," ")}),UnionTypeDefinition:rr(function(r){var e=r.name,t=r.directives,i=r.types;return q(["union",e,q(t," "),i&&i.length!==0?"= "+q(i," | "):""]," ")}),EnumTypeDefinition:rr(function(r){var e=r.name,t=r.directives,i=r.values;return q(["enum",e,q(t," "),ir(i)]," ")}),EnumValueDefinition:rr(function(r){var e=r.name,t=r.directives;return q([e,q(t," ")]," ")}),InputObjectTypeDefinition:rr(function(r){var e=r.name,t=r.directives,i=r.fields;return q(["input",e,q(t," "),ir(i)]," ")}),DirectiveDefinition:rr(function(r){var e=r.name,t=r.arguments,i=r.repeatable,n=r.locations;return"directive @"+e+(md(t)?Oe(`(
|
|
15
|
+
`,ps(q(t,`
|
|
16
16
|
`)),`
|
|
17
|
-
)`)
|
|
18
|
-
`)}}function
|
|
19
|
-
`,
|
|
17
|
+
)`):Oe("(",q(t,", "),")"))+(i?" repeatable":"")+" on "+q(n," | ")}),SchemaExtension:function(e){var t=e.directives,i=e.operationTypes;return q(["extend schema",q(t," "),ir(i)]," ")},ScalarTypeExtension:function(e){var t=e.name,i=e.directives;return q(["extend scalar",t,q(i," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return q(["extend type",t,Oe("implements ",q(i," & ")),q(n," "),ir(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return q(["extend interface",t,Oe("implements ",q(i," & ")),q(n," "),ir(a)]," ")},UnionTypeExtension:function(e){var t=e.name,i=e.directives,n=e.types;return q(["extend union",t,q(i," "),n&&n.length!==0?"= "+q(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,i=e.directives,n=e.values;return q(["extend enum",t,q(i," "),ir(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,i=e.directives,n=e.fields;return q(["extend input",t,q(i," "),ir(n)]," ")}};function rr(r){return function(e){return q([e.description,r(e)],`
|
|
18
|
+
`)}}function q(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function ir(r){return Oe(`{
|
|
19
|
+
`,ps(q(r,`
|
|
20
20
|
`)),`
|
|
21
|
-
}`)}function
|
|
22
|
-
`))}function
|
|
23
|
-
`)!==-1}function ld(r){return r!=null&&r.some(by)}function Ta(r){return r.kind===je.FIELD||r.kind===je.FRAGMENT_SPREAD||r.kind===je.INLINE_FRAGMENT}function ud(){return typeof cs=="function"?fl():fl()}function Cy(){__DEV__?D(typeof Ii=="boolean",Ii):D(typeof Ii=="boolean",39)}ud();Cy();function kr(r,e){var t=r.directives;return!t||!t.length?!0:pd(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?D(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):D(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function Pn(r,e,t){var i=new Set(r),n=i.size;return st(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return Ti}}),t?!i.size:i.size<n}function yl(r){return r&&Pn(["client","export"],r,!0)}function Oy(r){var e=r.name.value;return e==="skip"||e==="include"}function pd(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Oy(t)){var i=t.arguments,n=t.name.value;__DEV__?D(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):D(i&&i.length===1,41);var a=i[0];__DEV__?D(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):D(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?D(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):D(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function vl(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new ee("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 ee(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?D(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):D(i.length===1,45),t=i[0].name.value);var n=E(E({},r),{definitions:Vr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function Ci(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Oi(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?D(i,"No fragment named ".concat(t)):D(i,46),i||null}default:return null}}function he(r){return r!==null&&typeof r=="object"}function lr(r){return{__ref:String(r)}}function le(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function bl(r){return he(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function $y(r){return r.kind==="StringValue"}function Py(r){return r.kind==="BooleanValue"}function Ry(r){return r.kind==="IntValue"}function Ly(r){return r.kind==="FloatValue"}function Ny(r){return r.kind==="Variable"}function Dy(r){return r.kind==="ObjectValue"}function Fy(r){return r.kind==="ListValue"}function My(r){return r.kind==="EnumValue"}function Uy(r){return r.kind==="NullValue"}function Hr(r,e,t,i){if(Ry(t)||Ly(t))r[e.value]=Number(t.value);else if(Py(t)||$y(t))r[e.value]=t.value;else if(Dy(t)){var n={};t.fields.map(function(o){return Hr(n,o.name,o.value,i)}),r[e.value]=n}else if(Ny(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(Fy(t))r[e.value]=t.values.map(function(o){var s={};return Hr(s,e,o,i),s[e.value]});else if(My(t))r[e.value]=t.value;else if(Uy(t))r[e.value]=null;else throw __DEV__?new ee('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new ee(55)}function wl(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Hr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Hr(i,a,o,e)})),Oa(r.name.value,i,t)}var jy=["connection","include","skip","client","rest","export"],Oa=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(Ca(n),")")}else return t.connection.key;var a=r;if(e){var o=Ca(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){jy.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Ca(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Ca;return Ca=r,e}}),Ca=function(e){return JSON.stringify(e,qy)};function qy(r,e){return he(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function Ar(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Hr(t,n,a,e)}),t}return null}function qt(r){return r.alias?r.alias.value:r.name.value}function $a(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(Pt(a)){if(a.name.value==="__typename")return r[qt(a)]}else{var o=$a(r,Oi(a,t).selectionSet,t);if(typeof o=="string")return o}}}function Pt(r){return r.kind==="Field"}function Sl(r){return r.kind==="InlineFragment"}function Rn(r){__DEV__?D(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):D(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new ee('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new ee(48);return t});return __DEV__?D(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):D(e.length<=1,49),r}function ur(r){return Rn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Ln(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function $i(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Pa(r){var e=ur(r);return __DEV__?D(e&&e.operation==="query","Must contain a query definition."):D(e&&e.operation==="query",50),e}function _l(r){__DEV__?D(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):D(r.kind==="Document",51),__DEV__?D(r.definitions.length<=1,"Fragment must have exactly one definition."):D(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?D(e.kind==="FragmentDefinition","Must be a fragment definition."):D(e.kind==="FragmentDefinition",53),e}function Pi(r){Rn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new ee("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new ee(54)}function Ri(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Hr(e,i.variable.name,i.defaultValue)}),e}var be=Array.isArray;function Ve(r){return Array.isArray(r)&&r.length>0}var dd={kind:je.FIELD,name:{kind:je.NAME,value:"__typename"}};function hd(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===je.FRAGMENT_SPREAD&&hd(e[t.name.value],e)})}function By(r){return hd(ur(r)||_l(r),Ci($i(r)))?null:r}function Vy(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function fd(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function xl(r,e){for(var t=fd(""),i=fd(""),n=function(_){for(var S=0,v=void 0;S<_.length&&(v=_[S]);++S)if(!be(v)){if(v.kind===je.OPERATION_DEFINITION)return t(v.name&&v.name.value);if(v.kind===je.FRAGMENT_DEFINITION)return i(v.name.value)}return __DEV__&&D.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===je.OPERATION_DEFINITION&&++a;var s=Vy(r),c=r.some(function(_){return _.remove}),l=function(_){return c&&_&&_.some(s)},u=new Map,d=!1,f={enter:function(_){if(l(_.directives))return d=!0,null}},p=st(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,v,C,$){var I=n($);I&&I.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,v,C,$){if(l(_.directives))return d=!0,null;var I=n($);I&&I.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,v,C){u.set(JSON.stringify(C),_)},leave:function(_,S,v,C){var $=u.get(JSON.stringify(C));if(_===$)return _;if(a>0&&_.selectionSet.selections.every(function(I){return I.kind===je.FIELD&&I.name.value==="__typename"}))return i(_.name.value).removed=!0,d=!0,null}},Directive:{leave:function(_){if(s(_))return d=!0,null}}});if(!d)return e;var h=function(_){return _.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(function(S){h(i(S)).transitiveVars.forEach(function(v){_.transitiveVars.add(v)})})),_},m=new Set;p.definitions.forEach(function(_){_.kind===je.OPERATION_DEFINITION?h(t(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):_.kind===je.FRAGMENT_DEFINITION&&a===0&&!i(_.name.value).removed&&m.add(_.name.value)}),m.forEach(function(_){h(i(_)).fragmentSpreads.forEach(function(S){m.add(S)})});var y=function(_){return!!(!m.has(_)||i(_).removed)},b={enter:function(_){if(y(_.name.value))return null}};return By(st(p,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=h(t(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return E(E({},_),{variableDefinitions:_.variableDefinitions.filter(function(v){return S.has(v.variable.name.value)})})}}}}))}var Li=Object.assign(function(r){return st(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===je.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return Pt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(Pt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Vr(Vr([],n,!0),[dd],!1)})}}}}}})},{added:function(r){return r===dd}}),Qy={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&D.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 El(r){return xl([Qy],Rn(r))}function kl(r){var e=Pi(r),t=e.operation;if(t==="query")return r;var i=st(r,{OperationDefinition:{enter:function(n){return E(E({},n),{operation:"query"})}}});return i}function Al(r){Rn(r);var e=xl([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Hy=Object.prototype.hasOwnProperty;function Il(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ra(r)}function Ra(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new _t,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var zy=function(r,e,t){return this.merge(r[t],e[t])},_t=function(){function r(e){e===void 0&&(e=zy),this.reconciler=e,this.isObject=he,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return he(t)&&he(e)?(Object.keys(t).forEach(function(o){if(Hy.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Vr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return he(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function Wy(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=Gy(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}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 Gy(r,e){if(!!r){if(typeof r=="string")return md(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return md(r,e)}}function md(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function gd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function $l(r,e,t){return e&&gd(r.prototype,e),t&&gd(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Pl=function(){return typeof Symbol=="function"},Rl=function(r){return Pl()&&Boolean(Symbol[r])},Ll=function(r){return Rl(r)?Symbol[r]:"@@"+r};Pl()&&!Rl("observable")&&(Symbol.observable=Symbol("observable"));var Ky=Ll("iterator"),Cl=Ll("observable"),yd=Ll("species");function ps(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function La(r){var e=r.constructor;return e!==void 0&&(e=e[yd],e===null&&(e=void 0)),e!==void 0?e:se}function Jy(r){return r instanceof se}function Nn(r){Nn.log?Nn.log(r):setTimeout(function(){throw r})}function us(r){Promise.resolve().then(function(){try{r()}catch(e){Nn(e)}})}function vd(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=ps(e,"unsubscribe");t&&t.call(e)}}catch(i){Nn(i)}}function Ol(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Zy(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(bd(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function bd(r,e,t){r._state="running";var i=r._observer;try{var n=ps(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(Ol(r),n)n.call(i,t);else throw t;break;case"complete":Ol(r),n&&n.call(i);break}}catch(a){Nn(a)}r._state==="closed"?vd(r):r._state==="running"&&(r._state="ready")}function Tl(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],us(function(){return Zy(r)});return}bd(r,e,t)}}var Yy=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new Xy(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Ol(this),vd(this))},$l(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Xy=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){Tl(this._subscription,"next",i)},e.error=function(i){Tl(this._subscription,"error",i)},e.complete=function(){Tl(this._subscription,"complete")},$l(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),se=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new Yy(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(l){try{i(l,s)}catch(u){o(u),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=La(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=La(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=La(this),o=arguments.length>1,s=!1,c=arguments[1],l=c;return new a(function(u){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{l=i(l,d)}catch(p){return u.error(p)}else l=d},error:function(d){u.error(d)},complete:function(){if(!s&&!o)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(l),u.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=La(this);return new s(function(c){var l,u=0;function d(f){l=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){u===a.length?(l=void 0,c.complete()):d(s.from(a[u++]))}})}return d(i),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=La(this);return new a(function(o){var s=[],c=n.subscribe({next:function(u){if(i)try{u=i(u)}catch(f){return o.error(f)}var d=a.from(u).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),l()}});s.push(d)},error:function(u){o.error(u)},complete:function(){l()}});function l(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(u){return u.unsubscribe()}),c.unsubscribe()}})},e[Cl]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=ps(i,Cl);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Jy(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(Rl("iterator")&&(a=ps(i,Ky),a))return new n(function(s){us(function(){if(!s.closed){for(var c=Wy(a.call(i)),l;!(l=c()).done;){var u=l.value;if(s.next(u),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){us(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){us(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},$l(r,null,[{key:yd,get:function(){return this}}]),r}();Pl()&&Object.defineProperty(se,Symbol("extensions"),{value:{symbol:Cl,hostReportError:Nn},configurable:!0});function Nl(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Dn;typeof self<"u"?Dn=self:typeof window<"u"?Dn=window:typeof global<"u"?Dn=global:typeof module<"u"?Dn=module:Dn=Function("return this")();var Qx=Nl(Dn);var wd=se.prototype,Sd="@@observable";wd[Sd]||(wd[Sd]=function(){return this});var ev=Object.prototype.toString;function ds(r){return Dl(r)}function Dl(r,e){switch(ev.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=Dl(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=Dl(r[n],e)}),i}default:return r}}function tv(r){var e=new Set([r]);return e.forEach(function(t){he(t)&&rv(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){he(t[i])&&e.add(t[i])})}),r}function rv(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Na(r){return __DEV__&&tv(r),r}function Ni(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function fs(r,e,t){return new se(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,l={then:function(p){return new Promise(function(h){return h(p())})}};function u(p,h){return p?function(m){++s;var y=function(){return p(m)};l=l.then(y,y).then(function(b){--s,n&&n.call(i,b),c&&d.complete()},function(b){throw--s,b}).catch(function(b){a&&a.call(i,b)})}:function(m){return h&&h.call(i,m)}}var d={next:u(e,n),error:u(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var Bt=typeof WeakMap=="function"&&Je(function(){return navigator.product})!=="ReactNative",_d=typeof WeakSet=="function",Fl=typeof Symbol=="function"&&typeof Symbol.for=="function",zr=Fl&&Symbol.asyncIterator,iE=typeof Je(function(){return window.document.createElement})=="function",nE=Je(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function hs(r){function e(t){Object.defineProperty(r,t,{value:se})}return Fl&&Symbol.species&&e(Symbol.species),e("@@species"),r}function xd(r){return r&&typeof r.then=="function"}var Fn=function(r){Pe(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),Ni(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),Ni(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?xd(c)?c.then(function(l){return i.sub=l.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Ni(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new se(t)]),xd(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(se);hs(Fn);function Wr(r){return"incremental"in r}function iv(r){return"hasNext"in r&&"data"in r}function Ed(r){return Wr(r)||iv(r)}function ms(r,e){var t=r,i=new _t;return Wr(e)&&Ve(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],l=!isNaN(+c),u=l?[]:{};u[c]=a,a=u}t=i.merge(t,a)}),t}function Mn(r){var e=gs(r);return Ve(e)}function gs(r){var e=Ve(r.errors)?r.errors.slice(0):[];return Wr(r)&&Ve(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Gr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var kd=new Map;function Da(r){var e=kd.get(r)||1;return kd.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ad(r){var e=Da("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function Fa(r,e){return Gr(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function ys(r){return new se(function(e){e.error(r)})}var Ma=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function Ml(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new ee("illegal argument: ".concat(n)):new ee(27)}return r}function Ul(r,e){var t=E({},r),i=function(a){typeof a=="function"?t=E(E({},t),a(t)):t=E(E({},t),a)},n=function(){return E({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function jl(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Ln(e.query)||void 0:""),e}function Id(r,e){return e?e(r):se.of()}function Ua(r){return typeof r=="function"?new Vt(r):r}function vs(r){return r.request.length<=1}var nv=function(r){Pe(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Vt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return se.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ua).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=Ua(t),a=Ua(i||new r(Id));return vs(n)&&vs(a)?new r(function(o){return e(o)?n.request(o)||se.of():a.request(o)||se.of()}):new r(function(o,s){return e(o)?n.request(o,s)||se.of():a.request(o,s)||se.of()})},r.execute=function(e,t){return e.request(Ul(t.context,jl(Ml(t))))||se.of()},r.concat=function(e,t){var i=Ua(e);if(vs(i))return __DEV__&&D.warn(new nv("You are calling concat on a terminating link, which will have no effect",i)),i;var n=Ua(t);return vs(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||se.of()})||se.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||se.of()})||se.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Id)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new ee("request is not implemented"):new ee(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var Un=Vt.execute;var Td="3.7.10";function Cd(r){return!!r.body}function Od(r){return!!r.getReader}function $d(r){return!!(zr&&r[Symbol.asyncIterator])}function Pd(r){return!!r.stream}function Rd(r){return!!r.arrayBuffer}function Ld(r){return!!r.pipe}function ql(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Bl(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function l(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var u={next:function(){return l()}};return zr&&(u[Symbol.asyncIterator]=function(){return this}),u}function Vl(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return zr&&(t[Symbol.asyncIterator]=function(){return this}),t}function bs(r){var e={next:function(){return r.read()}};return zr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Nd(r){var e=r;if(Cd(r)&&(e=r.body),$d(e))return ql(e);if(Od(e))return bs(e.getReader());if(Pd(e))return bs(e.stream().getReader());if(Rd(e))return Vl(e.arrayBuffer());if(Ld(e))return Bl(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Dd=Object.prototype.hasOwnProperty;function Fd(r,e){var t,i,n;return Xt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h,m,y,b,_,S,v,C,$,I,L;return er(this,function(M){switch(M.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),u="",d=Nd(r),f=!0,M.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=M.sent(),h=p.value,m=p.done,y=typeof h=="string"?h:a.decode(h),f=!m,u+=y,b=u.indexOf(l);b>-1;){if(_=void 0,L=[u.slice(0,b),u.slice(b+l.length)],_=L[0],u=L[1],_.trim()){if(S=_.indexOf(`\r
|
|
21
|
+
}`)}function Oe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function ps(r){return Oe(" ",r.replace(/\n/g,`
|
|
22
|
+
`))}function Ay(r){return r.indexOf(`
|
|
23
|
+
`)!==-1}function md(r){return r!=null&&r.some(Ay)}function $a(r){return r.kind===je.FIELD||r.kind===je.FRAGMENT_SPREAD||r.kind===je.INLINE_FRAGMENT}function gd(){return typeof us=="function"?ml():ml()}function Ny(){__DEV__?F(typeof Ci=="boolean",Ci):F(typeof Ci=="boolean",39)}gd();Ny();function Ar(r,e){var t=r.directives;return!t||!t.length?!0:yd(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?F(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):F(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function Ln(r,e,t){var i=new Set(r),n=i.size;return st(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return $i}}),t?!i.size:i.size<n}function bl(r){return r&&Ln(["client","export"],r,!0)}function Dy(r){var e=r.name.value;return e==="skip"||e==="include"}function yd(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Dy(t)){var i=t.arguments,n=t.name.value;__DEV__?F(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):F(i&&i.length===1,41);var a=i[0];__DEV__?F(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):F(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?F(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):F(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function wl(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new re("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 re(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?F(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):F(i.length===1,45),t=i[0].name.value);var n=k(k({},r),{definitions:Qr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function Oi(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Ri(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?F(i,"No fragment named ".concat(t)):F(i,46),i||null}default:return null}}function me(r){return r!==null&&typeof r=="object"}function ur(r){return{__ref:String(r)}}function pe(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function Sl(r){return me(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Fy(r){return r.kind==="StringValue"}function My(r){return r.kind==="BooleanValue"}function Uy(r){return r.kind==="IntValue"}function jy(r){return r.kind==="FloatValue"}function qy(r){return r.kind==="Variable"}function By(r){return r.kind==="ObjectValue"}function Vy(r){return r.kind==="ListValue"}function Qy(r){return r.kind==="EnumValue"}function Hy(r){return r.kind==="NullValue"}function zr(r,e,t,i){if(Uy(t)||jy(t))r[e.value]=Number(t.value);else if(My(t)||Fy(t))r[e.value]=t.value;else if(By(t)){var n={};t.fields.map(function(o){return zr(n,o.name,o.value,i)}),r[e.value]=n}else if(qy(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(Vy(t))r[e.value]=t.values.map(function(o){var s={};return zr(s,e,o,i),s[e.value]});else if(Qy(t))r[e.value]=t.value;else if(Hy(t))r[e.value]=null;else throw __DEV__?new re('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new re(55)}function _l(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return zr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return zr(i,a,o,e)})),Ra(r.name.value,i,t)}var zy=["connection","include","skip","client","rest","export"],Ra=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(Oa(n),")")}else return t.connection.key;var a=r;if(e){var o=Oa(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){zy.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Oa(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Oa;return Oa=r,e}}),Oa=function(e){return JSON.stringify(e,Wy)};function Wy(r,e){return me(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function kr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return zr(t,n,a,e)}),t}return null}function Bt(r){return r.alias?r.alias.value:r.name.value}function Pa(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(Pt(a)){if(a.name.value==="__typename")return r[Bt(a)]}else{var o=Pa(r,Ri(a,t).selectionSet,t);if(typeof o=="string")return o}}}function Pt(r){return r.kind==="Field"}function xl(r){return r.kind==="InlineFragment"}function Nn(r){__DEV__?F(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):F(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new re('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new re(48);return t});return __DEV__?F(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):F(e.length<=1,49),r}function pr(r){return Nn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Dn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Pi(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function La(r){var e=pr(r);return __DEV__?F(e&&e.operation==="query","Must contain a query definition."):F(e&&e.operation==="query",50),e}function El(r){__DEV__?F(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):F(r.kind==="Document",51),__DEV__?F(r.definitions.length<=1,"Fragment must have exactly one definition."):F(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?F(e.kind==="FragmentDefinition","Must be a fragment definition."):F(e.kind==="FragmentDefinition",53),e}function Li(r){Nn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new re("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new re(54)}function Ni(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&zr(e,i.variable.name,i.defaultValue)}),e}var _e=Array.isArray;function Ve(r){return Array.isArray(r)&&r.length>0}var vd={kind:je.FIELD,name:{kind:je.NAME,value:"__typename"}};function wd(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===je.FRAGMENT_SPREAD&&wd(e[t.name.value],e)})}function Gy(r){return wd(pr(r)||El(r),Oi(Pi(r)))?null:r}function Ky(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function bd(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function Al(r,e){for(var t=bd(""),i=bd(""),n=function(w){for(var y=0,b=void 0;y<w.length&&(b=w[y]);++y)if(!_e(b)){if(b.kind===je.OPERATION_DEFINITION)return t(b.name&&b.name.value);if(b.kind===je.FRAGMENT_DEFINITION)return i(b.name.value)}return __DEV__&&F.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===je.OPERATION_DEFINITION&&++a;var s=Ky(r),c=r.some(function(w){return w.remove}),l=function(w){return c&&w&&w.some(s)},u=new Map,f=!1,d={enter:function(w){if(l(w.directives))return f=!0,null}},p=st(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,y,b,A,T){var x=n(T);x&&x.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,y,b,A,T){if(l(w.directives))return f=!0,null;var x=n(T);x&&x.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,y,b,A){u.set(JSON.stringify(A),w)},leave:function(w,y,b,A){var T=u.get(JSON.stringify(A));if(w===T)return w;if(a>0&&w.selectionSet.selections.every(function(x){return x.kind===je.FIELD&&x.name.value==="__typename"}))return i(w.name.value).removed=!0,f=!0,null}},Directive:{leave:function(w){if(s(w))return f=!0,null}}});if(!f)return e;var h=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(y){h(i(y)).transitiveVars.forEach(function(b){w.transitiveVars.add(b)})})),w},m=new Set;p.definitions.forEach(function(w){w.kind===je.OPERATION_DEFINITION?h(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(y){m.add(y)}):w.kind===je.FRAGMENT_DEFINITION&&a===0&&!i(w.name.value).removed&&m.add(w.name.value)}),m.forEach(function(w){h(i(w)).fragmentSpreads.forEach(function(y){m.add(y)})});var g=function(w){return!!(!m.has(w)||i(w).removed)},_={enter:function(w){if(g(w.name.value))return null}};return Gy(st(p,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var y=h(t(w.name&&w.name.value)).transitiveVars;if(y.size<w.variableDefinitions.length)return k(k({},w),{variableDefinitions:w.variableDefinitions.filter(function(b){return y.has(b.variable.name.value)})})}}}}))}var Di=Object.assign(function(r){return st(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===je.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return Pt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(Pt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return k(k({},e),{selections:Qr(Qr([],n,!0),[vd],!1)})}}}}}})},{added:function(r){return r===vd}}),Jy={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&F.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 kl(r){return Al([Jy],Nn(r))}function Il(r){var e=Li(r),t=e.operation;if(t==="query")return r;var i=st(r,{OperationDefinition:{enter:function(n){return k(k({},n),{operation:"query"})}}});return i}function Tl(r){Nn(r);var e=Al([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Zy=Object.prototype.hasOwnProperty;function Cl(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Na(r)}function Na(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new _t,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var Yy=function(r,e,t){return this.merge(r[t],e[t])},_t=function(){function r(e){e===void 0&&(e=Yy),this.reconciler=e,this.isObject=me,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return me(t)&&me(e)?(Object.keys(t).forEach(function(o){if(Zy.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Qr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return me(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=k({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function Xy(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=ev(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}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 ev(r,e){if(!!r){if(typeof r=="string")return Sd(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Sd(r,e)}}function Sd(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function _d(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Pl(r,e,t){return e&&_d(r.prototype,e),t&&_d(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var Ll=function(){return typeof Symbol=="function"},Nl=function(r){return Ll()&&Boolean(Symbol[r])},Dl=function(r){return Nl(r)?Symbol[r]:"@@"+r};Ll()&&!Nl("observable")&&(Symbol.observable=Symbol("observable"));var tv=Dl("iterator"),Ol=Dl("observable"),xd=Dl("species");function fs(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Da(r){var e=r.constructor;return e!==void 0&&(e=e[xd],e===null&&(e=void 0)),e!==void 0?e:le}function rv(r){return r instanceof le}function Fn(r){Fn.log?Fn.log(r):setTimeout(function(){throw r})}function ds(r){Promise.resolve().then(function(){try{r()}catch(e){Fn(e)}})}function Ed(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=fs(e,"unsubscribe");t&&t.call(e)}}catch(i){Fn(i)}}function Rl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function iv(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Ad(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Ad(r,e,t){r._state="running";var i=r._observer;try{var n=fs(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(Rl(r),n)n.call(i,t);else throw t;break;case"complete":Rl(r),n&&n.call(i);break}}catch(a){Fn(a)}r._state==="closed"?Ed(r):r._state==="running"&&(r._state="ready")}function $l(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],ds(function(){return iv(r)});return}Ad(r,e,t)}}var nv=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new av(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Rl(this),Ed(this))},Pl(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),av=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){$l(this._subscription,"next",i)},e.error=function(i){$l(this._subscription,"error",i)},e.complete=function(){$l(this._subscription,"complete")},Pl(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),le=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new nv(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(l){try{i(l,s)}catch(u){o(u),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Da(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Da(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Da(this),o=arguments.length>1,s=!1,c=arguments[1],l=c;return new a(function(u){return n.subscribe({next:function(f){var d=!s;if(s=!0,!d||o)try{l=i(l,f)}catch(p){return u.error(p)}else l=f},error:function(f){u.error(f)},complete:function(){if(!s&&!o)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(l),u.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=Da(this);return new s(function(c){var l,u=0;function f(d){l=d.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){u===a.length?(l=void 0,c.complete()):f(s.from(a[u++]))}})}return f(i),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Da(this);return new a(function(o){var s=[],c=n.subscribe({next:function(u){if(i)try{u=i(u)}catch(d){return o.error(d)}var f=a.from(u).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(f);d>=0&&s.splice(d,1),l()}});s.push(f)},error:function(u){o.error(u)},complete:function(){l()}});function l(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(u){return u.unsubscribe()}),c.unsubscribe()}})},e[Ol]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=fs(i,Ol);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return rv(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(Nl("iterator")&&(a=fs(i,tv),a))return new n(function(s){ds(function(){if(!s.closed){for(var c=Xy(a.call(i)),l;!(l=c()).done;){var u=l.value;if(s.next(u),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){ds(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){ds(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},Pl(r,null,[{key:xd,get:function(){return this}}]),r}();Ll()&&Object.defineProperty(le,Symbol("extensions"),{value:{symbol:Ol,hostReportError:Fn},configurable:!0});function Fl(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Mn;typeof self<"u"?Mn=self:typeof window<"u"?Mn=window:typeof global<"u"?Mn=global:typeof module<"u"?Mn=module:Mn=Function("return this")();var Yx=Fl(Mn);var kd=le.prototype,Id="@@observable";kd[Id]||(kd[Id]=function(){return this});var ov=Object.prototype.toString;function hs(r){return Ml(r)}function Ml(r,e){switch(ov.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=Ml(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=Ml(r[n],e)}),i}default:return r}}function sv(r){var e=new Set([r]);return e.forEach(function(t){me(t)&&cv(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){me(t[i])&&e.add(t[i])})}),r}function cv(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Fa(r){return __DEV__&&sv(r),r}function Fi(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function ms(r,e,t){return new le(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,l={then:function(p){return new Promise(function(h){return h(p())})}};function u(p,h){return p?function(m){++s;var g=function(){return p(m)};l=l.then(g,g).then(function(_){--s,n&&n.call(i,_),c&&f.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(i,_)})}:function(m){return h&&h.call(i,m)}}var f={next:u(e,n),error:u(t,a),complete:function(){c=!0,s||o&&o.call(i)}},d=r.subscribe(f);return function(){return d.unsubscribe()}})}var Vt=typeof WeakMap=="function"&&Je(function(){return navigator.product})!=="ReactNative",Td=typeof WeakSet=="function",Ul=typeof Symbol=="function"&&typeof Symbol.for=="function",Wr=Ul&&Symbol.asyncIterator,pE=typeof Je(function(){return window.document.createElement})=="function",dE=Je(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function gs(r){function e(t){Object.defineProperty(r,t,{value:le})}return Ul&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Cd(r){return r&&typeof r.then=="function"}var Un=function(r){Re(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),Fi(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),Fi(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Cd(c)?c.then(function(l){return i.sub=l.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Fi(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new le(t)]),Cd(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(le);gs(Un);function Gr(r){return"incremental"in r}function lv(r){return"hasNext"in r&&"data"in r}function $d(r){return Gr(r)||lv(r)}function ys(r,e){var t=r,i=new _t;return Gr(e)&&Ve(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],l=!isNaN(+c),u=l?[]:{};u[c]=a,a=u}t=i.merge(t,a)}),t}function jn(r){var e=vs(r);return Ve(e)}function vs(r){var e=Ve(r.errors)?r.errors.slice(0):[];return Gr(r)&&Ve(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Kr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Od=new Map;function Ma(r){var e=Od.get(r)||1;return Od.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Rd(r){var e=Ma("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function Ua(r,e){return Kr(r,e,e.variables&&{variables:k(k({},r&&r.variables),e.variables)})}function bs(r){return new le(function(e){e.error(r)})}var ja=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function jl(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new re("illegal argument: ".concat(n)):new re(27)}return r}function ql(r,e){var t=k({},r),i=function(a){typeof a=="function"?t=k(k({},t),a(t)):t=k(k({},t),a)},n=function(){return k({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function Bl(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Dn(e.query)||void 0:""),e}function Pd(r,e){return e?e(r):le.of()}function qa(r){return typeof r=="function"?new Qt(r):r}function ws(r){return r.request.length<=1}var uv=function(r){Re(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Qt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return le.of()})},r.from=function(e){return e.length===0?r.empty():e.map(qa).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=qa(t),a=qa(i||new r(Pd));return ws(n)&&ws(a)?new r(function(o){return e(o)?n.request(o)||le.of():a.request(o)||le.of()}):new r(function(o,s){return e(o)?n.request(o,s)||le.of():a.request(o,s)||le.of()})},r.execute=function(e,t){return e.request(ql(t.context,Bl(jl(t))))||le.of()},r.concat=function(e,t){var i=qa(e);if(ws(i))return __DEV__&&F.warn(new uv("You are calling concat on a terminating link, which will have no effect",i)),i;var n=qa(t);return ws(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||le.of()})||le.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||le.of()})||le.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Pd)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new re("request is not implemented"):new re(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var qn=Qt.execute;var Ld="3.7.10";function Nd(r){return!!r.body}function Dd(r){return!!r.getReader}function Fd(r){return!!(Wr&&r[Symbol.asyncIterator])}function Md(r){return!!r.stream}function Ud(r){return!!r.arrayBuffer}function jd(r){return!!r.pipe}function Vl(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Ql(r){var e=null,t=null,i=!1,n=[],a=[];function o(f){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:f,done:!1})}n.push(f)}}function s(f){t=f;var d=a.slice();d.forEach(function(p){p[1](f)}),!e||e()}function c(){i=!0;var f=a.slice();f.forEach(function(d){d[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function l(){return new Promise(function(f,d){if(t)return d(t);if(n.length)return f({value:n.shift(),done:!1});if(i)return f({value:void 0,done:!0});a.push([f,d])})}var u={next:function(){return l()}};return Wr&&(u[Symbol.asyncIterator]=function(){return this}),u}function Hl(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Wr&&(t[Symbol.asyncIterator]=function(){return this}),t}function Ss(r){var e={next:function(){return r.read()}};return Wr&&(e[Symbol.asyncIterator]=function(){return this}),e}function qd(r){var e=r;if(Nd(r)&&(e=r.body),Fd(e))return Vl(e);if(Dd(e))return Ss(e.getReader());if(Md(e))return Ss(e.stream().getReader());if(Ud(e))return Hl(e.arrayBuffer());if(jd(e))return Ql(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Bd=Object.prototype.hasOwnProperty;function Vd(r,e){var t,i,n;return er(this,void 0,void 0,function(){var a,o,s,c,l,u,f,d,p,h,m,g,_,w,y,b,A,T,x,O;return tr(this,function(D){switch(D.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),u="",f=qd(r),d=!0,D.label=1;case 1:return d?[4,f.next()]:[3,3];case 2:for(p=D.sent(),h=p.value,m=p.done,g=typeof h=="string"?h:a.decode(h),d=!m,u+=g,_=u.indexOf(l);_>-1;){if(w=void 0,O=[u.slice(0,_),u.slice(_+l.length)],w=O[0],u=O[1],w.trim()){if(y=w.indexOf(`\r
|
|
25
25
|
\r
|
|
26
|
-
`),
|
|
27
|
-
`,"")),(Object.keys(
|
|
28
|
-
`).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function
|
|
26
|
+
`),b=pv(w.slice(0,y)),A=b["content-type"],A&&A.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");T=w.slice(y);try{x=Qd(r,T.replace(`\r
|
|
27
|
+
`,"")),(Object.keys(x).length>1||"data"in x||"incremental"in x||"errors"in x)&&((i=e.next)===null||i===void 0||i.call(e,x))}catch(P){_s(P,e)}}_=u.indexOf(l)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function pv(r){var e={};return r.split(`
|
|
28
|
+
`).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function Qd(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};ja(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=r,i.statusCode=r.status,i.bodyText=e,i}}function _s(r,e){var t,i;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(i=e.error)===null||i===void 0||i.call(e,r))}function Hd(r,e,t){dv(e)(r).then(function(i){var n,a;(n=t.next)===null||n===void 0||n.call(t,i),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(i){return _s(i,t)})}function dv(r){return function(e){return e.text().then(function(t){return Qd(e,t)}).then(function(t){return e.status>=300&&ja(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Bd.call(t,"data")&&!Bd.call(t,"errors")&&ja(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(i){return i.operationName}):r.operationName,"'.")),t})}}var Ba=function(r,e){var t;try{t=JSON.stringify(r)}catch(n){var i=__DEV__?new re("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new re(24);throw i.parseError=n,i}return t};var fv={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},hv={accept:"*/*","content-type":"application/json"},mv={method:"POST"},zd={http:fv,headers:hv,options:mv},Wd=function(r,e){return e(r)};function Gd(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];var n={},a={};t.forEach(function(f){n=k(k(k({},n),f.options),{headers:k(k({},n.headers),f.headers)}),f.credentials&&(n.credentials=f.credentials),a=k(k({},a),f.http)}),n.headers&&(n.headers=gv(n.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,l=r.query,u={operationName:o,variables:c};return a.includeExtensions&&(u.extensions=s),a.includeQuery&&(u.query=e(l,Pn)),{options:n,body:u}}function gv(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var i=Object.create(null);Object.keys(Object(r)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:r[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var Kd=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new re(`
|
|
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 ee(23)};var Qd=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var Hd=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function zd(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=ja(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=ja(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var l=s.indexOf("?")===-1?"?":"&",u=s+l+t.join("&")+o;return{newURI:u}}var Wd=Je(function(){return fetch}),Gd=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?qd:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,l=r.includeUnusedVariables,u=l===void 0?!1:l,d=cr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Vd(i||Wd);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Vt(function(p){var h=Hd(p,t),m=p.getContext(),y={};if(m.clientAwareness){var b=m.clientAwareness,_=b.name,S=b.version;_&&(y["apollographql-client-name"]=_),S&&(y["apollographql-client-version"]=S)}var v=E(E({},y),m.headers),C={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:v},$=Bd(p,a,jd,f,C),I=$.options,L=$.body;if(L.variables&&!u){var M=new Set(Object.keys(L.variables));st(p.query,{Variable:function(fe,or,oe){oe&&oe.kind!=="VariableDefinition"&&M.delete(fe.name.value)}}),M.size&&(L.variables=E({},L.variables),M.forEach(function(fe){delete L.variables[fe]}))}var N;if(!I.signal){var W=Qd(),Ie=W.controller,Oe=W.signal;N=Ie,N&&(I.signal=Oe)}var T=function(fe){return fe.kind==="OperationDefinition"&&fe.operation==="mutation"};if(c&&!p.query.definitions.some(T)&&(I.method="GET"),Pn(["defer"],p.query)&&(I.headers=I.headers||{},I.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),I.method==="GET"){var we=zd(h,L),Se=we.newURI,de=we.parseError;if(de)return ys(de);h=Se}else try{I.body=ja(L,"Payload")}catch(fe){return ys(fe)}return new se(function(fe){var or=i||Je(function(){return fetch})||Wd;return or(h,I).then(function(oe){var sr;p.setContext({response:oe});var Br=(sr=oe.headers)===null||sr===void 0?void 0:sr.get("content-type");return Br!==null&&/^multipart\/mixed/i.test(Br)?Fd(oe,fe):Ud(oe,p,fe)}).catch(function(oe){return ws(oe,fe)}),function(){N&&N.abort()}})})};var Ql=function(r){Pe(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,Gd(t).request)||this;return i.options=t,i}return e}(Vt);var{toString:Kd,hasOwnProperty:pv}=Object.prototype,Jd=Function.prototype.toString,Hl=new Map;function Ae(r,e){try{return zl(r,e)}finally{Hl.clear()}}function zl(r,e){if(r===e)return!0;let t=Kd.call(r),i=Kd.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Yd(r,e))return!0;let n=Zd(r),a=Zd(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!pv.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!zl(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Yd(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!zl(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Jd.call(r);return n!==Jd.call(e)?!1:!hv(n,fv)}}return!1}function Zd(r){return Object.keys(r).filter(dv,r)}function dv(r){return this[r]!==void 0}var fv="{ [native code] }";function hv(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Yd(r,e){let t=Hl.get(r);if(t){if(t.has(e))return!0}else Hl.set(r,t=new Set);return t.add(e),!1}var mv=function(){return Object.create(null)},Xd=Array.prototype,gv=Xd.forEach,yv=Xd.slice,pr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=mv),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return gv.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(yv.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&vv(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function vv(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var it=null,ef={},bv=1,wv=()=>class{constructor(){this.id=["slot",bv++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=it;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===ef)break;return e!==it&&(it.slots[this.id]=t),!0}return it&&(it.slots[this.id]=ef),!1}getValue(){if(this.hasValue())return it.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=it;it={parent:o,slots:a};try{return t.apply(n,i)}finally{it=o}}static bind(e){let t=it;return function(){let i=it;try{return it=t,e.apply(this,arguments)}finally{it=i}}}static noContext(e,t,i){if(it){let n=it;try{return it=null,e.apply(i,t)}finally{it=n}}else return e.apply(i,t)}};function tf(r){try{return r()}catch{}}var Wl="@wry/context:Slot",Sv=tf(()=>globalThis)||tf(()=>global)||Object.create(null),rf=Sv,jn=rf[Wl]||Array[Wl]||function(r){try{Object.defineProperty(rf,Wl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(wv());var{bind:_v,noContext:xv}=jn;function Ev(){}var kv=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Ev),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),_s=new jn,Gl,Av=Object.prototype.hasOwnProperty,Jl=(Gl=Array.from,Gl===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Gl);function Ss(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var qa=[],Iv=100;function qn(r,e){if(!r)throw new Error(e||"assertion failure")}function Tv(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function af(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Cv(r){return r.slice(0)}var Ov=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Kr(this))return nf(this),this.value[0]},r.prototype.recompute=function(e){return qn(!this.recomputing,"already recomputing"),nf(this),Kr(this)?$v(this,e):af(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,of(this),Ss(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),pf(this),Zl(this,function(t,i){t.setDirty(),df(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=qa.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Jl(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),qa.push(this.deps),this.deps=null)},r.count=0,r}();function nf(r){var e=_s.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Kr(r)?cf(e,r):lf(e,r),e}function $v(r,e){return pf(r),_s.withValue(r,Pv,[r,e]),Lv(r,e)&&Rv(r),af(r.value)}function Pv(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Kr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Rv(r){r.dirty=!1,!Kr(r)&&sf(r)}function of(r){Zl(r,cf)}function sf(r){Zl(r,lf)}function Zl(r,e){var t=r.parents.size;if(t)for(var i=Jl(r.parents),n=0;n<t;++n)e(i[n],r)}function cf(r,e){qn(r.childValues.has(e)),qn(Kr(e));var t=!Kr(r);if(!r.dirtyChildren)r.dirtyChildren=qa.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&of(r)}function lf(r,e){qn(r.childValues.has(e)),qn(!Kr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Cv(e.value)):Tv(t,e.value)||r.setDirty(),uf(r,e),!Kr(r)&&sf(r)}function uf(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(qa.length<Iv&&qa.push(t),r.dirtyChildren=null))}function pf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){df(r,t)}),r.forgetDeps(),qn(r.dirtyChildren===null)}function df(r,e){e.parents.delete(r),r.childValues.delete(e),uf(r,e)}function Lv(r,e){if(typeof r.subscribe=="function")try{Ss(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var Nv={setDirty:!0,dispose:!0,forget:!0};function xs(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=_s.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(Ss(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Av.call(Nv,o)?o:"setDirty";Jl(s).forEach(function(l){return l[c]()}),e.delete(a),Ss(s)}},i}function ff(){var r=new pr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var UA=ff(),Kl=new Set;function Di(r,e){e===void 0&&(e=Object.create(null));var t=new kv(e.max||Math.pow(2,16),function(l){return l.dispose()}),i=e.keyArgs,n=e.makeCacheKey||ff(),a=function(){var l=n.apply(null,i?i.apply(null,arguments):arguments);if(l===void 0)return r.apply(null,arguments);var u=t.get(l);u||(t.set(l,u=new Ov(r)),u.subscribe=e.subscribe,u.forget=function(){return t.delete(l)});var d=u.recompute(Array.prototype.slice.call(arguments));return t.set(l,u),Kl.add(t),_s.hasValue()||(Kl.forEach(function(f){return f.clean()}),Kl.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(l){var u=t.get(l);u&&u.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(l){var u=t.get(l);if(u)return u.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(l){return t.delete(l)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Yl=function(){function r(){this.getFragmentDoc=Di(vl)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=cr(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=cr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(E(E({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(E(E({},e),{data:a})),a)}})},r}();var Ba=function(r){Pe(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,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 Re=Object.prototype.hasOwnProperty;function Va(r){return r==null}function ks(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Va(i)?Va(n)?void 0:{_id:n}:{id:i}),Va(i)&&!Va(n)&&(i=n),!Va(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var hf={dataIdFromObject:ks,addTypename:!0,resultCaching:!0,canonizeResults:!1};function mf(r){return Gr(hf,r)}function As(r){var e=r.canonizeResults;return e===void 0?hf.canonizeResults:e}function gf(r,e){return le(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Xl=/^[_a-z][_0-9a-z]*/i;function ir(r){var e=r.match(Xl);return e?e[0]:r}function Es(r,e,t){return he(e)?be(e)?e.every(function(i){return Es(r,i,t)}):r.selections.every(function(i){if(Pt(i)&&kr(i,t)){var n=qt(i);return Re.call(e,n)&&(!i.selectionSet||Es(i.selectionSet,e[n],t))}return!0}):!1}function Jr(r){return he(r)&&!le(r)&&!be(r)}function yf(){return new _t}function Is(r,e){var t=Ci($i(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var Ts=Object.create(null),eu=function(){return Ts},vf=Object.create(null),Bn=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return Na(le(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return le(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return lr(n);if(le(n))return n;var o=i.policies.identify(n)[0];if(o){var s=lr(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return E({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Re.call(this.data,e)){var i=this.data[e];if(i&&Re.call(i,t))return i[t]}if(t==="__typename"&&Re.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Zr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Re.call(this.data,e))return this.data[e];if(this instanceof Zr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;le(e)&&(e=e.__ref),le(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?D(typeof n=="string","store.merge expects a string ID"):D(typeof n=="string",1);var s=new _t(Fv).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(l){if(!a||a[l]!==s[l]){c[l]=1;var u=ir(l);u!==l&&!i.policies.hasKeyArgs(s.__typename,u)&&(c[u]=1),s[l]===void 0&&!(i instanceof Zr)&&delete s[l]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(l){return i.group.dirty(n,l)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:Ts,INVALIDATE:vf,isReference:le,toReference:this.toReference,canRead:this.canRead,readField:function(l,u){return i.policies.readField(typeof l=="string"?{fieldName:l,from:u||lr(e)}:l,{store:i})}};if(Object.keys(n).forEach(function(l){var u=ir(l),d=n[l];if(d!==void 0){var f=typeof t=="function"?t:t[l]||t[u];if(f){var p=f===eu?Ts:f(Na(d),E(E({},c),{fieldName:u,storeFieldName:l,storage:i.getStorage(e,l)}));p===vf?i.group.dirty(e,l):(p===Ts&&(p=void 0),p!==d&&(a[l]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Zr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=eu,n):eu)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&(Re.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Zr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Re.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Re.call(e,a)||t.delete(a)}),e){var i=e.__META,n=cr(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Zr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){Re.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Zr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!Re.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){le(a)&&(t[a.__ref]=!0),he(a)&&Object.keys(a).forEach(function(o){var s=a[o];he(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var bf=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?xs():null,this.keyMaker=new pr(Bt)},r.prototype.depend=function(e,t){if(this.d){this.d(tu(e,t));var i=ir(t);i!==t&&this.d(tu(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(tu(e,t),t==="__exists"?"forget":"setDirty")},r}();function tu(r,e){return e+"#"+r}function ru(r,e){Fi(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Pe(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,l=t.call(this,a,new bf(s))||this;return l.stump=new Dv(l),l.storageTrie=new pr(Bt),c&&l.replace(c),l}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(Bn||(Bn={}));var Zr=function(r){Pe(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ae(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return Re.call(this.data,t)?E(E({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(Bn),Dv=function(r){Pe(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new bf(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Zr);function Fv(r,e,t){var i=r[t],n=e[t];return Ae(i,n)?i:n}function Fi(r){return!!(r instanceof Bn&&r.group.caching)}function Mv(r){return he(r)?be(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var Cs=function(){function r(){this.known=new(_d?WeakSet:Set),this.pool=new pr(Bt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return he(e)&&this.known.has(e)},r.prototype.pass=function(e){if(he(e)){var t=Mv(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(he(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){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],l=this.sortedKeys(e);c.push(l.json);var u=c.length;l.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),l.sorted.forEach(function(p,h){d[p]=c[u+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var Rt=Object.assign(function(r){if(he(r)){iu===void 0&&wf();var e=iu.admit(r),t=nu.get(e);return t===void 0&&nu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:wf}),iu,nu;function wf(){iu=new Cs,nu=new(Bt?WeakMap:Map)}function Sf(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var _f=function(){function r(e){var t=this;this.knownResults=new(Bt?WeakMap:Map),this.config=Gr(e,{addTypename:e.addTypename!==!1,canonizeResults:As(e)}),this.canon=e.canon||new Cs,this.executeSelectionSet=Di(function(i){var n,a=i.context.canonizeResults,o=Sf(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?E(E({},s),{result:t.canon.admit(s.result)}):s:(ru(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:Sf,makeCacheKey:function(i,n,a,o){if(Fi(a.store))return a.store.makeCacheKey(i,le(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Di(function(i){return ru(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Fi(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new Cs},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,l=e.canonizeResults,u=l===void 0?this.config.canonizeResults:l,d=this.config.cache.policies;o=E(E({},Ri(Pa(i))),o);var f=lr(a),p=this.executeSelectionSet({selectionSet:Pi(i).selectionSet,objectOrReference:f,enclosingRef:f,context:E({store:t,query:i,policies:d,variables:o,varString:Rt(o),canonizeResults:u},Is(i,this.config.fragments))}),h;if(p.missing&&(h=[new Ba(Uv(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Fi(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(le(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,l=o.store,u=l.getFieldValue(n,"__typename"),d=[],f,p=new _t;this.config.addTypename&&typeof u=="string"&&!c.rootIdsByTypename[u]&&d.push({__typename:u});function h(S,v){var C;return S.missing&&(f=p.merge(f,(C={},C[v]=S.missing,C))),S.result}var m=new Set(i.selections);m.forEach(function(S){var v,C;if(!!kr(S,s))if(Pt(S)){var $=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),I=qt(S);$===void 0?Li.added(S)||(f=p.merge(f,(v={},v[I]="Can't find field '".concat(S.name.value,"' on ").concat(le(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),v))):be($)?$=h(t.executeSubSelectedArray({field:S,array:$,enclosingRef:a,context:o}),I):S.selectionSet?$!=null&&($=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:$,enclosingRef:le($)?$:a,context:o}),I)):o.canonizeResults&&($=t.canon.pass($)),$!==void 0&&d.push((C={},C[I]=$,C))}else{var L=Oi(S,o.lookupFragment);if(!L&&S.kind===je.FRAGMENT_SPREAD)throw __DEV__?new ee("No fragment named ".concat(S.name.value)):new ee(5);L&&c.fragmentMatches(L,u)&&L.selectionSet.selections.forEach(m.add,m)}});var y=Ra(d),b={result:y,missing:f},_=o.canonizeResults?this.canon.admit(b):Na(b);return _.result&&this.knownResults.set(_.result,i),_},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new _t;function l(u,d){var f;return u.missing&&(s=c.merge(s,(f={},f[d]=u.missing,f))),u.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(u,d){return u===null?null:be(u)?l(t.executeSubSelectedArray({field:i,array:u,enclosingRef:a,context:o}),d):i.selectionSet?l(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:u,enclosingRef:le(u)?u:a,context:o}),d):(__DEV__&&jv(o.store,i,u),u)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function Uv(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function jv(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){he(n)&&(__DEV__?D(!le(n),"Missing selection set for object of type ".concat(gf(r,n)," returned for query field ").concat(e.name.value)):D(!le(n),6),Object.values(n).forEach(i.add,i))})}}var Vn=new jn,xf=new WeakMap;function Qa(r){var e=xf.get(r);return e||xf.set(r,e={vars:new Set,dep:xs()}),e}function au(r){Qa(r).vars.forEach(function(e){return e.forgetCache(r)})}function Ef(r){Qa(r).vars.forEach(function(e){return e.attachCache(r)})}function Os(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){Qa(c).dep.dirty(i),qv(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Vn.getValue();s&&(n(s),Qa(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),Qa(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function qv(r){r.broadcastWatches&&r.broadcastWatches()}var kf=Object.create(null);function ou(r){var e=JSON.stringify(r);return kf[e]||(kf[e]=Object.create(null))}function su(r){var e=ou(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=lu(r,function(o){var s=Qn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&Re.call(t,o[0])&&(s=Qn(t,o,If)),__DEV__?D(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):D(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function cu(r){var e=ou(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=lu(r,function(l){var u=l[0],d=u.charAt(0);if(d==="@"){if(n&&Ve(n.directives)){var f=u.slice(1),p=n.directives.find(function(b){return b.name.value===f}),h=p&&Ar(p,a);return h&&Qn(h,l.slice(1))}return}if(d==="$"){var m=u.slice(1);if(a&&Re.call(a,m)){var y=l.slice(0);return y[0]=m,Qn(a,y)}return}if(t)return Qn(t,l)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function lu(r,e){var t=new _t;return Af(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Af(r){var e=ou(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){be(n)?(Af(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),be(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function If(r,e){return r[e]}function Qn(r,e,t){return t=t||If,Tf(e.reduce(function i(n,a){return be(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Tf(r){return he(r)?be(r)?r.map(Tf):lu(Object.keys(r).sort(),function(e){return Qn(r,e)}):r}Oa.setStringify(Rt);function uu(r){return r.args!==void 0?r.args:r.field?Ar(r.field,r.variables):null}var Bv=function(){},Cf=function(r,e){return e.fieldName},Of=function(r,e,t){var i=t.mergeObjects;return i(r,e)},$f=function(r,e){return e},Rf=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=E({dataIdFromObject:ks},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=E(E({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=$s(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,l=a&&this.getTypePolicy(a),u=l&&l.keyFn||this.config.dataIdFromObject;u;){var d=u(e,s);if(be(d))u=su(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=cr(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),Re.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,l){c.merge=typeof l=="function"?l:l===!0?Of:l===!1?$f:c.merge}s(n,t.merge),n.keyFn=a===!1?Bv:be(a)?su(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var l=i.getFieldPolicy(e,c,!0),u=o[c];if(typeof u=="function")l.read=u;else{var d=u.keyArgs,f=u.read,p=u.merge;l.keyFn=d===!1?Cf:be(d)?cu(d):typeof d=="function"?d:l.keyFn,typeof f=="function"&&(l.read=f),s(l,p)}l.read&&l.merge&&(l.keyFn=l.keyFn||Cf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?D(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):D(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Xl);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Re.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,l=cr(s,["fields"]);Object.assign(i,l),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],l=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},u=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&D.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(l),u&&f===c.length-1&&Es(e.selectionSet,i,n)&&(u=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var y=t.match(h);y&&y[0]===t&&l(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=uu(e);o;){var l=o(c,s);if(be(l))o=cu(l);else{a=l||i;break}}return a===void 0&&(a=e.field?wl(e.field,e.variables):Oa(i,uu(e))),a===!1?i:i===ir(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=ir(o),c=t.store.getFieldValue(i,o),l=this.getFieldPolicy(e.typename,s,!1),u=l&&l.read;if(u){var d=Pf(this,i,e,t,t.store.getStorage(le(i)?i.__ref:i,o));return Vn.withValue(this.cache,u,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===Of?Lf(n.store)(e,t):c===$f?t:(n.overwrite&&(e=void 0),c(e,t,Pf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function Pf(r,e,t,i,n){var a=r.getStoreFieldName(t),o=ir(a),s=t.variables||i.variables,c=i.store,l=c.toReference,u=c.canRead;return{args:uu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:le,toReference:l,storage:n,cache:r.cache,canRead:u,readField:function(){return r.readField($s(arguments,e,s),i)},mergeObjects:Lf(i.store)}}function $s(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=E({},i),Re.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&D.warn("Undefined 'from' passed to readField with arguments ".concat(Ad(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Lf(r){return function(t,i){if(be(t)||be(i))throw __DEV__?new ee("Cannot automatically merge arrays"):new ee(4);if(he(t)&&he(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(le(t)&&Jr(i))return r.merge(t.__ref,i),t;if(Jr(t)&&le(i))return r.merge(t,i.__ref),i;if(Jr(t)&&Jr(i))return E(E({},t),i)}return i}}function pu(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:E(E({},r),{clientOnly:e,deferred:t})),n}var Mf=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,l=ur(n),u=yf();s=E(E({},Ri(l)),s);var d=E(E({store:e,written:Object.create(null),merge:function(p,h){return u.merge(p,h)},variables:s,varString:Rt(s)},Is(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:d});if(!le(f))throw __DEV__?new ee("Could not identify object ".concat(JSON.stringify(a))):new ee(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,y=p.mergeTree,b=p.fieldNodeSet,_=lr(h);if(y&&y.map.size){var S=i.applyMerges(y,_,m,d);if(le(S))return;m=S}if(__DEV__&&!d.overwrite){var v=Object.create(null);b.forEach(function(I){I.selectionSet&&(v[I.name.value]=!0)});var C=function(I){return v[ir(I)]===!0},$=function(I){var L=y&&y.map.get(I);return Boolean(L&&L.info&&L.info.merge)};Object.keys(m).forEach(function(I){C(I)&&!$(I)&&Vv(_,m,I,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,l=Object.create(null),u=i&&c.rootTypenamesById[i]||$a(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof u=="string"&&(l.__typename=u);var d=function(){var S=$s(arguments,l,o.variables);if(le(S.from)){var v=o.incomingById.get(S.from.__ref);if(v){var C=c.readField(E(E({},S),{from:v.storeObject}),o);if(C!==void 0)return C}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,u).forEach(function(S,v){var C,$=qt(v),I=n[$];if(f.add(v),I!==void 0){var L=c.getStoreFieldName({typename:u,fieldName:v.name.value,field:v,variables:S.variables}),M=Nf(s,L),N=t.processFieldValue(I,v,v.selectionSet?pu(S,!1,!1):S,M),W=void 0;v.selectionSet&&(le(N)||Jr(N))&&(W=d("__typename",N));var Ie=c.getMergeFunction(u,v.name.value,W);Ie?M.info={field:v,typename:u,merge:Ie}:Df(s,L),l=S.merge(l,(C={},C[L]=N,C))}else __DEV__&&!S.clientOnly&&!S.deferred&&!Li.added(v)&&!c.getReadFunction(u,v.name.value)&&__DEV__&&D.error("Missing field '".concat(qt(v),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:u,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:l,readField:d}),h=p[0],m=p[1];i=i||h,m&&(l=o.merge(l,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var y=lr(i),b=o.written[i]||(o.written[i]=[]);if(b.indexOf(a)>=0||(b.push(a),this.reader&&this.reader.isFresh(n,y,a,o)))return y;var _=o.incomingById.get(i);return _?(_.storeObject=o.merge(_.storeObject,l),_.mergeTree=du(_.mergeTree,s),f.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:l,mergeTree:Ps(s)?void 0:s,fieldNodeSet:f}),y}return l},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?ds(e):e:be(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,Nf(n,s));return Df(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=$a(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new pr(!1);return function c(l,u){var d=s.lookup(l,u.clientOnly,u.deferred);d.visited||(d.visited=!0,l.selections.forEach(function(f){if(!!kr(f,i.variables)){var p=u.clientOnly,h=u.deferred;if(!(p&&h)&&Ve(f.directives)&&f.directives.forEach(function(b){var _=b.name.value;if(_==="client"&&(p=!0),_==="defer"){var S=Ar(b,i.variables);(!S||S.if!==!1)&&(h=!0)}}),Pt(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,pu(i,p,h))}else{var y=Oi(f,i.lookupFragment);if(!y&&f.kind===je.FRAGMENT_SPREAD)throw __DEV__?new ee("No fragment named ".concat(f.name.value)):new ee(8);y&&o.fragmentMatches(y,n,t,i.variables)&&c(y.selectionSet,pu(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!le(i)){var c=!be(i)&&(le(t)||Jr(t))?t:void 0,l=i;c&&!a&&(a=[le(c)?c.__ref:c]);var u,d=function(f,p){return be(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(l,p);if(m!==void 0){a&&a.push(p);var y=s.applyMerges(f,h,m,n,a);y!==m&&(u=u||new Map,u.set(p,y)),a&&D(a.pop()===p)}}),u&&(i=be(l)?l.slice(0):E({},l),u.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var Uf=[];function Nf(r,e){var t=r.map;return t.has(e)||t.set(e,Uf.pop()||{map:new Map}),t.get(e)}function du(r,e){if(r===e||!e||Ps(e))return r;if(!r||Ps(r))return e;var t=r.info&&e.info?E(E({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,du(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,du(e.map.get(s),r.map.get(s)))})}return a}function Ps(r){return!r||!(r.info||r.map.size)}function Df(r,e){var t=r.map,i=t.get(e);i&&Ps(i)&&(Uf.push(i),t.delete(e))}var Ff=new Set;function Vv(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!le(a)&&!Ae(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=ir(t),l="".concat(s,".").concat(c);if(!Ff.has(l)){Ff.add(l);var u=[];!be(a)&&!be(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!u.includes(f)&&u.push(f)}),__DEV__&&D.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
36
|
+
`):new re(23)};var Jd=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var Zd=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function Yd(r,e){var t=[],i=function(f,d){t.push("".concat(f,"=").concat(encodeURIComponent(d)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Ba(e.variables,"Variables map")}catch(f){return{parseError:f}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Ba(e.extensions,"Extensions map")}catch(f){return{parseError:f}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var l=s.indexOf("?")===-1?"?":"&",u=s+l+t.join("&")+o;return{newURI:u}}var Xd=Je(function(){return fetch}),ef=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?Wd:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,l=r.includeUnusedVariables,u=l===void 0?!1:l,f=lr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Kd(i||Xd);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new Qt(function(p){var h=Zd(p,t),m=p.getContext(),g={};if(m.clientAwareness){var _=m.clientAwareness,w=_.name,y=_.version;w&&(g["apollographql-client-name"]=w),y&&(g["apollographql-client-version"]=y)}var b=k(k({},g),m.headers),A={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:b},T=Gd(p,a,zd,d,A),x=T.options,O=T.body;if(O.variables&&!u){var D=new Set(Object.keys(O.variables));st(p.query,{Variable:function(he,sr,ce){ce&&ce.kind!=="VariableDefinition"&&D.delete(he.name.value)}}),D.size&&(O.variables=k({},O.variables),D.forEach(function(he){delete O.variables[he]}))}var P;if(!x.signal){var U=Jd(),ke=U.controller,Ie=U.signal;P=ke,P&&(x.signal=Ie)}var C=function(he){return he.kind==="OperationDefinition"&&he.operation==="mutation"};if(c&&!p.query.definitions.some(C)&&(x.method="GET"),Ln(["defer"],p.query)&&(x.headers=x.headers||{},x.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),x.method==="GET"){var we=Yd(h,O),Se=we.newURI,se=we.parseError;if(se)return bs(se);h=Se}else try{x.body=Ba(O,"Payload")}catch(he){return bs(he)}return new le(function(he){var sr=i||Je(function(){return fetch})||Xd;return sr(h,x).then(function(ce){var cr;p.setContext({response:ce});var Vr=(cr=ce.headers)===null||cr===void 0?void 0:cr.get("content-type");return Vr!==null&&/^multipart\/mixed/i.test(Vr)?Vd(ce,he):Hd(ce,p,he)}).catch(function(ce){return _s(ce,he)}),function(){P&&P.abort()}})})};var zl=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,ef(t).request)||this;return i.options=t,i}return e}(Qt);var{toString:tf,hasOwnProperty:yv}=Object.prototype,rf=Function.prototype.toString,Wl=new Map;function Te(r,e){try{return Gl(r,e)}finally{Wl.clear()}}function Gl(r,e){if(r===e)return!0;let t=tf.call(r),i=tf.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(af(r,e))return!0;let n=nf(r),a=nf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!yv.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Gl(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(af(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Gl(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=rf.call(r);return n!==rf.call(e)?!1:!wv(n,bv)}}return!1}function nf(r){return Object.keys(r).filter(vv,r)}function vv(r){return this[r]!==void 0}var bv="{ [native code] }";function wv(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function af(r,e){let t=Wl.get(r);if(t){if(t.has(e))return!0}else Wl.set(r,t=new Set);return t.add(e),!1}var Sv=function(){return Object.create(null)},of=Array.prototype,_v=of.forEach,xv=of.slice,dr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Sv),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return _v.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(xv.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Ev(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Ev(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var it=null,sf={},Av=1,kv=()=>class{constructor(){this.id=["slot",Av++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=it;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===sf)break;return e!==it&&(it.slots[this.id]=t),!0}return it&&(it.slots[this.id]=sf),!1}getValue(){if(this.hasValue())return it.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=it;it={parent:o,slots:a};try{return t.apply(n,i)}finally{it=o}}static bind(e){let t=it;return function(){let i=it;try{return it=t,e.apply(this,arguments)}finally{it=i}}}static noContext(e,t,i){if(it){let n=it;try{return it=null,e.apply(i,t)}finally{it=n}}else return e.apply(i,t)}};function cf(r){try{return r()}catch{}}var Kl="@wry/context:Slot",Iv=cf(()=>globalThis)||cf(()=>global)||Object.create(null),lf=Iv,Bn=lf[Kl]||Array[Kl]||function(r){try{Object.defineProperty(lf,Kl,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(kv());var{bind:Tv,noContext:Cv}=Bn;function $v(){}var Ov=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=$v),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),Es=new Bn,Jl,Rv=Object.prototype.hasOwnProperty,Yl=(Jl=Array.from,Jl===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Jl);function xs(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Va=[],Pv=100;function Vn(r,e){if(!r)throw new Error(e||"assertion failure")}function Lv(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function pf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Nv(r){return r.slice(0)}var Dv=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Jr(this))return uf(this),this.value[0]},r.prototype.recompute=function(e){return Vn(!this.recomputing,"already recomputing"),uf(this),Jr(this)?Fv(this,e):pf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,df(this),xs(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),yf(this),Xl(this,function(t,i){t.setDirty(),vf(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Va.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Yl(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Va.push(this.deps),this.deps=null)},r.count=0,r}();function uf(r){var e=Es.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Jr(r)?hf(e,r):mf(e,r),e}function Fv(r,e){return yf(r),Es.withValue(r,Mv,[r,e]),jv(r,e)&&Uv(r),pf(r.value)}function Mv(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Jr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Uv(r){r.dirty=!1,!Jr(r)&&ff(r)}function df(r){Xl(r,hf)}function ff(r){Xl(r,mf)}function Xl(r,e){var t=r.parents.size;if(t)for(var i=Yl(r.parents),n=0;n<t;++n)e(i[n],r)}function hf(r,e){Vn(r.childValues.has(e)),Vn(Jr(e));var t=!Jr(r);if(!r.dirtyChildren)r.dirtyChildren=Va.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&df(r)}function mf(r,e){Vn(r.childValues.has(e)),Vn(!Jr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Nv(e.value)):Lv(t,e.value)||r.setDirty(),gf(r,e),!Jr(r)&&ff(r)}function gf(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Va.length<Pv&&Va.push(t),r.dirtyChildren=null))}function yf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){vf(r,t)}),r.forgetDeps(),Vn(r.dirtyChildren===null)}function vf(r,e){e.parents.delete(r),r.childValues.delete(e),gf(r,e)}function jv(r,e){if(typeof r.subscribe=="function")try{xs(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var qv={setDirty:!0,dispose:!0,forget:!0};function As(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=Es.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(xs(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Rv.call(qv,o)?o:"setDirty";Yl(s).forEach(function(l){return l[c]()}),e.delete(a),xs(s)}},i}function bf(){var r=new dr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var Wk=bf(),Zl=new Set;function Mi(r,e){e===void 0&&(e=Object.create(null));var t=new Ov(e.max||Math.pow(2,16),function(l){return l.dispose()}),i=e.keyArgs,n=e.makeCacheKey||bf(),a=function(){var l=n.apply(null,i?i.apply(null,arguments):arguments);if(l===void 0)return r.apply(null,arguments);var u=t.get(l);u||(t.set(l,u=new Dv(r)),u.subscribe=e.subscribe,u.forget=function(){return t.delete(l)});var f=u.recompute(Array.prototype.slice.call(arguments));return t.set(l,u),Zl.add(t),Es.hasValue()||(Zl.forEach(function(d){return d.clean()}),Zl.clear()),f};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(l){var u=t.get(l);u&&u.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(l){var u=t.get(l);if(u)return u.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(l){return t.delete(l)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var eu=function(){function r(){this.getFragmentDoc=Mi(wl)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(k(k({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(k(k({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=lr(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=lr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(k(k({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(k(k({},e),{data:a})),a)}})},r}();var Qa=function(r){Re(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,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 Pe=Object.prototype.hasOwnProperty;function Ha(r){return r==null}function Is(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Ha(i)?Ha(n)?void 0:{_id:n}:{id:i}),Ha(i)&&!Ha(n)&&(i=n),!Ha(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var wf={dataIdFromObject:Is,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Sf(r){return Kr(wf,r)}function Ts(r){var e=r.canonizeResults;return e===void 0?wf.canonizeResults:e}function _f(r,e){return pe(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var tu=/^[_a-z][_0-9a-z]*/i;function nr(r){var e=r.match(tu);return e?e[0]:r}function ks(r,e,t){return me(e)?_e(e)?e.every(function(i){return ks(r,i,t)}):r.selections.every(function(i){if(Pt(i)&&Ar(i,t)){var n=Bt(i);return Pe.call(e,n)&&(!i.selectionSet||ks(i.selectionSet,e[n],t))}return!0}):!1}function Zr(r){return me(r)&&!pe(r)&&!_e(r)}function xf(){return new _t}function Cs(r,e){var t=Oi(Pi(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var $s=Object.create(null),ru=function(){return $s},Ef=Object.create(null),Qn=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return Fa(pe(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return pe(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return ur(n);if(pe(n))return n;var o=i.policies.identify(n)[0];if(o){var s=ur(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return k({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Pe.call(this.data,e)){var i=this.data[e];if(i&&Pe.call(i,t))return i[t]}if(t==="__typename"&&Pe.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Yr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Pe.call(this.data,e))return this.data[e];if(this instanceof Yr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;pe(e)&&(e=e.__ref),pe(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?F(typeof n=="string","store.merge expects a string ID"):F(typeof n=="string",1);var s=new _t(Vv).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(l){if(!a||a[l]!==s[l]){c[l]=1;var u=nr(l);u!==l&&!i.policies.hasKeyArgs(s.__typename,u)&&(c[u]=1),s[l]===void 0&&!(i instanceof Yr)&&delete s[l]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(l){return i.group.dirty(n,l)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:$s,INVALIDATE:Ef,isReference:pe,toReference:this.toReference,canRead:this.canRead,readField:function(l,u){return i.policies.readField(typeof l=="string"?{fieldName:l,from:u||ur(e)}:l,{store:i})}};if(Object.keys(n).forEach(function(l){var u=nr(l),f=n[l];if(f!==void 0){var d=typeof t=="function"?t:t[l]||t[u];if(d){var p=d===ru?$s:d(Fa(f),k(k({},c),{fieldName:u,storeFieldName:l,storage:i.getStorage(e,l)}));p===Ef?i.group.dirty(e,l):(p===$s&&(p=void 0),p!==f&&(a[l]=p,o=!0,f=p))}f!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Yr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=ru,n):ru)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&(Pe.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Yr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Pe.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Pe.call(e,a)||t.delete(a)}),e){var i=e.__META,n=lr(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Yr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){Pe.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Yr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!Pe.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){pe(a)&&(t[a.__ref]=!0),me(a)&&Object.keys(a).forEach(function(o){var s=a[o];me(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Af=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?As():null,this.keyMaker=new dr(Vt)},r.prototype.depend=function(e,t){if(this.d){this.d(iu(e,t));var i=nr(t);i!==t&&this.d(iu(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(iu(e,t),t==="__exists"?"forget":"setDirty")},r}();function iu(r,e){return e+"#"+r}function nu(r,e){Ui(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Re(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,l=t.call(this,a,new Af(s))||this;return l.stump=new Bv(l),l.storageTrie=new dr(Vt),c&&l.replace(c),l}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(Qn||(Qn={}));var Yr=function(r){Re(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Te(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return k(k({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return Pe.call(this.data,t)?k(k({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(Qn),Bv=function(r){Re(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Af(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Yr);function Vv(r,e,t){var i=r[t],n=e[t];return Te(i,n)?i:n}function Ui(r){return!!(r instanceof Qn&&r.group.caching)}function Qv(r){return me(r)?_e(r)?r.slice(0):k({__proto__:Object.getPrototypeOf(r)},r):r}var Os=function(){function r(){this.known=new(Td?WeakSet:Set),this.pool=new dr(Vt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return me(e)&&this.known.has(e)},r.prototype.pass=function(e){if(me(e)){var t=Qv(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(me(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){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],l=this.sortedKeys(e);c.push(l.json);var u=c.length;l.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var f=o.object=Object.create(s);this.known.add(f),l.sorted.forEach(function(p,h){f[p]=c[u+h]}),__DEV__&&Object.freeze(f)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var Lt=Object.assign(function(r){if(me(r)){au===void 0&&kf();var e=au.admit(r),t=ou.get(e);return t===void 0&&ou.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:kf}),au,ou;function kf(){au=new Os,ou=new(Vt?WeakMap:Map)}function If(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Tf=function(){function r(e){var t=this;this.knownResults=new(Vt?WeakMap:Map),this.config=Kr(e,{addTypename:e.addTypename!==!1,canonizeResults:Ts(e)}),this.canon=e.canon||new Os,this.executeSelectionSet=Mi(function(i){var n,a=i.context.canonizeResults,o=If(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?k(k({},s),{result:t.canon.admit(s.result)}):s:(nu(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:If,makeCacheKey:function(i,n,a,o){if(Ui(a.store))return a.store.makeCacheKey(i,pe(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Mi(function(i){return nu(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ui(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new Os},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,l=e.canonizeResults,u=l===void 0?this.config.canonizeResults:l,f=this.config.cache.policies;o=k(k({},Ni(La(i))),o);var d=ur(a),p=this.executeSelectionSet({selectionSet:Li(i).selectionSet,objectOrReference:d,enclosingRef:d,context:k({store:t,query:i,policies:f,variables:o,varString:Lt(o),canonizeResults:u},Cs(i,this.config.fragments))}),h;if(p.missing&&(h=[new Qa(Hv(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ui(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(pe(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,l=o.store,u=l.getFieldValue(n,"__typename"),f=[],d,p=new _t;this.config.addTypename&&typeof u=="string"&&!c.rootIdsByTypename[u]&&f.push({__typename:u});function h(y,b){var A;return y.missing&&(d=p.merge(d,(A={},A[b]=y.missing,A))),y.result}var m=new Set(i.selections);m.forEach(function(y){var b,A;if(!!Ar(y,s))if(Pt(y)){var T=c.readField({fieldName:y.name.value,field:y,variables:o.variables,from:n},o),x=Bt(y);T===void 0?Di.added(y)||(d=p.merge(d,(b={},b[x]="Can't find field '".concat(y.name.value,"' on ").concat(pe(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),b))):_e(T)?T=h(t.executeSubSelectedArray({field:y,array:T,enclosingRef:a,context:o}),x):y.selectionSet?T!=null&&(T=h(t.executeSelectionSet({selectionSet:y.selectionSet,objectOrReference:T,enclosingRef:pe(T)?T:a,context:o}),x)):o.canonizeResults&&(T=t.canon.pass(T)),T!==void 0&&f.push((A={},A[x]=T,A))}else{var O=Ri(y,o.lookupFragment);if(!O&&y.kind===je.FRAGMENT_SPREAD)throw __DEV__?new re("No fragment named ".concat(y.name.value)):new re(5);O&&c.fragmentMatches(O,u)&&O.selectionSet.selections.forEach(m.add,m)}});var g=Na(f),_={result:g,missing:d},w=o.canonizeResults?this.canon.admit(_):Fa(_);return w.result&&this.knownResults.set(w.result,i),w},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new _t;function l(u,f){var d;return u.missing&&(s=c.merge(s,(d={},d[f]=u.missing,d))),u.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(u,f){return u===null?null:_e(u)?l(t.executeSubSelectedArray({field:i,array:u,enclosingRef:a,context:o}),f):i.selectionSet?l(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:u,enclosingRef:pe(u)?u:a,context:o}),f):(__DEV__&&zv(o.store,i,u),u)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function Hv(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function zv(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){me(n)&&(__DEV__?F(!pe(n),"Missing selection set for object of type ".concat(_f(r,n)," returned for query field ").concat(e.name.value)):F(!pe(n),6),Object.values(n).forEach(i.add,i))})}}var Hn=new Bn,Cf=new WeakMap;function za(r){var e=Cf.get(r);return e||Cf.set(r,e={vars:new Set,dep:As()}),e}function su(r){za(r).vars.forEach(function(e){return e.forgetCache(r)})}function $f(r){za(r).vars.forEach(function(e){return e.attachCache(r)})}function Rs(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){za(c).dep.dirty(i),Wv(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Hn.getValue();s&&(n(s),za(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),za(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function Wv(r){r.broadcastWatches&&r.broadcastWatches()}var Of=Object.create(null);function cu(r){var e=JSON.stringify(r);return Of[e]||(Of[e]=Object.create(null))}function lu(r){var e=cu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=pu(r,function(o){var s=zn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&Pe.call(t,o[0])&&(s=zn(t,o,Pf)),__DEV__?F(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):F(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function uu(r){var e=cu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=pu(r,function(l){var u=l[0],f=u.charAt(0);if(f==="@"){if(n&&Ve(n.directives)){var d=u.slice(1),p=n.directives.find(function(_){return _.name.value===d}),h=p&&kr(p,a);return h&&zn(h,l.slice(1))}return}if(f==="$"){var m=u.slice(1);if(a&&Pe.call(a,m)){var g=l.slice(0);return g[0]=m,zn(a,g)}return}if(t)return zn(t,l)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function pu(r,e){var t=new _t;return Rf(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Rf(r){var e=cu(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){_e(n)?(Rf(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),_e(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function Pf(r,e){return r[e]}function zn(r,e,t){return t=t||Pf,Lf(e.reduce(function i(n,a){return _e(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Lf(r){return me(r)?_e(r)?r.map(Lf):pu(Object.keys(r).sort(),function(e){return zn(r,e)}):r}Ra.setStringify(Lt);function du(r){return r.args!==void 0?r.args:r.field?kr(r.field,r.variables):null}var Gv=function(){},Nf=function(r,e){return e.fieldName},Df=function(r,e,t){var i=t.mergeObjects;return i(r,e)},Ff=function(r,e){return e},Uf=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=k({dataIdFromObject:Is},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=k(k({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var d=Ps(arguments,o);return n.readField(d,{store:n.cache.data,variables:d.variables})}}),c,l=a&&this.getTypePolicy(a),u=l&&l.keyFn||this.config.dataIdFromObject;u;){var f=u(e,s);if(_e(f))u=lu(f);else{c=f;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=lr(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),Pe.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,l){c.merge=typeof l=="function"?l:l===!0?Df:l===!1?Ff:c.merge}s(n,t.merge),n.keyFn=a===!1?Gv:_e(a)?lu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var l=i.getFieldPolicy(e,c,!0),u=o[c];if(typeof u=="function")l.read=u;else{var f=u.keyArgs,d=u.read,p=u.merge;l.keyFn=f===!1?Nf:_e(f)?uu(f):typeof f=="function"?f:l.keyFn,typeof d=="function"&&(l.read=d),s(l,p)}l.read&&l.merge&&(l.keyFn=l.keyFn||Nf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?F(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):F(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(tu);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Pe.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,l=lr(s,["fields"]);Object.assign(i,l),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],l=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},u=!!(i&&this.fuzzySubtypes.size),f=!1,d=0;d<c.length;++d){var p=c[d];if(p.has(o))return s.has(o)||(f&&__DEV__&&F.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(l),u&&d===c.length-1&&ks(e.selectionSet,i,n)&&(u=!1,f=!0,this.fuzzySubtypes.forEach(function(h,m){var g=t.match(h);g&&g[0]===t&&l(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=du(e);o;){var l=o(c,s);if(_e(l))o=uu(l);else{a=l||i;break}}return a===void 0&&(a=e.field?_l(e.field,e.variables):Ra(i,du(e))),a===!1?i:i===nr(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=nr(o),c=t.store.getFieldValue(i,o),l=this.getFieldPolicy(e.typename,s,!1),u=l&&l.read;if(u){var f=Mf(this,i,e,t,t.store.getStorage(pe(i)?i.__ref:i,o));return Hn.withValue(this.cache,u,[c,f])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===Df?jf(n.store)(e,t):c===Ff?t:(n.overwrite&&(e=void 0),c(e,t,Mf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function Mf(r,e,t,i,n){var a=r.getStoreFieldName(t),o=nr(a),s=t.variables||i.variables,c=i.store,l=c.toReference,u=c.canRead;return{args:du(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:pe,toReference:l,storage:n,cache:r.cache,canRead:u,readField:function(){return r.readField(Ps(arguments,e,s),i)},mergeObjects:jf(i.store)}}function Ps(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=k({},i),Pe.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&F.warn("Undefined 'from' passed to readField with arguments ".concat(Rd(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function jf(r){return function(t,i){if(_e(t)||_e(i))throw __DEV__?new re("Cannot automatically merge arrays"):new re(4);if(me(t)&&me(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(pe(t)&&Zr(i))return r.merge(t.__ref,i),t;if(Zr(t)&&pe(i))return r.merge(t,i.__ref),i;if(Zr(t)&&Zr(i))return k(k({},t),i)}return i}}function fu(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:k(k({},r),{clientOnly:e,deferred:t})),n}var Qf=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,l=pr(n),u=xf();s=k(k({},Ni(l)),s);var f=k(k({store:e,written:Object.create(null),merge:function(p,h){return u.merge(p,h)},variables:s,varString:Lt(s)},Cs(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:f});if(!pe(d))throw __DEV__?new re("Could not identify object ".concat(JSON.stringify(a))):new re(7);return f.incomingById.forEach(function(p,h){var m=p.storeObject,g=p.mergeTree,_=p.fieldNodeSet,w=ur(h);if(g&&g.map.size){var y=i.applyMerges(g,w,m,f);if(pe(y))return;m=y}if(__DEV__&&!f.overwrite){var b=Object.create(null);_.forEach(function(x){x.selectionSet&&(b[x.name.value]=!0)});var A=function(x){return b[nr(x)]===!0},T=function(x){var O=g&&g.map.get(x);return Boolean(O&&O.info&&O.info.merge)};Object.keys(m).forEach(function(x){A(x)&&!T(x)&&Kv(w,m,x,f.store)})}e.merge(h,m)}),e.retain(d.__ref),d},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,l=Object.create(null),u=i&&c.rootTypenamesById[i]||Pa(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof u=="string"&&(l.__typename=u);var f=function(){var y=Ps(arguments,l,o.variables);if(pe(y.from)){var b=o.incomingById.get(y.from.__ref);if(b){var A=c.readField(k(k({},y),{from:b.storeObject}),o);if(A!==void 0)return A}}return c.readField(y,o)},d=new Set;this.flattenFields(a,n,o,u).forEach(function(y,b){var A,T=Bt(b),x=n[T];if(d.add(b),x!==void 0){var O=c.getStoreFieldName({typename:u,fieldName:b.name.value,field:b,variables:y.variables}),D=qf(s,O),P=t.processFieldValue(x,b,b.selectionSet?fu(y,!1,!1):y,D),U=void 0;b.selectionSet&&(pe(P)||Zr(P))&&(U=f("__typename",P));var ke=c.getMergeFunction(u,b.name.value,U);ke?D.info={field:b,typename:u,merge:ke}:Bf(s,O),l=y.merge(l,(A={},A[O]=P,A))}else __DEV__&&!y.clientOnly&&!y.deferred&&!Di.added(b)&&!c.getReadFunction(u,b.name.value)&&__DEV__&&F.error("Missing field '".concat(Bt(b),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:u,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:l,readField:f}),h=p[0],m=p[1];i=i||h,m&&(l=o.merge(l,m))}catch(y){if(!i)throw y}if(typeof i=="string"){var g=ur(i),_=o.written[i]||(o.written[i]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(n,g,a,o)))return g;var w=o.incomingById.get(i);return w?(w.storeObject=o.merge(w.storeObject,l),w.mergeTree=hu(w.mergeTree,s),d.forEach(function(y){return w.fieldNodeSet.add(y)})):o.incomingById.set(i,{storeObject:l,mergeTree:Ls(s)?void 0:s,fieldNodeSet:d}),g}return l},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?hs(e):e:_e(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,qf(n,s));return Bf(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=Pa(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new dr(!1);return function c(l,u){var f=s.lookup(l,u.clientOnly,u.deferred);f.visited||(f.visited=!0,l.selections.forEach(function(d){if(!!Ar(d,i.variables)){var p=u.clientOnly,h=u.deferred;if(!(p&&h)&&Ve(d.directives)&&d.directives.forEach(function(_){var w=_.name.value;if(w==="client"&&(p=!0),w==="defer"){var y=kr(_,i.variables);(!y||y.if!==!1)&&(h=!0)}}),Pt(d)){var m=a.get(d);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(d,fu(i,p,h))}else{var g=Ri(d,i.lookupFragment);if(!g&&d.kind===je.FRAGMENT_SPREAD)throw __DEV__?new re("No fragment named ".concat(d.name.value)):new re(8);g&&o.fragmentMatches(g,n,t,i.variables)&&c(g.selectionSet,fu(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!pe(i)){var c=!_e(i)&&(pe(t)||Zr(t))?t:void 0,l=i;c&&!a&&(a=[pe(c)?c.__ref:c]);var u,f=function(d,p){return _e(d)?typeof p=="number"?d[p]:void 0:n.store.getFieldValue(d,String(p))};e.map.forEach(function(d,p){var h=f(c,p),m=f(l,p);if(m!==void 0){a&&a.push(p);var g=s.applyMerges(d,h,m,n,a);g!==m&&(u=u||new Map,u.set(p,g)),a&&F(a.pop()===p)}}),u&&(i=_e(l)?l.slice(0):k({},l),u.forEach(function(d,p){i[p]=d}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var Hf=[];function qf(r,e){var t=r.map;return t.has(e)||t.set(e,Hf.pop()||{map:new Map}),t.get(e)}function hu(r,e){if(r===e||!e||Ls(e))return r;if(!r||Ls(r))return e;var t=r.info&&e.info?k(k({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,hu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,hu(e.map.get(s),r.map.get(s)))})}return a}function Ls(r){return!r||!(r.info||r.map.size)}function Bf(r,e){var t=r.map,i=t.get(e);i&&Ls(i)&&(Hf.push(i),t.delete(e))}var Vf=new Set;function Kv(r,e,t,i){var n=function(f){var d=i.getFieldValue(f,t);return typeof d=="object"&&d},a=n(r);if(!!a){var o=n(e);if(!!o&&!pe(a)&&!Te(a,o)&&!Object.keys(a).every(function(f){return i.getFieldValue(o,f)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=nr(t),l="".concat(s,".").concat(c);if(!Vf.has(l)){Vf.add(l);var u=[];!_e(a)&&!_e(o)&&[a,o].forEach(function(f){var d=i.getFieldValue(f,"__typename");typeof d=="string"&&!u.includes(d)&&u.push(d)}),__DEV__&&F.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(u.length?"either ensure all objects of type "+u.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(l,` field, so InMemoryCache can safely merge these objects:
|
|
39
39
|
|
|
@@ -44,42 +44,42 @@ For more information about these options, please refer to the documentation:
|
|
|
44
44
|
|
|
45
45
|
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
46
46
|
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
47
|
-
`))}}}}var
|
|
47
|
+
`))}}}}var Ns=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=Rs,i.txCount=0,i.config=Sf(t),i.addTypename=!!i.config.addTypename,i.policies=new Uf({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var t=this.data=new Qn.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new Qf(this,this.storeReader=new Tf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Ts(this.config),canon:t?void 0:n&&n.canon,fragments:a}),a),this.maybeBroadcastWatch=Mi(function(o,s){return i.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?i.optimisticData:i.data;if(Ui(s)){var c=o.optimistic,l=o.id,u=o.variables;return s.makeCacheKey(o.query,o.callback,Lt({optimistic:c,id:l,variables:u}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var i=t.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(k(k({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(a){if(a instanceof Qa)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(Pe.call(t,"id")&&!t.id)return!1;var i=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(k(k({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var i=this;return this.watches.size||$f(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){i.watches.delete(t)&&!i.watches.size&&su(i),i.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){Lt.reset();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,i){return(i?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,i){return(i?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(pe(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(i){__DEV__&&F.warn(i)}},e.prototype.evict=function(t){if(!t.id){if(Pe.call(t,"id"))return!1;t=k(k({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var i=this;return this.init(),Lt.reset(),t&&t.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),su(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var i=this.optimisticData.removeLayer(t);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(t){var i=this,n=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,l,u=function(d){var p=i,h=p.data,m=p.optimisticData;++i.txCount,d&&(i.data=i.optimisticData=d);try{return l=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},f=new Set;return c&&!this.txCount&&this.broadcastWatches(k(k({},t),{onWatchUpdated:function(d){return f.add(d),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,u):o===!1?u(this.data):u(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&f.size?(this.broadcastWatches(k(k({},t),{onWatchUpdated:function(d,p){var h=c.call(this,d,p);return h!==!1&&f.delete(d),h}})),f.size&&f.forEach(function(d){return i.maybeBroadcastWatch.dirty(d)})):this.broadcastWatches(t),l},e.prototype.performTransaction=function(t,i){return this.batch({update:t,optimistic:i||i!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var i=this.typenameDocumentCache.get(t);return i||(i=Di(t),this.typenameDocumentCache.set(t,i),this.typenameDocumentCache.set(i,i)),i}return t},e.prototype.transformForLink=function(t){var i=this.config.fragments;return i?i.transform(t):t},e.prototype.broadcastWatches=function(t){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,t)})},e.prototype.broadcastWatch=function(t,i){var n=t.lastDiff,a=this.diff(t);i&&(t.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,t,a,n)===!1)||(!n||!Te(n.result,a.result))&&t.callback(t.lastDiff=a,n)},e}(eu);function zf(r){return r.hasOwnProperty("graphQLErrors")}var Jv=function(r){var e="";if(Ve(r.graphQLErrors)||Ve(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
|
|
48
48
|
`)})}return r.networkError&&(e+="".concat(r.networkError.message,`
|
|
49
|
-
`)),e=e.replace(/\n$/,""),e},Ir=function(r){
|
|
50
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ae(this.options.variables,t)&&(n.variables=this.options.variables=E(E({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,ge.refetch)},e.prototype.fetchMore=function(t){var i=this,n=E(E({},t.query?t:E(E(E(E({},this.options),{query:this.query}),t),{variables:E(E({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ge.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,ge.fetchMore).then(function(l){return i.queryManager.removeQuery(a),o.networkStatus===ge.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(u){var d=t.updateQuery;d?u.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:l.data,variables:n.variables})}):u.writeQuery({query:n.query,variables:n.variables,data:l.data})},onWatchUpdated:function(u){c.add(u.query)}}),l}).finally(function(){c.has(i.query)||fu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var l=c.variables;return o(s,{subscriptionData:a,variables:l})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&D.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ae(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},ge.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?D(a,"Attempted to start a polling query without a polling interval."):D(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Yr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ge.poll).then(c,c))},c=function(){var l=t.pollingInfo;l&&(clearTimeout(l.timeout),l.timeout=setTimeout(s,l.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?t:ds(t),variables:i}),Ve(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===ge.refetch||i===ge.fetchMore||i===ge.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Gr(this.options,t||{}),l=a?c:Hv(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ae(t.variables,o)&&l.fetchPolicy!=="standby"&&l.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",l),i===void 0&&(i=ge.setVariables)));var u=l.variables&&E({},l.variables),d=this.fetch(l,i),f={next:function(p){n.reportResult(p,u)},error:function(p){n.reportError(p,u)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Ni(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:ge.error,loading:!1});this.updateLastResult(n,i),Ni(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(se);hs(Ls);function fu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function Wv(r){__DEV__&&D.error("Unhandled error",r.message,r.stack)}function hu(r){__DEV__&&r&&__DEV__&&D.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Ns=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=Il(t.resolvers,i)}):this.resolvers=Il(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Xt(this,void 0,void 0,function(){return er(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(l){return E(E({},i),{data:l.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Pn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return Al(e)},r.prototype.prepareContext=function(e){var t=this.cache;return E(E({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Xt(this,void 0,void 0,function(){return er(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return E(E({},t),a.exportedVariables)})]:[2,E({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return st(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return Ti}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:kl(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Xt(this,void 0,void 0,function(){var s,c,l,u,d,f,p,h,m,y,b;return er(this,function(_){return s=Pi(e),c=$i(e),l=Ci(c),u=this.collectSelectionsToResolve(s,l),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:l,context:E(E({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},b=!1,[2,this.resolveSelectionSet(s.selectionSet,b,t,y).then(function(S){return{result:S,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Xt(this,void 0,void 0,function(){var a,o,s,c,l,u=this;return er(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],l=function(f){return Xt(u,void 0,void 0,function(){var p,h;return er(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:kr(f,s)?Pt(f)?[2,this.resolveField(f,t,i,n).then(function(y){var b;typeof y<"u"&&c.push((b={},b[qt(f)]=y,b))})]:(Sl(f)?p=f:(p=a[f.name.value],__DEV__?D(p,"No fragment named ".concat(f.name.value)):D(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return Ra(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Xt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h=this;return er(this,function(m){return i?(a=n.variables,o=e.name.value,s=qt(e),c=o!==s,l=i[s]||i[o],u=Promise.resolve(l),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(u=Promise.resolve(Vn.withValue(this.cache,p,[i,Ar(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,u.then(function(y){var b,_;if(y===void 0&&(y=l),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(C){C.name.value==="as"&&C.value.kind==="StringValue"&&(n.exportedVariables[C.value.value]=y)})}),!e.selectionSet||y==null)return y;var S=(_=(b=e.directives)===null||b===void 0?void 0:b.some(function(v){return v.name.value==="client"}))!==null&&_!==void 0?_:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||S,y,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,y,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),st(o,{Directive:function(c,l,u,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&Ta(p)&&s.add(p)})},FragmentSpread:function(c,l,u,d,f){var p=t[c.name.value];__DEV__?D(p,"No fragment named ".concat(c.name.value)):D(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&Ta(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Hn=new(Bt?WeakMap:Map);function mu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Hn.set(r,(Hn.get(r)+1)%1e15),t.apply(this,arguments)})}function qf(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Ds=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Hn.has(i)||(Hn.set(i,0),mu(i,"evict"),mu(i,"modify"),mu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||ge.loading;return this.variables&&this.networkStatus!==ge.loading&&!Ae(this.variables,e.variables)&&(t=ge.setVariables),Ae(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){qf(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ae(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ae(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():fu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;qf(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Yr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ae(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Hn.get(this.cache)&&Ae(t,i.variables)&&Ae(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new _t,s=Ve(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Ve(e.incremental)){var c=ms(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var l=this.getDiff();e.data=o.merge(l.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(Fs(e,i.errorPolicy)?this.cache.performTransaction(function(u){if(a.shouldWrite(e,i.variables))u.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Hn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=u.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ge.ready},r.prototype.markError=function(e){return this.networkStatus=ge.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Fs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!Mn(r);return!i&&t&&r.data&&(i=!0),i}var Gv=Object.prototype.hasOwnProperty,Bf=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,l=c===void 0?!1:c,u=e.clientAwareness,d=u===void 0?{}:u,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Bt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new Ns({cache:t}),this.ssrMode=l,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new ee("QueryManager stopped while query was in flight"):new ee(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,l=c===void 0?[]:c,u=e.awaitRefetchQueries,d=u===void 0?!1:u,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,b=y===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":y,_=e.keepRootFields,S=e.context;return Xt(this,void 0,void 0,function(){var v,C,$,I,L,M;return er(this,function(N){switch(N.label){case 0:return __DEV__?D(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):D(n,15),__DEV__?D(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."):D(m==="network-only"||m==="no-cache",16),v=this.generateMutationId(),C=this.transform(n),$=C.document,I=C.hasClientExports,n=this.cache.transformForLink($),a=this.getVariables(n,a),I?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=N.sent(),N.label=2;case 2:return L=this.mutationStore&&(this.mutationStore[v]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:n,variables:a,fetchPolicy:m,errorPolicy:b,context:S,updateQueries:s,update:f,keepRootFields:_}),this.broadcastQueries(),M=this,[2,new Promise(function(W,Ie){return fs(M.getObservableFromLink(n,E(E({},S),{optimisticResponse:o}),a,!1),function(Oe){if(Mn(Oe)&&b==="none")throw new Ir({graphQLErrors:gs(Oe)});L&&(L.loading=!1,L.error=null);var T=E({},Oe);return typeof l=="function"&&(l=l(T)),b==="ignore"&&Mn(T)&&delete T.errors,M.markMutationResult({mutationId:v,result:T,document:n,variables:a,fetchPolicy:m,errorPolicy:b,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:l,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:_})}).subscribe({next:function(Oe){M.broadcastQueries(),(!("hasNext"in Oe)||Oe.hasNext===!1)&&W(Oe)},error:function(Oe){L&&(L.loading=!1,L.error=Oe),o&&M.cache.removeOptimistic(v),M.broadcastQueries(),Ie(Oe instanceof Ir?Oe:new Ir({networkError:Oe}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Fs(n,e.errorPolicy)){if(Wr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Wr(n)&&Ve(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=ms(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var l=e.updateQueries;l&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!Gv.call(l,h))){var m=l[h],y=i.queries.get(f),b=y.document,_=y.variables,S=t.diff({query:b,variables:_,returnPartialData:!0,optimistic:!1}),v=S.result,C=S.complete;if(C&&v){var $=m(v,{mutationResult:n,queryName:b&&Ln(b)||void 0,queryVariables:_});$&&a.push({result:$,dataId:"ROOT_QUERY",query:b,variables:_})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Ed(n)||Wr(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=E(E({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,y){var b=y.fieldName,_=y.DELETE;return b==="__typename"?m:_}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return u.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(E(E({},t),{result:{data:n}}),a)}catch(o){__DEV__&&D.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=El(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:yl(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ri(ur(i)),asQuery:E(E({},i),{definitions:i.definitions.map(function(l){return l.kind==="OperationDefinition"&&l.operation!=="query"?E(E({},l),{operation:"query"}):l})})},c=function(l){l&&!t.has(l)&&t.set(l,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return E(E({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Ds(this),i=new Ls({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?D(e.query,"query option is required. You must specify your GraphQL document in the query option."):D(e.query,17),__DEV__?D(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):D(e.query.kind==="Document",18),__DEV__?D(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):D(!e.returnPartialData,19),__DEV__?D(!e.pollInterval,"pollInterval option only supported on watchQuery."):D(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new ee("Store reset while query was in flight (not completed in link chain)"):new ee(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=ge.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):bl(o)?n.set(t.transform(o).document,!1):he(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,l=o.document;if(c){if(e==="all"){i.set(s,c);return}var u=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||u&&n.has(u)||l&&n.has(l))&&(i.set(s,c),u&&n.set(u,!0),l&&n.set(l,!0))}}),a.size&&a.forEach(function(o){var s=Da("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),l=new Ls({queryManager:t,queryInfo:c,options:E(E({},o),{fetchPolicy:"network-only"})});D(l.queryId===s),c.setObservableQuery(l),i.set(s,l)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&D.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var l=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(Fs(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),Mn(f))throw new Ir({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var u=this.localState.addExportedVariables(i,o,c).then(l);return new se(function(d){var f=null;return u.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return l(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var l=this,u=l.inFlightLinkObservables,d=l.link,f={query:c,variables:i,operationName:Ln(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!n}))};if(t=f.context,n){var p=u.get(c)||new Map;u.set(c,p);var h=Rt(i);if(s=p.get(h),!s){var m=new Fn([Un(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&u.delete(c)})}}else s=new Fn([Un(d,f)])}else s=new Fn([se.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=fs(s,function(b){return a.localState.runResolvers({document:y,remoteResult:b,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return fs(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=gs(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new Ir({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var l={data:o.data,loading:!1,networkStatus:ge.ready};return c&&i.errorPolicy!=="ignore"&&(l.errors=s,l.networkStatus=ge.error),l},function(o){var s=jf(o)?o:new Ir({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=ge.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,u=l===void 0?c&&c.fetchPolicy||"cache-first":l,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,b=t.context,_=b===void 0?{}:b,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:u,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:y,context:_}),v=function(I){S.variables=I;var L=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&L.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),L},C=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(I){C(),setTimeout(function(){return $.cancel(I)})});var $=new Fn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(v):v(S.variables));return $.promise.then(C,C),$},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Da("refetchQueries"):void 0:s,l=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){u.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof Ds&&f.watcher.observableQuery;if(m){if(l){u.delete(m.queryId);var y=l(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&d.set(m,y),y}l!==null&&u.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),u.size&&u.forEach(function(f,p){var h=f.oq,m=f.lastDiff,y=f.diff,b;if(l){if(!y){var _=h.queryInfo;_.reset(),y=_.getDiff()}b=l(h,y,m)}(!l||b===!0)&&(b=h.refetch()),b!==!1&&d.set(h,b),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,u=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(v,C){C===void 0&&(C=e.networkStatus||ge.loading);var $=v.result;__DEV__&&!u&&!Ae($,{})&&hu(v.missing);var I=function(L){return se.of(E({data:L,loading:Yr(C),networkStatus:C},v.complete?null:{partial:!0}))};return $&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:$},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(L){return I(L.data||void 0)}):l==="none"&&C===ge.refetch&&Array.isArray(v.missing)?I(void 0):I($)},y=s==="no-cache"?0:i===ge.refetch&&c!=="merge"?1:2,b=function(){return n.getResultsFromLink(e,y,{variables:o,context:d,fetchPolicy:s,errorPolicy:l})},_=f&&typeof p=="number"&&p!==i&&Yr(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:u||_?[m(S),b()]:[b()]}case"cache-and-network":{var S=h();return S.complete||u||_?[m(S),b()]:[b()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return _?[m(h()),b()]:[b()];case"no-cache":return _?[m(e.getDiff()),b()]:[b()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Ds(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return E(E({},t),{clientAwareness:this.clientAwareness})},r}();var Vf=!1;var gu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,l=e.ssrForceFetchDelay,u=l===void 0?0:l,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,b=y===void 0?!1:y,_=e.resolvers,S=e.typeDefs,v=e.fragmentMatcher,C=e.name,$=e.version,I=e.link;if(I||(I=i?new Ql({uri:i,credentials:n,headers:a}):Vt.empty()),!o)throw __DEV__?new ee(`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 ee(9);if(this.link=I,this.cache=o,this.disableNetworkFetches=c||u>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,u&&setTimeout(function(){return t.disableNetworkFetches=!1},u),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),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!Vf&&f&&__DEV__&&(Vf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var L=window.navigator,M=L&&L.userAgent,N=void 0;typeof M=="string"&&(M.indexOf("Chrome/")>-1?N="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":M.indexOf("Firefox/")>-1&&(N="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),N&&__DEV__&&D.log("Download the Apollo DevTools for a better development experience: "+N)}this.version=Td,this.localState=new Ns({cache:o,client:this,resolvers:_,fragmentMatcher:v}),this.queryManager=new Bf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:C,version:$},localState:this.localState,assumeImmutableResults:b,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Fa(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Fa(this.defaultOptions.query,e)),__DEV__?D(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."):D(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Fa(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Un(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&D.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();ed(Ii?"log":"silent");function pt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Tr(r){return pt(r)==="object"}function Qf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function yu(r,e){return r.length<124?r:e}var Hf="graphql-transport-ws";var xt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(xt||(xt={}));var Le;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Le||(Le={}));function zf(r){if(!Tr(r))throw new Error(`Message is expected to be an object, but got ${pt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${pt(r.type)}`);switch(r.type){case Le.ConnectionInit:case Le.ConnectionAck:case Le.Ping:case Le.Pong:{if(r.payload!=null&&!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Le.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${pt(r.payload.query)}`);if(r.payload.variables!=null&&!Tr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${pt(r.payload.variables)}`);if(r.payload.operationName!=null&&pt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${pt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Tr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${pt(r.payload.extensions)}`);break}case Le.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);break}case Le.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Qf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Le.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function Wf(r,e){return zf(typeof r=="string"?JSON.parse(r,e):r)}function zn(r,e){return zf(r),JSON.stringify(r,e)}function vu(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:l=5,retryWait:u=async function(we){let Se=1e3;for(let de=0;de<we;de++)Se*=2;await new Promise(de=>setTimeout(de,Se+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Ms,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Se=Math.random()*16|0;return(we=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:b}=r,_;if(h){if(!Jv(h))throw new Error("Invalid WebSocket implementation provided");_=h}else typeof WebSocket<"u"?_=WebSocket:typeof global<"u"?_=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(_=window.WebSocket||window.MozWebSocket);if(!_)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=_,v=(()=>{let T=(()=>{let Se={};return{on(de,fe){return Se[de]=fe,()=>{delete Se[de]}},emit(de){var fe;"id"in de&&((fe=Se[de.id])===null||fe===void 0||fe.call(Se,de))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[T.emit,p.message]:[T.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:T.on,on(Se,de){let fe=we[Se];return fe.push(de),()=>{fe.splice(fe.indexOf(de),1)}},emit(Se,...de){for(let fe of[...we[Se]])fe(...de)}}})();function C(T){let we=[v.on("error",Se=>{we.forEach(de=>de()),T(Se)}),v.on("closed",Se=>{we.forEach(de=>de()),T(Se)})]}let $,I=0,L,M=!1,N=0,W=!1;async function Ie(){clearTimeout(L);let[T,we]=await($??($=new Promise((fe,or)=>(async()=>{if(M){if(await u(N),!I)return $=void 0,or({code:1e3,reason:"All Subscriptions Gone"});N++}v.emit("connecting");let oe=new S(typeof e=="function"?await e():e,Hf),sr,Br;function ts(){isFinite(o)&&o>0&&(clearTimeout(Br),Br=setTimeout(()=>{oe.readyState===S.OPEN&&(oe.send(zn({type:Le.Ping})),v.emit("ping",!1,void 0))},o))}C(tt=>{$=void 0,clearTimeout(sr),clearTimeout(Br),or(tt),Ms(tt)&&tt.code===4499&&(oe.close(4499,"Terminated"),oe.onerror=null,oe.onclose=null)}),oe.onerror=tt=>v.emit("error",tt),oe.onclose=tt=>v.emit("closed",tt),oe.onopen=async()=>{try{v.emit("opened",oe);let tt=typeof t=="function"?await t():t;if(oe.readyState!==S.OPEN)return;oe.send(zn(tt?{type:Le.ConnectionInit,payload:tt}:{type:Le.ConnectionInit},y)),isFinite(c)&&c>0&&(sr=setTimeout(()=>{oe.close(xt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),ts()}catch(tt){v.emit("error",tt),oe.close(xt.InternalClientError,yu(tt instanceof Error?tt.message:new Error(tt).message,"Internal client error"))}};let On=!1;oe.onmessage=({data:tt})=>{try{let rt=Wf(tt,b);if(v.emit("message",rt),rt.type==="ping"||rt.type==="pong"){v.emit(rt.type,!0,rt.payload),rt.type==="pong"?ts():s||(oe.send(zn(rt.payload?{type:Le.Pong,payload:rt.payload}:{type:Le.Pong})),v.emit("pong",!1,rt.payload));return}if(On)return;if(rt.type!==Le.ConnectionAck)throw new Error(`First message cannot be of type ${rt.type}`);clearTimeout(sr),On=!0,v.emit("connected",oe,rt.payload),M=!1,N=0,fe([oe,new Promise((n_,Zg)=>C(Zg))])}catch(rt){oe.onmessage=null,v.emit("error",rt),oe.close(xt.BadResponse,yu(rt instanceof Error?rt.message:new Error(rt).message,"Bad response"))}}})())));T.readyState===S.CLOSING&&await we;let Se=()=>{},de=new Promise(fe=>Se=fe);return[T,Se,Promise.race([de.then(()=>{if(!I){let fe=()=>T.close(1e3,"Normal Closure");isFinite(a)&&a>0?L=setTimeout(()=>{T.readyState===S.OPEN&&fe()},a):fe()}}),we])]}function Oe(T){if(Ms(T)&&(Kv(T.code)||[xt.InternalServerError,xt.InternalClientError,xt.BadRequest,xt.BadResponse,xt.Unauthorized,xt.SubprotocolNotAcceptable,xt.SubscriberAlreadyExists,xt.TooManyInitialisationRequests].includes(T.code)))throw T;if(W)return!1;if(Ms(T)&&T.code===1e3)return I>0;if(!l||N>=l||!d(T)||f?.(T))throw T;return M=!0}return i||(async()=>{for(I++;;)try{let[,,T]=await Ie();await T}catch(T){try{if(!Oe(T))return}catch(we){return n?.(we)}}})(),{on:v.on,subscribe(T,we){let Se=m(T),de=!1,fe=!1,or=()=>{I--,de=!0};return(async()=>{for(I++;;)try{let[oe,sr,Br]=await Ie();if(de)return sr();let ts=v.onMessage(Se,On=>{switch(On.type){case Le.Next:{we.next(On.payload);return}case Le.Error:{fe=!0,de=!0,we.error(On.payload),or();return}case Le.Complete:{de=!0,or();return}}});oe.send(zn({id:Se,type:Le.Subscribe,payload:T},y)),or=()=>{!de&&oe.readyState===S.OPEN&&oe.send(zn({id:Se,type:Le.Complete},y)),I--,de=!0,sr()},await Br.finally(ts);return}catch(oe){if(!Oe(oe))return}})().then(()=>{fe||we.complete()}).catch(oe=>{we.error(oe)}),()=>{de||or()}},async dispose(){if(W=!0,$){let[T]=await $;T.close(1e3,"Normal Closure")}},terminate(){$&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Ms(r){return Tr(r)&&"code"in r&&"reason"in r}function Kv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function Jv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Zv(r){return he(r)&&"code"in r&&"reason"in r}var Gf=function(r){Pe(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new se(function(n){return i.client.subscribe(E(E({},t),{query:$n(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):Zv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new Ir({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Vt);var Us="0.13.0-test-2";function js(){return typeof window!="undefined"&&window.self!==window.top}function bu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function dt(r,e){bu()&&localStorage.setItem(`${Us}/${r}`,e)}function Ha(r){return bu()?localStorage.getItem(`${Us}/${r}`):null}function Wn(r){bu()&&localStorage.removeItem(`${Us}/${r}`)}function Mi(r,e=1e4){return V(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function Kf(r){let e=r.trim();if(!e)return"";let t=e.split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Jf(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);return(e%360+360)%360}var gc=function(){return gc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},gc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function ec(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ec=function(t){return typeof t}:ec=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ec(r)}function Xv(r){return ec(r)=="object"&&r!==null}var _m=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function ju(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function eb(r){return xm(r.source,ju(r.source,r.start))}function xm(r,e){var t=r.locationOffset.column-1,i=tc(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,l="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
-
`),u=i.split(/\r\n|[\n\r]/g),
|
|
53
|
-
`)}function
|
|
49
|
+
`)),e=e.replace(/\n$/,""),e},Ir=function(r){Re(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||Jv(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var ve;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(ve||(ve={}));function Xr(r){return r?r<7:!1}var Zv=Object.assign,Yv=Object.hasOwnProperty,Ds=function(r){Re(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(g){try{var _=g._subscription._observer;_&&!_.error&&(_.error=Xv)}catch{}var w=!o.observers.size;o.observers.add(g);var y=o.last;return y&&y.error?g.error&&g.error(y.error):y&&y.result&&g.next&&g.next(y.result),w&&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=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,l=c.fetchPolicy,u=l===void 0?"cache-first":l,f=a.fetchPolicy,d=f===void 0?u:f,p=a.initialFetchPolicy,h=p===void 0?d==="standby"?u:d:p;o.options=k(k({},a),{initialFetchPolicy:h,fetchPolicy:d}),o.queryId=n.queryId||i.generateQueryId();var m=pr(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 t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||ve.ready,a=k(k({},i),{loading:Xr(n),networkStatus:n}),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),Te(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===ve.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ve.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&gu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!Te(this.last.result,t)||i&&!Te(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||Te(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&Yv.call(t,"variables")){var o=La(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&F.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
|
|
50
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Te(this.options.variables,t)&&(n.variables=this.options.variables=k(k({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,ve.refetch)},e.prototype.fetchMore=function(t){var i=this,n=k(k({},t.query?t:k(k(k(k({},this.options),{query:this.query}),t),{variables:k(k({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ve.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,ve.fetchMore).then(function(l){return i.queryManager.removeQuery(a),o.networkStatus===ve.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(u){var f=t.updateQuery;f?u.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(d){return f(d,{fetchMoreResult:l.data,variables:n.variables})}):u.writeQuery({query:n.query,variables:n.variables,data:l.data})},onWatchUpdated:function(u){c.add(u.query)}}),l}).finally(function(){c.has(i.query)||mu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var l=c.variables;return o(s,{subscriptionData:a,variables:l})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&F.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Te(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},ve.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?F(a,"Attempted to start a polling query without a polling interval."):F(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Xr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ve.poll).then(c,c))},c=function(){var l=t.pollingInfo;l&&(clearTimeout(l.timeout),l.timeout=setTimeout(s,l.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=k(k({},this.last),{result:this.queryManager.assumeImmutableResults?t:hs(t),variables:i}),Ve(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===ve.refetch||i===ve.fetchMore||i===ve.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Kr(this.options,t||{}),l=a?c:Zv(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Te(t.variables,o)&&l.fetchPolicy!=="standby"&&l.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",l),i===void 0&&(i=ve.setVariables)));var u=l.variables&&k({},l.variables),f=this.fetch(l,i),d={next:function(p){n.reportResult(p,u)},error:function(p){n.reportError(p,u)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=d),f.addObserver(d),f.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Fi(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=k(k({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:ve.error,loading:!1});this.updateLastResult(n,i),Fi(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(le);gs(Ds);function mu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function Xv(r){__DEV__&&F.error("Unhandled error",r.message,r.stack)}function gu(r){__DEV__&&r&&__DEV__&&F.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Fs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=Cl(t.resolvers,i)}):this.resolvers=Cl(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return er(this,void 0,void 0,function(){return tr(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(l){return k(k({},i),{data:l.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Ln(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return Tl(e)},r.prototype.prepareContext=function(e){var t=this.cache;return k(k({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),er(this,void 0,void 0,function(){return tr(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return k(k({},t),a.exportedVariables)})]:[2,k({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return st(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return $i}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:Il(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),er(this,void 0,void 0,function(){var s,c,l,u,f,d,p,h,m,g,_;return tr(this,function(w){return s=Li(e),c=Pi(e),l=Oi(c),u=this.collectSelectionsToResolve(s,l),f=s.operation,d=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,h=p.cache,m=p.client,g={fragmentMap:l,context:k(k({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,g).then(function(y){return{result:y,exportedVariables:g.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return er(this,void 0,void 0,function(){var a,o,s,c,l,u=this;return tr(this,function(f){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],l=function(d){return er(u,void 0,void 0,function(){var p,h;return tr(this,function(m){return!t&&!n.selectionsToResolve.has(d)?[2]:Ar(d,s)?Pt(d)?[2,this.resolveField(d,t,i,n).then(function(g){var _;typeof g<"u"&&c.push((_={},_[Bt(d)]=g,_))})]:(xl(d)?p=d:(p=a[d.name.value],__DEV__?F(p,"No fragment named ".concat(d.name.value)):F(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return Na(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return er(this,void 0,void 0,function(){var a,o,s,c,l,u,f,d,p,h=this;return tr(this,function(m){return i?(a=n.variables,o=e.name.value,s=Bt(e),c=o!==s,l=i[s]||i[o],u=Promise.resolve(l),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(f=i.__typename||n.defaultOperationType,d=this.resolvers&&this.resolvers[f],d&&(p=d[c?o:s],p&&(u=Promise.resolve(Hn.withValue(this.cache,p,[i,kr(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,u.then(function(g){var _,w;if(g===void 0&&(g=l),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"&&(n.exportedVariables[A.value.value]=g)})}),!e.selectionSet||g==null)return g;var y=(w=(_=e.directives)===null||_===void 0?void 0:_.some(function(b){return b.name.value==="client"}))!==null&&w!==void 0?w:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,t||y,g,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||y,g,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),st(o,{Directive:function(c,l,u,f,d){c.name.value==="client"&&d.forEach(function(p){i(p)&&$a(p)&&s.add(p)})},FragmentSpread:function(c,l,u,f,d){var p=t[c.name.value];__DEV__?F(p,"No fragment named ".concat(c.name.value)):F(p,12);var h=a(p);h.size>0&&(d.forEach(function(m){i(m)&&$a(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Wn=new(Vt?WeakMap:Map);function yu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Wn.set(r,(Wn.get(r)+1)%1e15),t.apply(this,arguments)})}function Wf(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Ms=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Wn.has(i)||(Wn.set(i,0),yu(i,"evict"),yu(i,"modify"),yu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||ve.loading;return this.variables&&this.networkStatus!==ve.loading&&!Te(this.variables,e.variables)&&(t=ve.setVariables),Te(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){Wf(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Te(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Te(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():mu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;Wf(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Xr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=k(k({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Te(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Wn.get(this.cache)&&Te(t,i.variables)&&Te(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new _t,s=Ve(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Ve(e.incremental)){var c=ys(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var l=this.getDiff();e.data=o.merge(l.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(Us(e,i.errorPolicy)?this.cache.performTransaction(function(u){if(a.shouldWrite(e,i.variables))u.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Wn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var f=a.getDiffOptions(i.variables),d=u.diff(f);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(d,f),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ve.ready},r.prototype.markError=function(e){return this.networkStatus=ve.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Us(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!jn(r);return!i&&t&&r.data&&(i=!0),i}var eb=Object.prototype.hasOwnProperty,Gf=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,l=c===void 0?!1:c,u=e.clientAwareness,f=u===void 0?{}:u,d=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Vt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=f,this.localState=d||new Fs({cache:t}),this.ssrMode=l,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new re("QueryManager stopped while query was in flight"):new re(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,l=c===void 0?[]:c,u=e.awaitRefetchQueries,f=u===void 0?!1:u,d=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,g=e.errorPolicy,_=g===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":g,w=e.keepRootFields,y=e.context;return er(this,void 0,void 0,function(){var b,A,T,x,O,D;return tr(this,function(P){switch(P.label){case 0:return __DEV__?F(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):F(n,15),__DEV__?F(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."):F(m==="network-only"||m==="no-cache",16),b=this.generateMutationId(),A=this.transform(n),T=A.document,x=A.hasClientExports,n=this.cache.transformForLink(T),a=this.getVariables(n,a),x?[4,this.localState.addExportedVariables(n,a,y)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return O=this.mutationStore&&(this.mutationStore[b]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:b,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:y,updateQueries:s,update:d,keepRootFields:w}),this.broadcastQueries(),D=this,[2,new Promise(function(U,ke){return ms(D.getObservableFromLink(n,k(k({},y),{optimisticResponse:o}),a,!1),function(Ie){if(jn(Ie)&&_==="none")throw new Ir({graphQLErrors:vs(Ie)});O&&(O.loading=!1,O.error=null);var C=k({},Ie);return typeof l=="function"&&(l=l(C)),_==="ignore"&&jn(C)&&delete C.errors,D.markMutationResult({mutationId:b,result:C,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:y,update:d,updateQueries:s,awaitRefetchQueries:f,refetchQueries:l,removeOptimistic:o?b:void 0,onQueryUpdated:p,keepRootFields:w})}).subscribe({next:function(Ie){D.broadcastQueries(),(!("hasNext"in Ie)||Ie.hasNext===!1)&&U(Ie)},error:function(Ie){O&&(O.loading=!1,O.error=Ie),o&&D.cache.removeOptimistic(b),D.broadcastQueries(),ke(Ie instanceof Ir?Ie:new Ir({networkError:Ie}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Us(n,e.errorPolicy)){if(Gr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Gr(n)&&Ve(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=ys(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var l=e.updateQueries;l&&this.queries.forEach(function(f,d){var p=f.observableQuery,h=p&&p.queryName;if(!(!h||!eb.call(l,h))){var m=l[h],g=i.queries.get(d),_=g.document,w=g.variables,y=t.diff({query:_,variables:w,returnPartialData:!0,optimistic:!1}),b=y.result,A=y.complete;if(A&&b){var T=m(b,{mutationResult:n,queryName:_&&Dn(_)||void 0,queryVariables:w});T&&a.push({result:T,dataId:"ROOT_QUERY",query:_,variables:w})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(f){o||a.forEach(function(m){return f.write(m)});var d=e.update,p=!$d(n)||Gr(n)&&!n.hasNext;if(d){if(!o){var h=f.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=k(k({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&d(f,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&f.modify({id:"ROOT_MUTATION",fields:function(m,g){var _=g.fieldName,w=g.DELETE;return _==="__typename"?m:w}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(f){return u.push(f)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(k(k({},t),{result:{data:n}}),a)}catch(o){__DEV__&&F.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=kl(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:bl(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ni(pr(i)),asQuery:k(k({},i),{definitions:i.definitions.map(function(l){return l.kind==="OperationDefinition"&&l.operation!=="query"?k(k({},l),{operation:"query"}):l})})},c=function(l){l&&!t.has(l)&&t.set(l,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return k(k({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=k(k({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Ms(this),i=new Ds({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?F(e.query,"query option is required. You must specify your GraphQL document in the query option."):F(e.query,17),__DEV__?F(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):F(e.query.kind==="Document",18),__DEV__?F(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):F(!e.returnPartialData,19),__DEV__?F(!e.pollInterval,"pollInterval option only supported on watchQuery."):F(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new re("Store reset while query was in flight (not completed in link chain)"):new re(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=ve.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):Sl(o)?n.set(t.transform(o).document,!1):me(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,l=o.document;if(c){if(e==="all"){i.set(s,c);return}var u=c.queryName,f=c.options.fetchPolicy;if(f==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||u&&n.has(u)||l&&n.has(l))&&(i.set(s,c),u&&n.set(u,!0),l&&n.set(l,!0))}}),a.size&&a.forEach(function(o){var s=Ma("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),l=new Ds({queryManager:t,queryInfo:c,options:k(k({},o),{fetchPolicy:"network-only"})});F(l.queryId===s),c.setObservableQuery(l),i.set(s,l)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&F.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var l=function(f){return t.getObservableFromLink(i,c,f).map(function(d){if(n!=="no-cache"&&(Us(d,a)&&t.cache.write({query:i,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:f}),t.broadcastQueries()),jn(d))throw new Ir({graphQLErrors:d.errors});return d})};if(this.transform(i).hasClientExports){var u=this.localState.addExportedVariables(i,o,c).then(l);return new le(function(f){var d=null;return u.then(function(p){return d=p.subscribe(f)},f.error),function(){return d&&d.unsubscribe()}})}return l(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var l=this,u=l.inFlightLinkObservables,f=l.link,d={query:c,variables:i,operationName:Dn(c)||void 0,context:this.prepareContext(k(k({},t),{forceFetch:!n}))};if(t=d.context,n){var p=u.get(c)||new Map;u.set(c,p);var h=Lt(i);if(s=p.get(h),!s){var m=new Un([qn(f,d)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&u.delete(c)})}}else s=new Un([qn(f,d)])}else s=new Un([le.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=ms(s,function(_){return a.localState.runResolvers({document:g,remoteResult:_,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return ms(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=vs(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new Ir({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var l={data:o.data,loading:!1,networkStatus:ve.ready};return c&&i.errorPolicy!=="ignore"&&(l.errors=s,l.networkStatus=ve.error),l},function(o){var s=zf(o)?o:new Ir({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=ve.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,u=l===void 0?c&&c.fetchPolicy||"cache-first":l,f=t.errorPolicy,d=f===void 0?c&&c.errorPolicy||"none":f,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,g=m===void 0?!1:m,_=t.context,w=_===void 0?{}:_,y=Object.assign({},t,{query:a,variables:o,fetchPolicy:u,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:g,context:w}),b=function(x){y.variables=x;var O=n.fetchQueryByPolicy(s,y,i);return y.fetchPolicy!=="standby"&&O.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),O},A=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(x){A(),setTimeout(function(){return T.cancel(x)})});var T=new Un(this.transform(y.query).hasClientExports?this.localState.addExportedVariables(y.query,y.variables,y.context).then(b):b(y.variables));return T.promise.then(A,A),T},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Ma("refetchQueries"):void 0:s,l=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach(function(d,p){u.set(p,{oq:d,lastDiff:t.getQuery(p).getDiff()})});var f=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,p,h){var m=d.watcher instanceof Ms&&d.watcher.observableQuery;if(m){if(l){u.delete(m.queryId);var g=l(m,p,h);return g===!0&&(g=m.refetch()),g!==!1&&f.set(m,g),g}l!==null&&u.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),u.size&&u.forEach(function(d,p){var h=d.oq,m=d.lastDiff,g=d.diff,_;if(l){if(!g){var w=h.queryInfo;w.reset(),g=w.getDiff()}_=l(h,g,m)}(!l||_===!0)&&(_=h.refetch()),_!==!1&&f.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),f},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,u=t.returnPartialData,f=t.context,d=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(b,A){A===void 0&&(A=e.networkStatus||ve.loading);var T=b.result;__DEV__&&!u&&!Te(T,{})&&gu(b.missing);var x=function(O){return le.of(k({data:O,loading:Xr(A),networkStatus:A},b.complete?null:{partial:!0}))};return T&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:T},context:f,variables:o,onlyRunForcedResolvers:!0}).then(function(O){return x(O.data||void 0)}):l==="none"&&A===ve.refetch&&Array.isArray(b.missing)?x(void 0):x(T)},g=s==="no-cache"?0:i===ve.refetch&&c!=="merge"?1:2,_=function(){return n.getResultsFromLink(e,g,{variables:o,context:f,fetchPolicy:s,errorPolicy:l})},w=d&&typeof p=="number"&&p!==i&&Xr(i);switch(s){default:case"cache-first":{var y=h();return y.complete?[m(y,e.markReady())]:u||w?[m(y),_()]:[_()]}case"cache-and-network":{var y=h();return y.complete||u||w?[m(y),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return w?[m(h()),_()]:[_()];case"no-cache":return w?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Ms(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return k(k({},t),{clientAwareness:this.clientAwareness})},r}();var Kf=!1;var vu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,l=e.ssrForceFetchDelay,u=l===void 0?0:l,f=e.connectToDevTools,d=f===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:f,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,g=e.assumeImmutableResults,_=g===void 0?!1:g,w=e.resolvers,y=e.typeDefs,b=e.fragmentMatcher,A=e.name,T=e.version,x=e.link;if(x||(x=i?new zl({uri:i,credentials:n,headers:a}):Qt.empty()),!o)throw __DEV__?new re(`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 re(9);if(this.link=x,this.cache=o,this.disableNetworkFetches=c||u>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=y,u&&setTimeout(function(){return t.disableNetworkFetches=!1},u),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!Kf&&d&&__DEV__&&(Kf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var O=window.navigator,D=O&&O.userAgent,P=void 0;typeof D=="string"&&(D.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":D.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&F.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Ld,this.localState=new Fs({cache:o,client:this,resolvers:w,fragmentMatcher:b}),this.queryManager=new Gf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:T},localState:this.localState,assumeImmutableResults:_,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ua(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=k(k({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ua(this.defaultOptions.query,e)),__DEV__?F(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."):F(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=k(k({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ua(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return qn(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&F.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();od(Ci?"log":"silent");function pt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Tr(r){return pt(r)==="object"}function Jf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function bu(r,e){return r.length<124?r:e}var Zf="graphql-transport-ws";var xt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(xt||(xt={}));var Le;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Le||(Le={}));function Yf(r){if(!Tr(r))throw new Error(`Message is expected to be an object, but got ${pt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${pt(r.type)}`);switch(r.type){case Le.ConnectionInit:case Le.ConnectionAck:case Le.Ping:case Le.Pong:{if(r.payload!=null&&!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Le.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${pt(r.payload.query)}`);if(r.payload.variables!=null&&!Tr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${pt(r.payload.variables)}`);if(r.payload.operationName!=null&&pt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${pt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Tr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${pt(r.payload.extensions)}`);break}case Le.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Tr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);break}case Le.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Jf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Le.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function Xf(r,e){return Yf(typeof r=="string"?JSON.parse(r,e):r)}function Gn(r,e){return Yf(r),JSON.stringify(r,e)}function wu(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:l=5,retryWait:u=async function(we){let Se=1e3;for(let se=0;se<we;se++)Se*=2;await new Promise(se=>setTimeout(se,Se+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=js,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Se=Math.random()*16|0;return(we=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:_}=r,w;if(h){if(!rb(h))throw new Error("Invalid WebSocket implementation provided");w=h}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let y=w,b=(()=>{let C=(()=>{let Se={};return{on(se,he){return Se[se]=he,()=>{delete Se[se]}},emit(se){var he;"id"in se&&((he=Se[se.id])===null||he===void 0||he.call(Se,se))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[C.emit,p.message]:[C.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:C.on,on(Se,se){let he=we[Se];return he.push(se),()=>{he.splice(he.indexOf(se),1)}},emit(Se,...se){for(let he of[...we[Se]])he(...se)}}})();function A(C){let we=[b.on("error",Se=>{we.forEach(se=>se()),C(Se)}),b.on("closed",Se=>{we.forEach(se=>se()),C(Se)})]}let T,x=0,O,D=!1,P=0,U=!1;async function ke(){clearTimeout(O);let[C,we]=await(T??(T=new Promise((he,sr)=>(async()=>{if(D){if(await u(P),!x)return T=void 0,sr({code:1e3,reason:"All Subscriptions Gone"});P++}b.emit("connecting");let ce=new y(typeof e=="function"?await e():e,Zf),cr,Vr;function is(){isFinite(o)&&o>0&&(clearTimeout(Vr),Vr=setTimeout(()=>{ce.readyState===y.OPEN&&(ce.send(Gn({type:Le.Ping})),b.emit("ping",!1,void 0))},o))}A(tt=>{T=void 0,clearTimeout(cr),clearTimeout(Vr),sr(tt),js(tt)&&tt.code===4499&&(ce.close(4499,"Terminated"),ce.onerror=null,ce.onclose=null)}),ce.onerror=tt=>b.emit("error",tt),ce.onclose=tt=>b.emit("closed",tt),ce.onopen=async()=>{try{b.emit("opened",ce);let tt=typeof t=="function"?await t():t;if(ce.readyState!==y.OPEN)return;ce.send(Gn(tt?{type:Le.ConnectionInit,payload:tt}:{type:Le.ConnectionInit},g)),isFinite(c)&&c>0&&(cr=setTimeout(()=>{ce.close(xt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),is()}catch(tt){b.emit("error",tt),ce.close(xt.InternalClientError,bu(tt instanceof Error?tt.message:new Error(tt).message,"Internal client error"))}};let Rn=!1;ce.onmessage=({data:tt})=>{try{let rt=Xf(tt,_);if(b.emit("message",rt),rt.type==="ping"||rt.type==="pong"){b.emit(rt.type,!0,rt.payload),rt.type==="pong"?is():s||(ce.send(Gn(rt.payload?{type:Le.Pong,payload:rt.payload}:{type:Le.Pong})),b.emit("pong",!1,rt.payload));return}if(Rn)return;if(rt.type!==Le.ConnectionAck)throw new Error(`First message cannot be of type ${rt.type}`);clearTimeout(cr),Rn=!0,b.emit("connected",ce,rt.payload),D=!1,P=0,he([ce,new Promise((d_,iy)=>A(iy))])}catch(rt){ce.onmessage=null,b.emit("error",rt),ce.close(xt.BadResponse,bu(rt instanceof Error?rt.message:new Error(rt).message,"Bad response"))}}})())));C.readyState===y.CLOSING&&await we;let Se=()=>{},se=new Promise(he=>Se=he);return[C,Se,Promise.race([se.then(()=>{if(!x){let he=()=>C.close(1e3,"Normal Closure");isFinite(a)&&a>0?O=setTimeout(()=>{C.readyState===y.OPEN&&he()},a):he()}}),we])]}function Ie(C){if(js(C)&&(tb(C.code)||[xt.InternalServerError,xt.InternalClientError,xt.BadRequest,xt.BadResponse,xt.Unauthorized,xt.SubprotocolNotAcceptable,xt.SubscriberAlreadyExists,xt.TooManyInitialisationRequests].includes(C.code)))throw C;if(U)return!1;if(js(C)&&C.code===1e3)return x>0;if(!l||P>=l||!f(C)||d?.(C))throw C;return D=!0}return i||(async()=>{for(x++;;)try{let[,,C]=await ke();await C}catch(C){try{if(!Ie(C))return}catch(we){return n?.(we)}}})(),{on:b.on,subscribe(C,we){let Se=m(C),se=!1,he=!1,sr=()=>{x--,se=!0};return(async()=>{for(x++;;)try{let[ce,cr,Vr]=await ke();if(se)return cr();let is=b.onMessage(Se,Rn=>{switch(Rn.type){case Le.Next:{we.next(Rn.payload);return}case Le.Error:{he=!0,se=!0,we.error(Rn.payload),sr();return}case Le.Complete:{se=!0,sr();return}}});ce.send(Gn({id:Se,type:Le.Subscribe,payload:C},g)),sr=()=>{!se&&ce.readyState===y.OPEN&&ce.send(Gn({id:Se,type:Le.Complete},g)),x--,se=!0,cr()},await Vr.finally(is);return}catch(ce){if(!Ie(ce))return}})().then(()=>{he||we.complete()}).catch(ce=>{we.error(ce)}),()=>{se||sr()}},async dispose(){if(U=!0,T){let[C]=await T;C.close(1e3,"Normal Closure")}},terminate(){T&&b.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function js(r){return Tr(r)&&"code"in r&&"reason"in r}function tb(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function rb(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function ib(r){return me(r)&&"code"in r&&"reason"in r}var eh=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new le(function(n){return i.client.subscribe(k(k({},t),{query:Pn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):ib(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new Ir({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Qt);var qs="0.13.0-test-2";function Bs(){return typeof window!="undefined"&&window.self!==window.top}function Su(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function dt(r,e){Su()&&localStorage.setItem(`${qs}/${r}`,e)}function Wa(r){return Su()?localStorage.getItem(`${qs}/${r}`):null}function Kn(r){Su()&&localStorage.removeItem(`${qs}/${r}`)}function ji(r,e=1e4){return Q(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function th(r){let e=r.trim();if(!e)return"";let t=e.split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function rh(r){let e=0;for(let t=0;t<r.length;t++)e=r.charCodeAt(t)+((e<<5)-e);return(e%360+360)%360}var yc=function(){return yc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},yc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function tc(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?tc=function(t){return typeof t}:tc=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tc(r)}function ab(r){return tc(r)=="object"&&r!==null}var Im=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Vu(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function ob(r){return Tm(r.source,Vu(r.source,r.start))}function Tm(r,e){var t=r.locationOffset.column-1,i=rc(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,l="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
+
`),u=i.split(/\r\n|[\n\r]/g),f=u[n];if(f.length>120){for(var d=Math.floor(c/80),p=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return l+ih([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(g){return["",g]}),[[" ",rc(p-1)+"^"],["",h[d+1]]]))}return l+ih([["".concat(o-1),u[n-1]],["".concat(o),f],["",rc(c-1)+"^"],["".concat(o+1),u[n+1]]])}function ih(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return sb(t,n)+(a?" | "+a:" |")}).join(`
|
|
53
|
+
`)}function rc(r){return Array(r+1).join(" ")}function sb(r,e){return rc(r-e.length)+e}function ic(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ic=function(t){return typeof t}:ic=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ic(r)}function nh(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function cb(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?nh(Object(t),!0).forEach(function(i){lb(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):nh(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function lb(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ub(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function ah(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function pb(r,e,t){return e&&ah(r.prototype,e),t&&ah(r,t),r}function db(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&Co(r,e)}function fb(r){var e=$m();return function(){var i=$o(r),n;if(e){var a=$o(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Cm(this,n)}}function Cm(r,e){return e&&(ic(e)==="object"||typeof e=="function")?e:Xa(r)}function Xa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Qu(r){var e=typeof Map=="function"?new Map:void 0;return Qu=function(i){if(i===null||!hb(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return nc(i,arguments,$o(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),Co(n,i)},Qu(r)}function nc(r,e,t){return $m()?nc=Reflect.construct:nc=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),l=new c;return o&&Co(l,o.prototype),l},nc.apply(null,arguments)}function $m(){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 hb(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Co(r,e){return Co=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},Co(r,e)}function $o(r){return $o=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$o(r)}var mb=function(r){db(t,r);var e=fb(t);function t(i,n,a,o,s,c,l){var u,f,d,p;ub(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=oh(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,g=(_=p.nodes)!==null&&_!==void 0?_:[];m<g.length;m++){var _,w=g[m],y=w.loc;y!=null&&h.push(y)}h=oh(h),p.source=a??((u=h)===null||u===void 0?void 0:u[0].source),p.positions=o??((f=h)===null||f===void 0?void 0:f.map(function(A){return A.start})),p.locations=o&&a?o.map(function(A){return Vu(a,A)}):(d=h)===null||d===void 0?void 0:d.map(function(A){return Vu(A.source,A.start)}),p.path=s??void 0;var b=c?.extensions;return l==null&&ab(b)?p.extensions=cb({},b):p.extensions=l??{},Object.defineProperties(Xa(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Xa(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Cm(p)):(Error.captureStackTrace?Error.captureStackTrace(Xa(p),t):Object.defineProperty(Xa(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return pb(t,[{key:"toString",value:function(){return gb(this)}},{key:Im,get:function(){return"Object"}}]),t}(Qu(Error));function oh(r){return r===void 0||r.length===0?void 0:r}function gb(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
|
|
54
54
|
|
|
55
|
-
`+
|
|
55
|
+
`+ob(n.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
|
|
56
56
|
|
|
57
|
-
`+
|
|
58
|
-
`)}function
|
|
59
|
-
`;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=Lb(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(u<0){var d=a.slice(o+1,o+5);throw Nt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}l+=String.fromCharCode(u),o+=4;break}default:throw Nt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Nt(r,o,"Unterminated string.")}function Rb(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,l=0,u="";s<o.length&&!isNaN(l=o.charCodeAt(s));){if(l===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return u+=o.slice(c,s),new Fe(R.BLOCK_STRING,e,s+3,t,i,n,Eb(u));if(l<32&&l!==9&&l!==10&&l!==13)throw Nt(r,s,"Invalid character within String: ".concat(tn(l),"."));l===10?(++s,++a.line,a.lineStart=s):l===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):l===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(u+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Nt(r,s,"Unterminated string.")}function Lb(r,e,t,i){return qs(r)<<12|qs(e)<<8|qs(t)<<4|qs(i)}function qs(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Nb(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Fe(R.NAME,e,s,t,i,n,a.slice(e,s))}function Db(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function Fb(r,e){var t=new Mb(r,e);return t.parseDocument()}var Mb=function(){function r(t,i){var n=_b(t)?t:new Cm(t);this._lexer=new Ab(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(R.NAME);return{kind:Z.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:Z.DOCUMENT,definitions:this.many(R.SOF,this.parseDefinition,R.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(R.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(R.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(R.BRACE_L))return{kind:Z.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(R.NAME)&&(a=this.parseName()),{kind:Z.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(R.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(R.PAREN_L,this.parseVariableDefinition,R.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:Z.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(R.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(R.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(R.DOLLAR),{kind:Z.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:Z.SELECTION_SET,selections:this.many(R.BRACE_L,this.parseSelection,R.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(R.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(R.COLON)?(a=n,o=this.parseName()):o=n,{kind:Z.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(R.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(R.PAREN_L,n,R.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(R.COLON),{kind:Z.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:Z.ARGUMENT,name:this.parseName(),value:(this.expectToken(R.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(R.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(R.NAME)?{kind:Z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:Z.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:Z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:Z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case R.BRACKET_L:return this.parseList(i);case R.BRACE_L:return this.parseObject(i);case R.INT:return this._lexer.advance(),{kind:Z.INT,value:n.value,loc:this.loc(n)};case R.FLOAT:return this._lexer.advance(),{kind:Z.FLOAT,value:n.value,loc:this.loc(n)};case R.STRING:case R.BLOCK_STRING:return this.parseStringLiteral();case R.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:Z.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:Z.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:Z.NULL,loc:this.loc(n)};default:return{kind:Z.ENUM,value:n.value,loc:this.loc(n)}}case R.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:Z.STRING,value:i.value,block:i.kind===R.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:Z.LIST,values:this.any(R.BRACKET_L,o,R.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:Z.OBJECT,fields:this.any(R.BRACE_L,o,R.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(R.COLON),{kind:Z.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(R.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(R.AT),{kind:Z.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(R.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(R.BRACKET_R),n={kind:Z.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(R.BANG)?{kind:Z.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:Z.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===R.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(R.STRING)||this.peek(R.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(R.BRACE_L,this.parseOperationTypeDefinition,R.BRACE_R);return{kind:Z.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(R.COLON);var a=this.parseNamedType();return{kind:Z.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:Z.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=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:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(R.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(R.AMP)||this.peek(R.NAME));return n}return this.delimitedMany(R.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(R.BRACE_L)&&this._lexer.lookahead().kind===R.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(R.BRACE_L,this.parseFieldDefinition,R.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(R.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:Z.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(R.PAREN_L,this.parseInputValueDef,R.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(R.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(R.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:Z.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=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:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:Z.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(R.EQUALS)?this.delimitedMany(R.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:Z.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(R.BRACE_L,this.parseEnumValueDefinition,R.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:Z.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:Z.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(R.BRACE_L,this.parseInputValueDef,R.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===R.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(R.BRACE_L,this.parseOperationTypeDefinition,R.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:Z.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:Z.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=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:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=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:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=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:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=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:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=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:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(R.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:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(R.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(xb[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new Im(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Nt(this._lexer.source,n.start,"Expected ".concat(Om(i),", found ").concat(_u(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===R.NAME&&n.value===i)this._lexer.advance();else throw Nt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(_u(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===R.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Nt(this._lexer.source,n.start,"Unexpected ".concat(_u(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function _u(r){var e=r.value;return Om(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Om(r){return Ib(r)?'"'.concat(r,'"'):r}var ac=new Map,Vu=new Map,$m=!0,yc=!1;function Pm(r){return r.replace(/[\s,]+/g," ").trim()}function Ub(r){return Pm(r.source.body.substring(r.start,r.end))}function jb(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=Ub(i.loc),o=Vu.get(n);o&&!o.has(a)?$m&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
57
|
+
`+Tm(r.source,s)}return e}function Dt(r,e,t){return new mb("Syntax Error: ".concat(t),void 0,r,[e])}var X=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 yb(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var vb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Hu=vb;function Om(r){var e=r.prototype.toJSON;typeof e=="function"||yb(0),r.prototype.inspect=e,Hu&&(r.prototype[Hu]=e)}var Rm=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Om(Rm);var Fe=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Om(Fe);var N=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 ac(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ac=function(t){return typeof t}:ac=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ac(r)}var bb=10,Pm=2;function wb(r){return qc(r,[])}function qc(r,e){switch(ac(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Sb(r,e);default:return String(r)}}function Sb(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=Eb(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:qc(n,t)}else if(Array.isArray(r))return xb(r,t);return _b(r,t)}function _b(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Pm)return"["+Ab(r)+"]";var i=t.map(function(n){var a=qc(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function xb(r,e){if(r.length===0)return"[]";if(e.length>Pm)return"[Array]";for(var t=Math.min(bb,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(qc(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Eb(r){var e=r[String(Hu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Ab(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function _u(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var kb=function(e,t){return e instanceof t};function sh(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Ib(r,e,t){return e&&sh(r.prototype,e),t&&sh(r,t),r}var Lm=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||_u(0,"Body must be a string. Received: ".concat(wb(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||_u(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||_u(0,"column in locationOffset is 1-indexed and must be positive.")}return Ib(r,[{key:Im,get:function(){return"Source"}}]),r}();function Tb(r){return kb(r,Lm)}var Cb=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 $b(r){var e=r.split(/\r\n|[\n\r]/g),t=Ob(r);if(t!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(t);for(var n=0;n<e.length&&ch(e[n]);)++n;for(var a=e.length;a>n&&ch(e[a-1]);)--a;return e.slice(n,a).join(`
|
|
58
|
+
`)}function ch(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Ob(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Rb=function(){function r(t){var i=new Fe(N.SOF,0,0,0,0,null);this.source=t,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var i=this.token=this.lookahead();return i},e.lookahead=function(){var i=this.token;if(i.kind!==N.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Lb(this,i)}while(i.kind===N.COMMENT);return i},r}();function Pb(r){return r===N.BANG||r===N.DOLLAR||r===N.AMP||r===N.PAREN_L||r===N.PAREN_R||r===N.SPREAD||r===N.COLON||r===N.EQUALS||r===N.AT||r===N.BRACKET_L||r===N.BRACKET_R||r===N.BRACE_L||r===N.PIPE||r===N.BRACE_R}function nn(r){return isNaN(r)?N.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Lb(r,e){for(var t=r.source,i=t.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Fe(N.BANG,a,a+1,s,c,e);case 35:return Db(t,a,s,c,e);case 36:return new Fe(N.DOLLAR,a,a+1,s,c,e);case 38:return new Fe(N.AMP,a,a+1,s,c,e);case 40:return new Fe(N.PAREN_L,a,a+1,s,c,e);case 41:return new Fe(N.PAREN_R,a,a+1,s,c,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Fe(N.SPREAD,a,a+3,s,c,e);break;case 58:return new Fe(N.COLON,a,a+1,s,c,e);case 61:return new Fe(N.EQUALS,a,a+1,s,c,e);case 64:return new Fe(N.AT,a,a+1,s,c,e);case 91:return new Fe(N.BRACKET_L,a,a+1,s,c,e);case 93:return new Fe(N.BRACKET_R,a,a+1,s,c,e);case 123:return new Fe(N.BRACE_L,a,a+1,s,c,e);case 124:return new Fe(N.PIPE,a,a+1,s,c,e);case 125:return new Fe(N.BRACE_R,a,a+1,s,c,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?Ub(t,a,s,c,e,r):Mb(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Fb(t,a,o,s,c,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return qb(t,a,s,c,e)}throw Dt(t,a,Nb(o))}var l=r.line,u=1+a-r.lineStart;return new Fe(N.EOF,n,n,l,u,e)}function Nb(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(nn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(nn(r),".")}function Db(r,e,t,i,n){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Fe(N.COMMENT,e,s,t,i,n,a.slice(e+1,s))}function Fb(r,e,t,i,n,a){var o=r.body,s=t,c=e,l=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw Dt(r,c,"Invalid number, unexpected digit after 0: ".concat(nn(s),"."))}else c=xu(r,c,s),s=o.charCodeAt(c);if(s===46&&(l=!0,s=o.charCodeAt(++c),c=xu(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(l=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=xu(r,c,s),s=o.charCodeAt(c)),s===46||Bb(s))throw Dt(r,c,"Invalid number, expected digit but got: ".concat(nn(s),"."));return new Fe(l?N.FLOAT:N.INT,e,c,i,n,a,o.slice(e,c))}function xu(r,e,t){var i=r.body,n=e,a=t;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Dt(r,n,"Invalid number, expected digit but got: ".concat(nn(a),"."))}function Mb(r,e,t,i,n){for(var a=r.body,o=e+1,s=o,c=0,l="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return l+=a.slice(s,o),new Fe(N.STRING,e,o+1,t,i,n,l);if(c<32&&c!==9)throw Dt(r,o,"Invalid character within String: ".concat(nn(c),"."));if(++o,c===92){switch(l+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:l+='"';break;case 47:l+="/";break;case 92:l+="\\";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+=`
|
|
59
|
+
`;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=jb(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(u<0){var f=a.slice(o+1,o+5);throw Dt(r,o,"Invalid character escape sequence: \\u".concat(f,"."))}l+=String.fromCharCode(u),o+=4;break}default:throw Dt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Dt(r,o,"Unterminated string.")}function Ub(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,l=0,u="";s<o.length&&!isNaN(l=o.charCodeAt(s));){if(l===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return u+=o.slice(c,s),new Fe(N.BLOCK_STRING,e,s+3,t,i,n,$b(u));if(l<32&&l!==9&&l!==10&&l!==13)throw Dt(r,s,"Invalid character within String: ".concat(nn(l),"."));l===10?(++s,++a.line,a.lineStart=s):l===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):l===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(u+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Dt(r,s,"Unterminated string.")}function jb(r,e,t,i){return Vs(r)<<12|Vs(e)<<8|Vs(t)<<4|Vs(i)}function Vs(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function qb(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Fe(N.NAME,e,s,t,i,n,a.slice(e,s))}function Bb(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function Vb(r,e){var t=new Qb(r,e);return t.parseDocument()}var Qb=function(){function r(t,i){var n=Tb(t)?t:new Lm(t);this._lexer=new Rb(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(N.NAME);return{kind:X.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:X.DOCUMENT,definitions:this.many(N.SOF,this.parseDefinition,N.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(N.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(N.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(N.BRACE_L))return{kind:X.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(N.NAME)&&(a=this.parseName()),{kind:X.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(N.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(N.PAREN_L,this.parseVariableDefinition,N.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:X.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(N.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(N.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(N.DOLLAR),{kind:X.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:X.SELECTION_SET,selections:this.many(N.BRACE_L,this.parseSelection,N.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(N.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(N.COLON)?(a=n,o=this.parseName()):o=n,{kind:X.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(N.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(N.PAREN_L,n,N.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(N.COLON),{kind:X.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:X.ARGUMENT,name:this.parseName(),value:(this.expectToken(N.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(N.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(N.NAME)?{kind:X.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:X.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:X.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:X.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case N.BRACKET_L:return this.parseList(i);case N.BRACE_L:return this.parseObject(i);case N.INT:return this._lexer.advance(),{kind:X.INT,value:n.value,loc:this.loc(n)};case N.FLOAT:return this._lexer.advance(),{kind:X.FLOAT,value:n.value,loc:this.loc(n)};case N.STRING:case N.BLOCK_STRING:return this.parseStringLiteral();case N.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:X.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:X.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:X.NULL,loc:this.loc(n)};default:return{kind:X.ENUM,value:n.value,loc:this.loc(n)}}case N.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:X.STRING,value:i.value,block:i.kind===N.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:X.LIST,values:this.any(N.BRACKET_L,o,N.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:X.OBJECT,fields:this.any(N.BRACE_L,o,N.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(N.COLON),{kind:X.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(N.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(N.AT),{kind:X.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(N.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(N.BRACKET_R),n={kind:X.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(N.BANG)?{kind:X.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:X.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===N.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(N.STRING)||this.peek(N.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);return{kind:X.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(N.COLON);var a=this.parseNamedType();return{kind:X.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:X.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:X.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(N.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(N.AMP)||this.peek(N.NAME));return n}return this.delimitedMany(N.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(N.BRACE_L)&&this._lexer.lookahead().kind===N.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(N.BRACE_L,this.parseFieldDefinition,N.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(N.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:X.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(N.PAREN_L,this.parseInputValueDef,N.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(N.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(N.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:X.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:X.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:X.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(N.EQUALS)?this.delimitedMany(N.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:X.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseEnumValueDefinition,N.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:X.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:X.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseInputValueDef,N.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===N.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:X.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:X.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=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:X.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=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:X.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:X.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:X.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:X.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(N.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:X.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(N.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Cb[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new Rm(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Dt(this._lexer.source,n.start,"Expected ".concat(Nm(i),", found ").concat(Eu(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===N.NAME&&n.value===i)this._lexer.advance();else throw Dt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(Eu(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===N.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Dt(this._lexer.source,n.start,"Unexpected ".concat(Eu(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function Eu(r){var e=r.value;return Nm(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Nm(r){return Pb(r)?'"'.concat(r,'"'):r}var oc=new Map,zu=new Map,Dm=!0,vc=!1;function Fm(r){return r.replace(/[\s,]+/g," ").trim()}function Hb(r){return Fm(r.source.body.substring(r.start,r.end))}function zb(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=Hb(i.loc),o=zu.get(n);o&&!o.has(a)?Dm&&console.warn("Warning: fragment with name "+n+` 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||Vu.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),gc(gc({},r),{definitions:t})}function qb(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Bb(r){var e=Pm(r);if(!ac.has(e)){var t=Fb(r,{experimentalFragmentVariables:yc,allowLegacyFragmentVariables:yc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ac.set(e,qb(jb(t)))}return ac.get(e)}function x(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),Bb(i)}function Vb(){ac.clear(),Vu.clear()}function Qb(){$m=!1}function Hb(){yc=!0}function zb(){yc=!1}var za={gql:x,resetCaches:Vb,disableFragmentWarnings:Qb,enableExperimentalFragmentVariables:Hb,disableExperimentalFragmentVariables:zb};(function(r){r.gql=za.gql,r.resetCaches=za.resetCaches,r.disableFragmentWarnings=za.disableFragmentWarnings,r.enableExperimentalFragmentVariables=za.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=za.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Wb(){}function Si(){return Wb}var Q=Si,w=Si,Xe=Si,ae=Si,J=Si,qe=Si,Gb=Si,fp=Si,Rm=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Lm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rn=class{constructor(e){this.code=e}};Rm([w(),Lm("design:type",String)],rn.prototype,"code",void 0);rn=Rm([J(),Lm("design:paramtypes",[String])],rn);var hp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},mp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},yr=class{constructor(e,t){this.address=e,this.name=t}};hp([w(),mp("design:type",String)],yr.prototype,"address",void 0);hp([w(),mp("design:type",String)],yr.prototype,"name",void 0);yr=hp([J(),mp("design:paramtypes",[String,String])],yr);var Ce=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Dr=class{constructor(e,t){this.key=t,this.signature=e}};Ce([w(),ze("design:type",String)],Dr.prototype,"signature",void 0);Ce([w(),ze("design:type",String)],Dr.prototype,"key",void 0);Ce([w(),ze("design:type",Boolean)],Dr.prototype,"valid",void 0);Ce([w(),ze("design:type",Boolean)],Dr.prototype,"invalid",void 0);Dr=Ce([J(),Xe(),ze("design:paramtypes",[String,String])],Dr);var nn=class{};Ce([w(),ze("design:type",String)],nn.prototype,"signature",void 0);Ce([w(),ze("design:type",String)],nn.prototype,"key",void 0);Ce([w(),ze("design:type",Boolean)],nn.prototype,"valid",void 0);Ce([w(),ze("design:type",Boolean)],nn.prototype,"invalid",void 0);nn=Ce([Xe()],nn);function _i(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Ce([w(),ze("design:type",String)],e.prototype,"author",void 0),Ce([w(),ze("design:type",String)],e.prototype,"timestamp",void 0),Ce([w(),ze("design:type",Object)],e.prototype,"data",void 0),Ce([w(),ze("design:type",Dr)],e.prototype,"proof",void 0),e=Ce([J(),ze("design:paramtypes",[String,String,Object,Dr])],e),e}function Kb(r){let e=class{};return Ce([w(),ze("design:type",String)],e.prototype,"author",void 0),Ce([w(),ze("design:type",String)],e.prototype,"timestamp",void 0),Ce([w(),ze("design:type",Object)],e.prototype,"data",void 0),Ce([w(),ze("design:type",nn)],e.prototype,"proof",void 0),e=Ce([Xe()],e),e}var ih=class extends _i(){};ih=Ce([J()],ih);var vc=class extends _i(){};Ce([w(),ze("design:type",yr)],vc.prototype,"language",void 0);Ce([w(),ze("design:type",rn)],vc.prototype,"icon",void 0);vc=Ce([J()],vc);function BC(r){return r&&r.author&&r.timestamp&&r.data}var Be=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ot=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},It=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Be([w(),ot("design:type",String)],It.prototype,"source",void 0);Be([w(),ot("design:type",String)],It.prototype,"target",void 0);Be([w(),ot("design:type",String)],It.prototype,"predicate",void 0);It=Be([J(),ot("design:paramtypes",[Object])],It);var bc=class{};Be([w(),ot("design:type",Array)],bc.prototype,"additions",void 0);Be([w(),ot("design:type",Array)],bc.prototype,"removals",void 0);bc=Be([Xe()],bc);var wc=class{constructor(e,t){this.additions=e,this.removals=t}};Be([w(),ot("design:type",Array)],wc.prototype,"additions",void 0);Be([w(),ot("design:type",Array)],wc.prototype,"removals",void 0);wc=Be([J(),ot("design:paramtypes",[Array,Array])],wc);var Co=class{};Be([w(),ot("design:type",String)],Co.prototype,"source",void 0);Be([w(),ot("design:type",String)],Co.prototype,"target",void 0);Be([w(),ot("design:type",String)],Co.prototype,"predicate",void 0);Co=Be([Xe()],Co);var hi=class extends _i(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Be([w(),ot("design:type",String)],hi.prototype,"status",void 0);hi=Be([J()],hi);var Qu=class extends Kb(){};Be([w(),ot("design:type",String)],Qu.prototype,"status",void 0);Qu=Be([Xe()],Qu);function KC(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function JC(r){return r&&r.source&&r.target}var Sc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Be([w(),ot("design:type",hi)],Sc.prototype,"oldLink",void 0);Be([w(),ot("design:type",hi)],Sc.prototype,"newLink",void 0);Sc=Be([J(),ot("design:paramtypes",[hi,hi])],Sc);var mn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Bo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hu,Sr=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 i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};mn([w(),Bo("design:type",Array)],Sr.prototype,"links",void 0);Sr=mn([J(),Bo("design:paramtypes",[Array])],Sr);var _c=class{};mn([w(),Bo("design:type",Array)],_c.prototype,"links",void 0);_c=mn([Xe()],_c);var zu=Hu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Hu;return t.links.push(e),t}};mn([w(),Bo("design:type",Array)],zu.prototype,"links",void 0);zu=Hu=mn([Xe(),Bo("design:paramtypes",[Array])],zu);var an=class extends _i(){};an=mn([J()],an);var z=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},G=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},li=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Sr}};z([w(),G("design:type",String)],li.prototype,"did",void 0);z([w(),G("design:type",Sr)],li.prototype,"perspective",void 0);z([w(),G("design:type",String)],li.prototype,"directMessageLanguage",void 0);li=z([J(),G("design:paramtypes",[String,Sr])],li);var nh=class extends _i(){};nh=z([J()],nh);var mi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};z([w(),G("design:type",String)],mi.prototype,"did",void 0);z([w(),G("design:type",String)],mi.prototype,"didSigningKeyId",void 0);z([w(),G("design:type",String)],mi.prototype,"deviceKeyType",void 0);z([w(),G("design:type",String)],mi.prototype,"deviceKey",void 0);z([w(),G("design:type",String)],mi.prototype,"deviceKeySignedByDid",void 0);z([w(),G("design:type",String)],mi.prototype,"didSignedByDeviceKey",void 0);mi=z([J(),G("design:paramtypes",[String,String,String,String,String,String])],mi);var gi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};z([w(),G("design:type",String)],gi.prototype,"did",void 0);z([w(),G("design:type",String)],gi.prototype,"didSigningKeyId",void 0);z([w(),G("design:type",String)],gi.prototype,"deviceKeyType",void 0);z([w(),G("design:type",String)],gi.prototype,"deviceKey",void 0);z([w(),G("design:type",String)],gi.prototype,"deviceKeySignedByDid",void 0);z([w(),G("design:type",String)],gi.prototype,"didSignedByDeviceKey",void 0);gi=z([Xe(),G("design:paramtypes",[String,String,String,String,String,String])],gi);var xc=class{constructor(e,t){this.signature=e,this.publicKey=t}};z([w(),G("design:type",String)],xc.prototype,"signature",void 0);z([w(),G("design:type",String)],xc.prototype,"publicKey",void 0);xc=z([J(),G("design:paramtypes",[String,String])],xc);var aa=class{constructor(e,t){this.domain=e,this.pointers=t}};z([w(),G("design:type",String)],aa.prototype,"domain",void 0);z([w(),G("design:type",Array)],aa.prototype,"pointers",void 0);aa=z([J(),G("design:paramtypes",[String,Array])],aa);var Ec=class{constructor(e,t){this.with=e,this.can=t}};z([w(),G("design:type",aa)],Ec.prototype,"with",void 0);z([w(),G("design:type",Array)],Ec.prototype,"can",void 0);Ec=z([J(),G("design:paramtypes",[aa,Array])],Ec);var Fr=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};z([w(),G("design:type",String)],Fr.prototype,"appName",void 0);z([w(),G("design:type",String)],Fr.prototype,"appDesc",void 0);z([w(),G("design:type",String)],Fr.prototype,"appUrl",void 0);z([w(),G("design:type",String)],Fr.prototype,"appIconPath",void 0);z([w(),G("design:type",Array)],Fr.prototype,"capabilities",void 0);Fr=z([J(),G("design:paramtypes",[String,String,String,Array,String])],Fr);var oa=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};z([w(),G("design:type",String)],oa.prototype,"requestId",void 0);z([w(),G("design:type",String)],oa.prototype,"token",void 0);z([w(),G("design:type",Boolean)],oa.prototype,"revoked",void 0);z([w(),G("design:type",Fr)],oa.prototype,"auth",void 0);oa=z([J(),G("design:paramtypes",[String,Fr,String,Boolean])],oa);var sa=class{constructor(e,t){this.domain=e,this.pointers=t}};z([w(),G("design:type",String)],sa.prototype,"domain",void 0);z([w(),G("design:type",Array)],sa.prototype,"pointers",void 0);sa=z([Xe(),G("design:paramtypes",[String,Array])],sa);var kc=class{constructor(e,t){this.with=e,this.can=t}};z([w(),G("design:type",sa)],kc.prototype,"with",void 0);z([w(),G("design:type",Array)],kc.prototype,"can",void 0);kc=z([Xe(),G("design:paramtypes",[sa,Array])],kc);var _r=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};z([w(),G("design:type",String)],_r.prototype,"appName",void 0);z([w(),G("design:type",String)],_r.prototype,"appDesc",void 0);z([w(),G("design:type",String)],_r.prototype,"appDomain",void 0);z([w(),G("design:type",String)],_r.prototype,"appUrl",void 0);z([w(),G("design:type",String)],_r.prototype,"appIconPath",void 0);z([w(),G("design:type",Array)],_r.prototype,"capabilities",void 0);_r=z([Xe(),G("design:paramtypes",[String,String,String,String,String,Array])],_r);var on=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};z([w(),G("design:type",String)],on.prototype,"did",void 0);z([w(),G("design:type",Boolean)],on.prototype,"success",void 0);z([w(),G("design:type",String)],on.prototype,"error",void 0);on=z([J(),G("design:paramtypes",[String,Boolean,String])],on);var ma=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ga=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},zt=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)}};ma([w(),ga("design:type",Boolean)],zt.prototype,"isInitialized",void 0);ma([w(),ga("design:type",Boolean)],zt.prototype,"isUnlocked",void 0);ma([w(),ga("design:type",String)],zt.prototype,"did",void 0);ma([w(),ga("design:type",String)],zt.prototype,"didDocument",void 0);ma([w(),ga("design:type",String)],zt.prototype,"error",void 0);zt=ma([J(),ga("design:paramtypes",[Object])],zt);var ah=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ne=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Et,kt,Wu=class{constructor(e,t){Et.set(this,void 0),kt.set(this,void 0),ah(this,Et,e,"f"),ah(this,kt,t,"f")}async otherAgents(){return await Ne(this,Et,"f").otherAgents(Ne(this,kt,"f"))}async hasTelepresenceAdapter(){return await Ne(this,Et,"f").hasTelepresenceAdapter(Ne(this,kt,"f"))}async onlineAgents(){return await Ne(this,Et,"f").onlineAgents(Ne(this,kt,"f"))}async setOnlineStatus(e){return await Ne(this,Et,"f").setOnlineStatus(Ne(this,kt,"f"),e)}async setOnlineStatusU(e){return await Ne(this,Et,"f").setOnlineStatusU(Ne(this,kt,"f"),e)}async sendSignal(e,t){return await Ne(this,Et,"f").sendSignal(Ne(this,kt,"f"),e,t)}async sendSignalU(e,t){return await Ne(this,Et,"f").sendSignalU(Ne(this,kt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Ne(this,Et,"f").sendBroadcast(Ne(this,kt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Ne(this,Et,"f").sendBroadcastU(Ne(this,kt,"f"),e,t)}async addSignalHandler(e){await Ne(this,Et,"f").addSignalHandler(Ne(this,kt,"f"),e)}removeSignalHandler(e){Ne(this,Et,"f").removeSignalHandler(Ne(this,kt,"f"),e)}};Et=new WeakMap,kt=new WeakMap;var gn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},yn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},K=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)}};gn([w(),yn("design:type",String)],K.prototype,"source",void 0);gn([w(),yn("design:type",String)],K.prototype,"target",void 0);gn([w(),yn("design:type",String)],K.prototype,"predicate",void 0);gn([w(),yn("design:type",Date)],K.prototype,"fromDate",void 0);gn([w(),yn("design:type",Date)],K.prototype,"untilDate",void 0);gn([w(),yn("design:type",Number)],K.prototype,"limit",void 0);K=gn([J(),Xe(),yn("design:paramtypes",[Object])],K);var oh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},At,Or;function Bs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var xe=class{constructor(){At.set(this,void 0),Or.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal:"))throw new Error("Can't create Literal from non-literal URL");if(e.startsWith("literal://"))throw new Error("literal:// format is no longer supported. Use literal: instead.");let t=new xe;return oh(t,Or,e,"f"),t}static from(e){let t=new xe;return oh(t,At,e,"f"),t}toUrl(){if(nt(this,Or,"f")&&!nt(this,At,"f"))return nt(this,Or,"f");if(!nt(this,Or,"f")&&(nt(this,At,"f")===void 0||nt(this,At,"f")===""||nt(this,At,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof nt(this,At,"f")){case"string":e=`string:${Bs(nt(this,At,"f"))}`;break;case"number":e=`number:${Bs(nt(this,At,"f"))}`;break;case"boolean":e=`boolean:${Bs(nt(this,At,"f"))}`;break;case"object":e=`json:${Bs(JSON.stringify(nt(this,At,"f")))}`;break}return`literal:${e}`}get(){if(nt(this,At,"f"))return nt(this,At,"f");if(!nt(this,Or,"f"))throw new Error("Can't render empty Literal");if(!nt(this,Or,"f").startsWith("literal:"))throw new Error("Can't render Literal from non-literal URL");let e=nt(this,Or,"f").substring(8);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};At=new WeakMap,Or=new WeakMap;function vt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function jc(r){return`set${vt(r)}`}function Nm(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function Jb(r){return`add${vt(Nm(r))}`}function Zb(r){return`remove${vt(Nm(r))}`}function Yb(r){return`set${vt(r)}`}function Dm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function ji(r){if(Array.isArray(r))return`[${r.map(ji).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var xu=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},re=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ht,mt,De,_o=class{constructor(r,e,t){ht.set(this,void 0),mt.set(this,void 0),De.set(this,void 0),xu(this,ht,e,"f"),xu(this,mt,t,"f"),xu(this,De,r,"f")}get baseExpression(){return re(this,ht,"f")}async init(){let isInstance=await re(this,De,"f").isSubjectInstance(re(this,ht,"f"),re(this,mt,"f"));if(!isInstance)throw`Not a valid subject instance of ${re(this,mt,"f")} for ${re(this,ht,"f")}`;let results=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await re(this,De,"f").getPropertyValueViaSparql(re(this,ht,"f"),re(this,mt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SPARQL:`,e);return}}});let setters=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[jc(property)]=async r=>{resolveLanguage&&(r=await re(this,De,"f").createExpression(r,resolveLanguage)),await re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:r}])}}let results2=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await re(this,De,"f").getRelationValuesViaSparql(re(this,ht,"f"),re(this,mt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SPARQL:`,e),[]}}});let adders=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Jb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:e}]))):await re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:r}])}}let removers=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[Zb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:e}]))):await re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:r}])}}let relationSetters=await re(this,De,"f").infer(`subject_class("${re(this,mt,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[Yb(relation)]=async r=>{Array.isArray(r)?await re(this,De,"f").executeAction(actions,re(this,ht,"f"),r.map(e=>({name:"value",value:e}))):await re(this,De,"f").executeAction(actions,re(this,ht,"f"),[{name:"value",value:r}])}}}};ht=new WeakMap,mt=new WeakMap,De=new WeakMap;function Xb(r,e,t,i){let n="",a=Dm(8);n+=`subject_class("${r}", ${a}).
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||zu.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),yc(yc({},r),{definitions:t})}function Wb(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Gb(r){var e=Fm(r);if(!oc.has(e)){var t=Vb(r,{experimentalFragmentVariables:vc,allowLegacyFragmentVariables:vc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");oc.set(e,Wb(zb(t)))}return oc.get(e)}function E(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),Gb(i)}function Kb(){oc.clear(),zu.clear()}function Jb(){Dm=!1}function Zb(){vc=!0}function Yb(){vc=!1}var Ga={gql:E,resetCaches:Kb,disableFragmentWarnings:Jb,enableExperimentalFragmentVariables:Zb,disableExperimentalFragmentVariables:Yb};(function(r){r.gql=Ga.gql,r.resetCaches=Ga.resetCaches,r.disableFragmentWarnings=Ga.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Ga.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Ga.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function I(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Xb(){}function xi(){return Xb}var H=xi,S=xi,Xe=xi,oe=xi,Y=xi,qe=xi,e0=xi,vp=xi,Mm=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Um=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},an=class{constructor(e){this.code=e}};Mm([S(),Um("design:type",String)],an.prototype,"code",void 0);an=Mm([Y(),Um("design:paramtypes",[String])],an);var bp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},yr=class{constructor(e,t){this.address=e,this.name=t}};bp([S(),wp("design:type",String)],yr.prototype,"address",void 0);bp([S(),wp("design:type",String)],yr.prototype,"name",void 0);yr=bp([Y(),wp("design:paramtypes",[String,String])],yr);var $e=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Fr=class{constructor(e,t){this.key=t,this.signature=e}};$e([S(),ze("design:type",String)],Fr.prototype,"signature",void 0);$e([S(),ze("design:type",String)],Fr.prototype,"key",void 0);$e([S(),ze("design:type",Boolean)],Fr.prototype,"valid",void 0);$e([S(),ze("design:type",Boolean)],Fr.prototype,"invalid",void 0);Fr=$e([Y(),Xe(),ze("design:paramtypes",[String,String])],Fr);var on=class{};$e([S(),ze("design:type",String)],on.prototype,"signature",void 0);$e([S(),ze("design:type",String)],on.prototype,"key",void 0);$e([S(),ze("design:type",Boolean)],on.prototype,"valid",void 0);$e([S(),ze("design:type",Boolean)],on.prototype,"invalid",void 0);on=$e([Xe()],on);function Ei(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return $e([S(),ze("design:type",String)],e.prototype,"author",void 0),$e([S(),ze("design:type",String)],e.prototype,"timestamp",void 0),$e([S(),ze("design:type",Object)],e.prototype,"data",void 0),$e([S(),ze("design:type",Fr)],e.prototype,"proof",void 0),e=$e([Y(),ze("design:paramtypes",[String,String,Object,Fr])],e),e}function t0(r){let e=class{};return $e([S(),ze("design:type",String)],e.prototype,"author",void 0),$e([S(),ze("design:type",String)],e.prototype,"timestamp",void 0),$e([S(),ze("design:type",Object)],e.prototype,"data",void 0),$e([S(),ze("design:type",on)],e.prototype,"proof",void 0),e=$e([Xe()],e),e}var lh=class extends Ei(){};lh=$e([Y()],lh);var bc=class extends Ei(){};$e([S(),ze("design:type",yr)],bc.prototype,"language",void 0);$e([S(),ze("design:type",an)],bc.prototype,"icon",void 0);bc=$e([Y()],bc);function JC(r){return r&&r.author&&r.timestamp&&r.data}var Be=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ot=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Tt=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Be([S(),ot("design:type",String)],Tt.prototype,"source",void 0);Be([S(),ot("design:type",String)],Tt.prototype,"target",void 0);Be([S(),ot("design:type",String)],Tt.prototype,"predicate",void 0);Tt=Be([Y(),ot("design:paramtypes",[Object])],Tt);var wc=class{};Be([S(),ot("design:type",Array)],wc.prototype,"additions",void 0);Be([S(),ot("design:type",Array)],wc.prototype,"removals",void 0);wc=Be([Xe()],wc);var Sc=class{constructor(e,t){this.additions=e,this.removals=t}};Be([S(),ot("design:type",Array)],Sc.prototype,"additions",void 0);Be([S(),ot("design:type",Array)],Sc.prototype,"removals",void 0);Sc=Be([Y(),ot("design:paramtypes",[Array,Array])],Sc);var Oo=class{};Be([S(),ot("design:type",String)],Oo.prototype,"source",void 0);Be([S(),ot("design:type",String)],Oo.prototype,"target",void 0);Be([S(),ot("design:type",String)],Oo.prototype,"predicate",void 0);Oo=Be([Xe()],Oo);var gi=class extends Ei(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Be([S(),ot("design:type",String)],gi.prototype,"status",void 0);gi=Be([Y()],gi);var Wu=class extends t0(){};Be([S(),ot("design:type",String)],Wu.prototype,"status",void 0);Wu=Be([Xe()],Wu);function i$(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function n$(r){return r&&r.source&&r.target}var _c=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Be([S(),ot("design:type",gi)],_c.prototype,"oldLink",void 0);Be([S(),ot("design:type",gi)],_c.prototype,"newLink",void 0);_c=Be([Y(),ot("design:paramtypes",[gi,gi])],_c);var yn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Qo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Gu,Sr=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 i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};yn([S(),Qo("design:type",Array)],Sr.prototype,"links",void 0);Sr=yn([Y(),Qo("design:paramtypes",[Array])],Sr);var xc=class{};yn([S(),Qo("design:type",Array)],xc.prototype,"links",void 0);xc=yn([Xe()],xc);var Ku=Gu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Gu;return t.links.push(e),t}};yn([S(),Qo("design:type",Array)],Ku.prototype,"links",void 0);Ku=Gu=yn([Xe(),Qo("design:paramtypes",[Array])],Ku);var sn=class extends Ei(){};sn=yn([Y()],sn);var W=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},G=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},pi=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Sr}};W([S(),G("design:type",String)],pi.prototype,"did",void 0);W([S(),G("design:type",Sr)],pi.prototype,"perspective",void 0);W([S(),G("design:type",String)],pi.prototype,"directMessageLanguage",void 0);pi=W([Y(),G("design:paramtypes",[String,Sr])],pi);var uh=class extends Ei(){};uh=W([Y()],uh);var yi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};W([S(),G("design:type",String)],yi.prototype,"did",void 0);W([S(),G("design:type",String)],yi.prototype,"didSigningKeyId",void 0);W([S(),G("design:type",String)],yi.prototype,"deviceKeyType",void 0);W([S(),G("design:type",String)],yi.prototype,"deviceKey",void 0);W([S(),G("design:type",String)],yi.prototype,"deviceKeySignedByDid",void 0);W([S(),G("design:type",String)],yi.prototype,"didSignedByDeviceKey",void 0);yi=W([Y(),G("design:paramtypes",[String,String,String,String,String,String])],yi);var vi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};W([S(),G("design:type",String)],vi.prototype,"did",void 0);W([S(),G("design:type",String)],vi.prototype,"didSigningKeyId",void 0);W([S(),G("design:type",String)],vi.prototype,"deviceKeyType",void 0);W([S(),G("design:type",String)],vi.prototype,"deviceKey",void 0);W([S(),G("design:type",String)],vi.prototype,"deviceKeySignedByDid",void 0);W([S(),G("design:type",String)],vi.prototype,"didSignedByDeviceKey",void 0);vi=W([Xe(),G("design:paramtypes",[String,String,String,String,String,String])],vi);var Ec=class{constructor(e,t){this.signature=e,this.publicKey=t}};W([S(),G("design:type",String)],Ec.prototype,"signature",void 0);W([S(),G("design:type",String)],Ec.prototype,"publicKey",void 0);Ec=W([Y(),G("design:paramtypes",[String,String])],Ec);var sa=class{constructor(e,t){this.domain=e,this.pointers=t}};W([S(),G("design:type",String)],sa.prototype,"domain",void 0);W([S(),G("design:type",Array)],sa.prototype,"pointers",void 0);sa=W([Y(),G("design:paramtypes",[String,Array])],sa);var Ac=class{constructor(e,t){this.with=e,this.can=t}};W([S(),G("design:type",sa)],Ac.prototype,"with",void 0);W([S(),G("design:type",Array)],Ac.prototype,"can",void 0);Ac=W([Y(),G("design:paramtypes",[sa,Array])],Ac);var Mr=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};W([S(),G("design:type",String)],Mr.prototype,"appName",void 0);W([S(),G("design:type",String)],Mr.prototype,"appDesc",void 0);W([S(),G("design:type",String)],Mr.prototype,"appUrl",void 0);W([S(),G("design:type",String)],Mr.prototype,"appIconPath",void 0);W([S(),G("design:type",Array)],Mr.prototype,"capabilities",void 0);Mr=W([Y(),G("design:paramtypes",[String,String,String,Array,String])],Mr);var ca=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};W([S(),G("design:type",String)],ca.prototype,"requestId",void 0);W([S(),G("design:type",String)],ca.prototype,"token",void 0);W([S(),G("design:type",Boolean)],ca.prototype,"revoked",void 0);W([S(),G("design:type",Mr)],ca.prototype,"auth",void 0);ca=W([Y(),G("design:paramtypes",[String,Mr,String,Boolean])],ca);var la=class{constructor(e,t){this.domain=e,this.pointers=t}};W([S(),G("design:type",String)],la.prototype,"domain",void 0);W([S(),G("design:type",Array)],la.prototype,"pointers",void 0);la=W([Xe(),G("design:paramtypes",[String,Array])],la);var kc=class{constructor(e,t){this.with=e,this.can=t}};W([S(),G("design:type",la)],kc.prototype,"with",void 0);W([S(),G("design:type",Array)],kc.prototype,"can",void 0);kc=W([Xe(),G("design:paramtypes",[la,Array])],kc);var _r=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};W([S(),G("design:type",String)],_r.prototype,"appName",void 0);W([S(),G("design:type",String)],_r.prototype,"appDesc",void 0);W([S(),G("design:type",String)],_r.prototype,"appDomain",void 0);W([S(),G("design:type",String)],_r.prototype,"appUrl",void 0);W([S(),G("design:type",String)],_r.prototype,"appIconPath",void 0);W([S(),G("design:type",Array)],_r.prototype,"capabilities",void 0);_r=W([Xe(),G("design:paramtypes",[String,String,String,String,String,Array])],_r);var cn=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};W([S(),G("design:type",String)],cn.prototype,"did",void 0);W([S(),G("design:type",Boolean)],cn.prototype,"success",void 0);W([S(),G("design:type",String)],cn.prototype,"error",void 0);cn=W([Y(),G("design:paramtypes",[String,Boolean,String])],cn);var ya=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},va=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Wt=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)}};ya([S(),va("design:type",Boolean)],Wt.prototype,"isInitialized",void 0);ya([S(),va("design:type",Boolean)],Wt.prototype,"isUnlocked",void 0);ya([S(),va("design:type",String)],Wt.prototype,"did",void 0);ya([S(),va("design:type",String)],Wt.prototype,"didDocument",void 0);ya([S(),va("design:type",String)],Wt.prototype,"error",void 0);Wt=ya([Y(),va("design:paramtypes",[Object])],Wt);var ph=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ne=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Et,At,Ju=class{constructor(e,t){Et.set(this,void 0),At.set(this,void 0),ph(this,Et,e,"f"),ph(this,At,t,"f")}async otherAgents(){return await Ne(this,Et,"f").otherAgents(Ne(this,At,"f"))}async hasTelepresenceAdapter(){return await Ne(this,Et,"f").hasTelepresenceAdapter(Ne(this,At,"f"))}async onlineAgents(){return await Ne(this,Et,"f").onlineAgents(Ne(this,At,"f"))}async setOnlineStatus(e){return await Ne(this,Et,"f").setOnlineStatus(Ne(this,At,"f"),e)}async setOnlineStatusU(e){return await Ne(this,Et,"f").setOnlineStatusU(Ne(this,At,"f"),e)}async sendSignal(e,t){return await Ne(this,Et,"f").sendSignal(Ne(this,At,"f"),e,t)}async sendSignalU(e,t){return await Ne(this,Et,"f").sendSignalU(Ne(this,At,"f"),e,t)}async sendBroadcast(e,t=!1){return await Ne(this,Et,"f").sendBroadcast(Ne(this,At,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Ne(this,Et,"f").sendBroadcastU(Ne(this,At,"f"),e,t)}async addSignalHandler(e){await Ne(this,Et,"f").addSignalHandler(Ne(this,At,"f"),e)}removeSignalHandler(e){Ne(this,Et,"f").removeSignalHandler(Ne(this,At,"f"),e)}};Et=new WeakMap,At=new WeakMap;var vn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},J=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)}};vn([S(),bn("design:type",String)],J.prototype,"source",void 0);vn([S(),bn("design:type",String)],J.prototype,"target",void 0);vn([S(),bn("design:type",String)],J.prototype,"predicate",void 0);vn([S(),bn("design:type",Date)],J.prototype,"fromDate",void 0);vn([S(),bn("design:type",Date)],J.prototype,"untilDate",void 0);vn([S(),bn("design:type",Number)],J.prototype,"limit",void 0);J=vn([Y(),Xe(),bn("design:paramtypes",[Object])],J);var dh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},nt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},kt,$r;function Qs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var xe=class{constructor(){kt.set(this,void 0),$r.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal:"))throw new Error("Can't create Literal from non-literal URL");if(e.startsWith("literal://"))throw new Error("literal:// format is no longer supported. Use literal: instead.");let t=new xe;return dh(t,$r,e,"f"),t}static from(e){let t=new xe;return dh(t,kt,e,"f"),t}toUrl(){if(nt(this,$r,"f")&&!nt(this,kt,"f"))return nt(this,$r,"f");if(!nt(this,$r,"f")&&(nt(this,kt,"f")===void 0||nt(this,kt,"f")===""||nt(this,kt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof nt(this,kt,"f")){case"string":e=`string:${Qs(nt(this,kt,"f"))}`;break;case"number":e=`number:${Qs(nt(this,kt,"f"))}`;break;case"boolean":e=`boolean:${Qs(nt(this,kt,"f"))}`;break;case"object":e=`json:${Qs(JSON.stringify(nt(this,kt,"f")))}`;break}return`literal:${e}`}get(){if(nt(this,kt,"f"))return nt(this,kt,"f");if(!nt(this,$r,"f"))throw new Error("Can't render empty Literal");if(!nt(this,$r,"f").startsWith("literal:"))throw new Error("Can't render Literal from non-literal URL");let e=nt(this,$r,"f").substring(8);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};kt=new WeakMap,$r=new WeakMap;function vt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Bc(r){return`set${vt(r)}`}function jm(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function r0(r){return`add${vt(jm(r))}`}function i0(r){return`remove${vt(jm(r))}`}function n0(r){return`set${vt(r)}`}function qm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function Bi(r){if(Array.isArray(r))return`[${r.map(Bi).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var Au=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ne=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ht,mt,De,Eo=class{constructor(r,e,t){ht.set(this,void 0),mt.set(this,void 0),De.set(this,void 0),Au(this,ht,e,"f"),Au(this,mt,t,"f"),Au(this,De,r,"f")}get baseExpression(){return ne(this,ht,"f")}async init(){let isInstance=await ne(this,De,"f").isSubjectInstance(ne(this,ht,"f"),ne(this,mt,"f"));if(!isInstance)throw`Not a valid subject instance of ${ne(this,mt,"f")} for ${ne(this,ht,"f")}`;let results=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ne(this,De,"f").getPropertyValueViaSparql(ne(this,ht,"f"),ne(this,mt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SPARQL:`,e);return}}});let setters=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Bc(property)]=async r=>{resolveLanguage&&(r=await ne(this,De,"f").createExpression(r,resolveLanguage)),await ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:r}])}}let results2=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ne(this,De,"f").getRelationValuesViaSparql(ne(this,ht,"f"),ne(this,mt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SPARQL:`,e),[]}}});let adders=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[r0(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:e}]))):await ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:r}])}}let removers=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[i0(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:e}]))):await ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:r}])}}let relationSetters=await ne(this,De,"f").infer(`subject_class("${ne(this,mt,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[n0(relation)]=async r=>{Array.isArray(r)?await ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),r.map(e=>({name:"value",value:e}))):await ne(this,De,"f").executeAction(actions,ne(this,ht,"f"),[{name:"value",value:r}])}}}};ht=new WeakMap,mt=new WeakMap,De=new WeakMap;function a0(r,e,t,i){let n="",a=qm(8);n+=`subject_class("${r}", ${a}).
|
|
62
62
|
`;let o=[],s=[];e.subjectConstructor&&e.subjectConstructor.length&&(s=s.concat(e.subjectConstructor));let c=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(c=c.concat(e.isSubjectInstance));let l=[];for(let p in t){let h=`property(${a}, "${p}").
|
|
63
|
-
`,{through:m,initial:
|
|
64
|
-
`,h+=`property_resolve_language(${a}, "${p}", "${
|
|
65
|
-
`),
|
|
63
|
+
`,{through:m,initial:g,required:_,resolveLanguage:w,writable:y,flag:b,prologGetter:A,prologSetter:T,local:x}=t[p];if(w&&(h+=`property_resolve(${a}, "${p}").
|
|
64
|
+
`,h+=`property_resolve_language(${a}, "${p}", "${w}").
|
|
65
|
+
`),A?h+=`property_getter(${a}, Base, "${p}", Value) :- ${A}.
|
|
66
66
|
`:m&&(h+=`property_getter(${a}, Base, "${p}", Value) :- triple(Base, "${m}", Value).
|
|
67
|
-
`,
|
|
68
|
-
`;else if(
|
|
69
|
-
`}l.push(h);let
|
|
70
|
-
`,{predicate:m,local:
|
|
71
|
-
`;let
|
|
72
|
-
`,h+=`collection_remover(${a}, "${p}", '${
|
|
73
|
-
`,h+=`collection_setter(${a}, "${p}", '${
|
|
74
|
-
`}u.push(h)}let
|
|
67
|
+
`,_&&(b?c.push(`triple(Base, "${m}", "${g}")`):c.push(`triple(Base, "${m}", _)`))),T)h+=`property_setter(${a}, "${p}", Actions) :- ${T}.
|
|
68
|
+
`;else if(y&&m&&typeof e[Bc(p)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:m,target:"value",...x&&{local:!0}}];h+=`property_setter(${a}, "${p}", '${Bi(P)}').
|
|
69
|
+
`}l.push(h);let O=g??(_&&y&&!b&&m?"literal:string:":void 0);O&&(s.push({action:"addLink",source:"this",predicate:m,target:O}),o.push({action:"removeLink",source:"this",predicate:m,target:"*"}))}let u=[],f=Object.fromEntries(Object.entries(i).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let p in f){let h=`collection(${a}, "${p}").
|
|
70
|
+
`,{predicate:m,local:g}=f[p];if(m){h+=`collection_getter(${a}, Base, "${p}", List) :- findall(C, triple(Base, "${m}", C), List).
|
|
71
|
+
`;let _=[{action:"addLink",source:"this",predicate:m,target:"value",...g&&{local:!0}}],w=[{action:"removeLink",source:"this",predicate:m,target:"value"}],y=[{action:"collectionSetter",source:"this",predicate:m,target:"value",...g&&{local:!0}}];h+=`collection_adder(${a}, "${p}", '${Bi(_)}').
|
|
72
|
+
`,h+=`collection_remover(${a}, "${p}", '${Bi(w)}').
|
|
73
|
+
`,h+=`collection_setter(${a}, "${p}", '${Bi(y)}').
|
|
74
|
+
`}u.push(h)}let d=Bi(s);if(n+=`constructor(${a}, '${d}').
|
|
75
75
|
`,c.length>0){let p=c.join(", ");n+=`instance(${a}, Base) :- ${p}.
|
|
76
76
|
`,n+=`
|
|
77
|
-
`}return n+=`destructor(${a}, '${
|
|
77
|
+
`}return n+=`destructor(${a}, '${Bi(o)}').
|
|
78
78
|
`,n+=`
|
|
79
79
|
`,n+=l.join(`
|
|
80
80
|
`),n+=`
|
|
81
81
|
`,n+=u.join(`
|
|
82
|
-
`),{sdna:n,name:r}}function
|
|
82
|
+
`),{sdna:n,name:r}}function fh(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(0,e+1);let t=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let i=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return i?i[1]:""}function hh(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function mh(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(e+1);let t=r.lastIndexOf("/");if(t!==-1&&t<r.length-1)return r.substring(t+1);let i=r.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return i?i[1]:r}var di=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let i=fh(e),n=mh(e);this.nodeShapeUri=`${i}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
83
83
|
`;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
84
84
|
`,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
85
85
|
`,e+=`@prefix ad4m: <ad4m://> .
|
|
@@ -94,25 +94,25 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
94
94
|
`),i.nodeKind&&(e+=` sh:nodeKind sh:${i.nodeKind} ;
|
|
95
95
|
`),i.minCount!==void 0&&(e+=` sh:minCount ${i.minCount} ;
|
|
96
96
|
`),i.maxCount!==void 0&&(e+=` sh:maxCount ${i.maxCount} ;
|
|
97
|
-
`),i.pattern&&(e+=` sh:pattern "${
|
|
97
|
+
`),i.pattern&&(e+=` sh:pattern "${hh(i.pattern)}" ;
|
|
98
98
|
`),i.minInclusive!==void 0&&(e+=` sh:minInclusive ${i.minInclusive} ;
|
|
99
99
|
`),i.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${i.maxInclusive} ;
|
|
100
|
-
`),i.hasValue&&(e+=` sh:hasValue "${
|
|
100
|
+
`),i.hasValue&&(e+=` sh:hasValue "${hh(i.hasValue)}" ;
|
|
101
101
|
`),i.local!==void 0&&(e+=` ad4m:local ${i.local} ;
|
|
102
102
|
`),i.writable!==void 0&&(e+=` ad4m:writable ${i.writable} ;
|
|
103
103
|
`),e=e.slice(0,-2)+`
|
|
104
104
|
`,e+=n?` ] .
|
|
105
105
|
`:` ] ;
|
|
106
|
-
`}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal:string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal:string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let i=this.properties[t],n;if(i.name&&this.targetClass){let a=sh(this.targetClass),o=lh(this.targetClass);n=`${a}${o}.${i.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:i.path}),i.datatype&&e.push({source:n,predicate:"sh://datatype",target:i.datatype}),i.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${i.nodeKind}`}),i.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal:${i.minCount}^^xsd:integer`}),i.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal:${i.maxCount}^^xsd:integer`}),i.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal:${i.pattern}`}),i.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal:${i.minInclusive}`}),i.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal:${i.maxInclusive}`}),i.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal:${i.hasValue}`}),i.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal:${i.local}`}),i.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal:${i.writable}`}),i.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal:string:${i.resolveLanguage}`}),i.setter&&i.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal:string:${JSON.stringify(i.setter)}`}),i.adder&&i.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal:string:${JSON.stringify(i.adder)}`}),i.remover&&i.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal:string:${JSON.stringify(i.remover)}`}),i.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal:string:${i.getter}`}),i.conformanceConditions&&i.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal:string:${JSON.stringify(i.conformanceConditions)}`}),i.class&&e.push({source:n,predicate:"sh://class",target:i.class})}return e}static fromLinks(e,t){let i=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new ui(t,i?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace(/^literal:\/\/string:|^literal:string:/,"");n.constructor_actions=JSON.parse(c)}catch{}let o=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(o)try{let c=o.target.replace(/^literal:\/\/string:|^literal:string:/,"");n.destructor_actions=JSON.parse(c)}catch{}let s=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of s){let l=c.target,u=e.find(T=>T.source===l&&T.predicate==="sh://path");if(!u)continue;let d;if(!l.startsWith("_:")){let T=l.lastIndexOf(".");T!==-1&&(d=l.substring(T+1))}let f={name:d,path:u.target},p=e.find(T=>T.source===l&&T.predicate==="sh://datatype");p&&(f.datatype=p.target);let h=e.find(T=>T.source===l&&T.predicate==="sh://nodeKind");h&&(f.nodeKind=h.target.replace("sh://",""));let m=e.find(T=>T.source===l&&T.predicate==="sh://minCount");if(m){let T=m.target.replace(/^literal:\/\/|^literal:/,"").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),f.minCount=parseInt(T)}let y=e.find(T=>T.source===l&&T.predicate==="sh://maxCount");if(y){let T=y.target.replace(/^literal:\/\/|^literal:/,"").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),f.maxCount=parseInt(T)}let b=e.find(T=>T.source===l&&T.predicate==="sh://pattern");b&&(f.pattern=b.target.replace(/^literal:\/\/|^literal:/,""));let _=e.find(T=>T.source===l&&T.predicate==="sh://minInclusive");if(_){let T=_.target.replace(/^literal:\/\/|^literal:/,"");T.startsWith("number:")&&(T=T.substring(7)),f.minInclusive=parseFloat(T)}let S=e.find(T=>T.source===l&&T.predicate==="sh://maxInclusive");if(S){let T=S.target.replace(/^literal:\/\/|^literal:/,"");T.startsWith("number:")&&(T=T.substring(7)),f.maxInclusive=parseFloat(T)}let v=e.find(T=>T.source===l&&T.predicate==="sh://hasValue");v&&(f.hasValue=v.target.replace(/^literal:\/\/|^literal:/,""));let C=e.find(T=>T.source===l&&T.predicate==="ad4m://local");if(C){let T=C.target.replace(/^literal:\/\/|^literal:/,"");T.startsWith("boolean:")&&(T=T.substring(8)),f.local=T==="true"}let $=e.find(T=>T.source===l&&T.predicate==="ad4m://writable");if($){let T=$.target.replace(/^literal:\/\/|^literal:/,"");T.startsWith("boolean:")&&(T=T.substring(8)),f.writable=T==="true"}let I=e.find(T=>T.source===l&&T.predicate==="ad4m://resolveLanguage");I&&(f.resolveLanguage=I.target.replace(/^literal:\/\/string:|^literal:string:/,""));let L=e.find(T=>T.source===l&&T.predicate==="ad4m://setter");if(L)try{let T=L.target.replace(/^literal:\/\/string:|^literal:string:/,"");f.setter=JSON.parse(T)}catch{}let M=e.find(T=>T.source===l&&T.predicate==="ad4m://adder");if(M)try{let T=M.target.replace(/^literal:\/\/string:|^literal:string:/,"");f.adder=JSON.parse(T)}catch{}let N=e.find(T=>T.source===l&&T.predicate==="ad4m://remover");if(N)try{let T=N.target.replace(/^literal:\/\/string:|^literal:string:/,"");f.remover=JSON.parse(T)}catch{}let W=e.find(T=>T.source===l&&T.predicate==="ad4m://getter");W&&(f.getter=W.target.replace(/^literal:\/\/string:|^literal:string:/,""));let Ie=e.find(T=>T.source===l&&T.predicate==="ad4m://conformanceConditions");if(Ie)try{let T=Ie.target.replace(/^literal:\/\/string:|^literal:string:/,"");f.conformanceConditions=JSON.parse(T)}catch{}let Oe=e.find(T=>T.source===l&&T.predicate==="sh://class");Oe&&(f.class=Oe.target),n.addProperty(f)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new ui(e.node_shape_uri,e.target_class):new ui(e.target_class);for(let i of e.properties||[])t.addProperty({path:i.path,name:i.name,datatype:i.datatype,nodeKind:i.node_kind,minCount:i.min_count,maxCount:i.max_count,minInclusive:i.min_inclusive,maxInclusive:i.max_inclusive,pattern:i.pattern,hasValue:i.has_value,local:i.local,writable:i.writable,resolveLanguage:i.resolve_language,setter:i.setter,adder:i.adder,remover:i.remover,getter:i.getter,conformanceConditions:i.conformance_conditions,class:i.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let i of e.parent_shapes)t.addParentShape(i);return t}};function uh(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function Fm(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${uh(e)} your ${t} actions, with access to ${uh(i)}`}function Lr(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function e0(r){return typeof r=="string"?`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?`[${r.map(e=>e0(e)).join(", ")}]`:String(r)}function t0(r,e,t){let i=Lr(r),n=!t?.resolveLanguage||t.resolveLanguage==="literal";function a(o){return typeof o=="string"?n?`<literal:string:${Lr(o)}>`:`<${Lr(o)}>`:`<literal:string:${o}>`}if(Array.isArray(e)){let o=e.map(a).join(", ");return`FILTER EXISTS { ?target <${i}> ?_val . FILTER(?_val IN (${o})) }`}else if(typeof e=="object"&&e!==null){let o=e,s=[];if(o.not!==void 0)if(Array.isArray(o.not)){let l=o.not.map(u=>a(u)).join(", ");s.push(`FILTER NOT EXISTS { ?target <${i}> ?_nval . FILTER(?_nval IN (${l})) }`)}else s.push(`FILTER NOT EXISTS { ?target <${i}> ${a(o.not)} }`);return(o.gt!==void 0||o.gte!==void 0||o.lt!==void 0||o.lte!==void 0||o.between!==void 0||o.contains!==void 0)&&s.push(`FILTER EXISTS { ?target <${i}> ?_cmp }`),s.join(" ")}else return`?target <${i}> ${a(e)} .`}function Mm(r,e){let t=[];for(let[i,n]of Object.entries(r)){if(["id","author","timestamp"].includes(i))continue;let a,o;if(e){let c=e.properties[i];c?(a=c.predicate,o=c.resolveLanguage):a=i}else a=i;let s=t0(a,n,{resolveLanguage:o});s&&t.push(s)}return t}function r0(r,e,t,i,n){let a=e.prototype,o="ad4m://",s=Object.fromEntries(Object.entries(i).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(t).length>0){let h=t[Object.keys(t)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}else if(Object.keys(s).length>0){let h=s[Object.keys(s)[0]];if(h.predicate){let m=h.predicate.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}let c=`${o}${r}Shape`,l=`${o}${r}`,u=new ui(c,l),d=Object.getPrototypeOf(e);if(d&&typeof d.generateSHACL=="function"){let h=d.generateSHACL();h?.shape?.nodeShapeUri&&u.addParentShape(h.shape.nodeShapeUri)}let f=[];a.subjectConstructor&&a.subjectConstructor.length&&(f=f.concat(a.subjectConstructor));let p=[];for(let h in t){let m=t[h];if(!m.through)continue;let y={name:h,path:m.through};if(m.resolveLanguage==="literal")y.datatype="xsd://string";else if(m.initial){let _=typeof a[h];_==="number"?y.datatype="xsd://integer":_==="boolean"?y.datatype="xsd://boolean":_==="string"&&(y.datatype="xsd://string")}m.required&&(y.minCount=1),y.maxCount=1,m.flag&&m.initial&&(y.hasValue=m.initial),m.local!==void 0&&(y.local=m.local),m.writable!==void 0&&(y.writable=m.writable),m.resolveLanguage&&(y.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${r}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):m.writable&&m.through&&typeof a[jc(h)]=="function"&&(y.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let b=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal:string:":void 0);b&&(f.push({action:"addLink",source:"this",predicate:m.through,target:b}),p.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),u.addProperty(y)}for(let h in s){let m=s[h];if(!m.predicate)continue;let y={name:h,path:m.predicate};if(y.nodeKind="IRI",m.local!==void 0&&(y.local=m.local),y.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],y.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],m.getter)y.getter=m.getter;else if(m.where)try{let b=m.target?.(),_=b?b.getModelMetadata?.()??null:null,S=Mm(m.where,_);if(S.length>0){let v=Lr(m.predicate);y.getter=`SELECT ?target WHERE { <Base> <${v}> ?target . ${S.join(" ")} }`}}catch{}else if(m.target&&m.filter!==!1){let b=m.target,_=m.predicate,S=!1,v,C,$=()=>{if(!S){S=!0;try{let I=b(),L=n(_,I);L&&(v=L.getter,C=L.conformanceConditions)}catch{}}};Object.defineProperty(y,"getter",{get(){return $(),v},set(I){S=!0,v=I},enumerable:!0,configurable:!0}),Object.defineProperty(y,"conformanceConditions",{get(){return $(),C},set(I){S=!0,C=I},enumerable:!0,configurable:!0})}if(m.target)try{let _=m.target().generateSHACL?.();_?.shape?.nodeShapeUri&&(y.class=_.shape.nodeShapeUri)}catch{}u.addProperty(y)}return u.setConstructorActions(f),u.setDestructorActions(p),{shape:u,name:r}}var vr=new WeakMap,lt=new WeakMap,ph=new WeakMap,dh=new WeakMap,fh=new WeakMap;function sn(r){let e=ph.get(r);if(e)return e;let t={},i=[],n=r;for(;n&&n!==Object;)i.unshift(n),n=Object.getPrototypeOf(n);for(let a of i){let o=vr.get(a);o&&Object.assign(t,o)}return ph.set(r,t),t}function hr(r){let e=dh.get(r);if(e)return e;let t={},i=[],n=r;for(;n&&n!==Object;)i.unshift(n),n=Object.getPrototypeOf(n);for(let a of i){let o=lt.get(a);o&&Object.assign(t,o)}return dh.set(r,t),t}function i0(r,e){let t=fh.get(r);if(t)return t;let i=e();return fh.set(r,i),i}function n0(r,e,t){vr.has(r)||vr.set(r,{}),vr.get(r)[e]=t}function a0(r,e,t){lt.has(r)||lt.set(r,{}),lt.get(r)[e]=t}function Um(r,e){try{let t=sn(e),i=[],n=[],a=0;for(let[s,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(i.push({type:"flag",predicate:c.through,value:c.initial}),n.push(`?target <${Lr(c.through)}> <${Lr(c.initial)}> .`));for(let[s,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(i.push({type:"required",predicate:c.through}),n.push(`?target <${Lr(c.through)}> ?_v${a++} .`));return i.length===0?void 0:{getter:`SELECT ?target WHERE { <Base> <${Lr(r)}> ?target . ${n.join(" ")} }`,conformanceConditions:i}}catch{return}}function qc(r){return function(e,t){let i=r.readOnly?!1:!!r.through;if(r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' or 'getter' option");let n=e.constructor;if(vr.has(n)||vr.set(n,{}),vr.get(n)[t]={...r,writable:i},i){let a=t;e[`set${vt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function yO(r){return qc({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function vO(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");let i={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;vr.has(n)||vr.set(n,{}),vr.get(n)[t]=i,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function o0(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){return Xb(r.name,e.prototype,sn(e),hr(e))},e.generateSHACL=function(){return i0(e,()=>r0(r.name,e,sn(e),hr(e),Um))},Object.defineProperty(e,"type",{configurable:!0})}}function s0(r){let e=r.required??!1;return qc({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal:string:uninitialized":void 0)})}function bO(r){return s0({...r,readOnly:!0})}function Bc(r,e){let t=typeof r=="function"?{...e||{},target:r}:r;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw getter expression.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function wO(r,e){let t=Bc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=n;t.through&&(i[`add${vt(s)}`]=async function(c,l){return this.addRelationValue(s,c,l)},i[`remove${vt(s)}`]=async function(c,l){return this.removeRelationValue(s,c,l)},i[`set${vt(s)}`]=async function(c,l){return this.setRelationValues(s,c,l)}),Object.defineProperty(i,s,{configurable:!0,writable:!0})}}function SO(r,e){let t=Bc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=n;t.through?(qc({through:t.through,readOnly:!1,local:t.local})(i,n),i[`add${vt(s)}`]=async function(c){return this.addRelationValue(s,c)},i[`remove${vt(s)}`]=async function(c){return this.removeRelationValue(s,c)},i[`set${vt(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(i,s,{configurable:!0,writable:!0})}}function _O(r,e){let t=Bc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?qc({through:t.through,readOnly:!0,local:t.local})(i,n):Object.defineProperty(i,n,{configurable:!0,writable:!0})}}function xO(r,e){let t=Bc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(i,n,{configurable:!0,writable:!0})}}var Nr=new Map,c0=200;function jm(r,e){return`${r}:${e}`}function l0(r,e){let t=jm(r,e),i=Nr.get(t);if(!!i){if(Date.now()>i.expiry){Nr.delete(t);return}return i.result}}function u0(r,e,t,i=c0){let n=Date.now();for(let[o,s]of Nr)n>s.expiry&&Nr.delete(o);let a=jm(r,e);Nr.set(a,{result:t,expiry:n+i})}function Xr(r){let e=r+":";for(let[t]of Nr)t.startsWith(e)&&Nr.delete(t)}function EO(){Nr.clear()}function kO(){return Nr.size}var ca=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:xe.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal:string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal:string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let i of this._states){let n=this.stateUri(i.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:xe.from(i.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:xe.from(i.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal:string:${encodeURIComponent(JSON.stringify(i.stateCheck))}`})}for(let i of this._transitions){let n=this.transitionUri(i.fromState,i.toState),a=this.stateUri(i.fromState),o=this.stateUri(i.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:xe.from(i.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:o}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal:string:${encodeURIComponent(JSON.stringify(i.actions))}`})}return e}static fromLinks(e,t){let i="Flow";if(!t.endsWith(i))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-i.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),o=n.slice(0,a+1),s=n.slice(a+1),c=new ca(s,o),l=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(l)if(l.target==="ad4m://any")c.flowable="any";else try{let h=l.target.replace(/^literal:\/\/string:|^literal:string:/,"");c.flowable=JSON.parse(decodeURIComponent(h))}catch{c.flowable="any"}let u=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(u)try{let h=u.target.replace(/^literal:\/\/string:|^literal:string:/,"");c.startAction=JSON.parse(decodeURIComponent(h))}catch{}let d=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),f=new Map;for(let h of d){let m=h.target,y=e.find($=>$.source===m&&$.predicate==="ad4m://stateName"),b=y?xe.fromUrl(y.target).get():"";f.set(m,b);let _=e.find($=>$.source===m&&$.predicate==="ad4m://stateValue"),S=_?xe.fromUrl(_.target).get():0,v=e.find($=>$.source===m&&$.predicate==="ad4m://stateCheck"),C={predicate:"",target:""};if(v)try{let $=v.target.replace(/^literal:\/\/string:|^literal:string:/,"");C=JSON.parse(decodeURIComponent($))}catch{}c.addState({name:b,value:S,stateCheck:C})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,y=e.find(N=>N.source===m&&N.predicate==="ad4m://actionName"),b=y?xe.fromUrl(y.target).get():"",S=e.find(N=>N.source===m&&N.predicate==="ad4m://fromState")?.target||"",v=f.get(S)||"",$=e.find(N=>N.source===m&&N.predicate==="ad4m://toState")?.target||"",I=f.get($)||"",L=e.find(N=>N.source===m&&N.predicate==="ad4m://transitionActions"),M=[];if(L)try{let N=L.target.replace(/^literal:\/\/string:|^literal:string:/,"");M=JSON.parse(decodeURIComponent(N))}catch{}c.addTransition({actionName:b,fromState:v,toState:I,actions:M})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new ca(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let i of e.states||[])t.addState(i);for(let i of e.transitions||[])t.addTransition(i);return t}},ve=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},O=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},oc,ta,ii,qi,Ji,ni,ai,Bi,Za,sc,Vi,Qi,Qt,Ya,Gu,ie,me,Hi,zi,Wi,Xa,eo,Ac=class{constructor(e,t,i){oc.add(this),ta.set(this,void 0),ii.set(this,void 0),qi.set(this,void 0),Ji.set(this,void 0),ni.set(this,void 0),ai.set(this,void 0),Bi.set(this,void 0),Za.set(this,!1),sc.set(this,void 0),Vi.set(this,void 0),Qi.set(this,void 0),Qt.set(this,void 0),Ya.set(this,void 0),ve(this,ta,e,"f"),ve(this,Ya,t,"f"),ve(this,qi,i,"f"),ve(this,Ji,new Set,"f"),ve(this,Bi,null,"f"),ve(this,sc,new Promise((n,a)=>{ve(this,Vi,n,"f"),ve(this,Qi,a,"f")}),"f")}async subscribe(){O(this,ai,"f")&&(O(this,ai,"f").call(this),ve(this,ai,void 0,"f")),O(this,Qt,"f")&&(clearTimeout(O(this,Qt,"f")),ve(this,Qt,void 0,"f")),O(this,ni,"f")&&(clearTimeout(O(this,ni,"f")),ve(this,ni,void 0,"f"));try{let t;t=await O(this,qi,"f").subscribeQuery(O(this,ta,"f"),O(this,Ya,"f")),ve(this,ii,t.subscriptionId,"f"),t.result?(ve(this,Bi,t.result,"f"),O(this,oc,"m",Gu).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ve(this,Qt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),ve(this,ai,O(this,qi,"f").subscribeToQueryUpdates(O(this,ii,"f"),i=>{O(this,Qt,"f")&&(clearTimeout(O(this,Qt,"f")),ve(this,Qt,void 0,"f")),O(this,Vi,"f")&&(O(this,Vi,"f").call(this,!0),ve(this,Vi,void 0,"f"),ve(this,Qi,void 0,"f")),!(i.isInit&&O(this,Bi,"f"))&&(ve(this,Bi,i,"f"),O(this,oc,"m",Gu).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,Qi,"f")&&(O(this,Qi,"f").call(this,t),ve(this,Vi,void 0,"f"),ve(this,Qi,void 0,"f")),t}let e=async()=>{if(!O(this,Za,"f")){try{await O(this,qi,"f").keepAliveQuery(O(this,ta,"f"),O(this,ii,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,Ya,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}O(this,Za,"f")||ve(this,ni,setTimeout(e,3e4),"f")}};ve(this,ni,setTimeout(e,3e4),"f")}get id(){return O(this,ii,"f")}get initialized(){return O(this,sc,"f")}get result(){return O(this,Bi,"f")}onResult(e){return O(this,Ji,"f").add(e),()=>O(this,Ji,"f").delete(e)}dispose(){ve(this,Za,!0,"f"),clearTimeout(O(this,ni,"f")),O(this,ai,"f")&&O(this,ai,"f").call(this),O(this,Ji,"f").clear(),O(this,Qt,"f")&&(clearTimeout(O(this,Qt,"f")),ve(this,Qt,void 0,"f")),O(this,ii,"f")&&O(this,qi,"f").disposeQuerySubscription(O(this,ta,"f"),O(this,ii,"f")).catch(e=>console.error("Error disposing query subscription:",e))}};ta=new WeakMap,ii=new WeakMap,qi=new WeakMap,Ji=new WeakMap,ni=new WeakMap,ai=new WeakMap,Bi=new WeakMap,Za=new WeakMap,sc=new WeakMap,Vi=new WeakMap,Qi=new WeakMap,Qt=new WeakMap,Ya=new WeakMap,oc=new WeakSet,Gu=function r(e){for(let t of O(this,Ji,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var ia=class{constructor(e,t){ie.set(this,void 0),me.set(this,void 0),Hi.set(this,void 0),zi.set(this,void 0),Wi.set(this,void 0),Xa.set(this,void 0),eo.set(this,new Set),ve(this,Hi,[],"f"),ve(this,zi,[],"f"),ve(this,Wi,[],"f"),ve(this,Xa,[],"f"),ve(this,ie,e,"f"),ve(this,me,t,"f"),this.uuid=O(this,ie,"f").uuid,this.name=O(this,ie,"f").name,this.owners=O(this,ie,"f").owners,this.sharedUrl=O(this,ie,"f").sharedUrl,this.neighbourhood=O(this,ie,"f").neighbourhood,this.state=O(this,ie,"f").state,O(this,me,"f").addPerspectiveLinkAddedListener(O(this,ie,"f").uuid,O(this,Hi,"f")),O(this,me,"f").addPerspectiveLinkRemovedListener(O(this,ie,"f").uuid,O(this,zi,"f")),O(this,me,"f").addPerspectiveLinkUpdatedListener(O(this,ie,"f").uuid,O(this,Wi,"f")),O(this,me,"f").addPerspectiveSyncStateChangeListener(O(this,ie,"f").uuid,O(this,Xa,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,i,n){let a=await O(this,me,"f").executeCommands(O(this,ie,"f").uuid,JSON.stringify(e),t,JSON.stringify(i),n);return Xr(O(this,ie,"f").uuid),a}async get(e){return await O(this,me,"f").queryLinks(O(this,ie,"f").uuid,e)}async infer(e){return await O(this,me,"f").queryProlog(O(this,ie,"f").uuid,e)}async querySparql(e){let t=l0(O(this,ie,"f").uuid,e);if(t!==void 0)return t;let i=await O(this,me,"f").querySparql(O(this,ie,"f").uuid,e);return u0(O(this,ie,"f").uuid,e,i),i}async add(e,t="shared",i){let n=await O(this,me,"f").addLink(O(this,ie,"f").uuid,e,t,i);return Xr(O(this,ie,"f").uuid),n}async addLinks(e,t="shared",i){let n=await O(this,me,"f").addLinks(O(this,ie,"f").uuid,e,t,i);return Xr(O(this,ie,"f").uuid),n}async removeLinks(e,t){let i=await O(this,me,"f").removeLinks(O(this,ie,"f").uuid,e,t);return Xr(O(this,ie,"f").uuid),i}async linkMutations(e,t="shared"){let i=await O(this,me,"f").linkMutations(O(this,ie,"f").uuid,e,t);return Xr(O(this,ie,"f").uuid),i}async addLinkExpression(e,t="shared",i){return await O(this,me,"f").addLinkExpression(O(this,ie,"f").uuid,e,t,i)}async update(e,t,i){let n=await O(this,me,"f").updateLink(O(this,ie,"f").uuid,e,t,i);return Xr(O(this,ie,"f").uuid),n}async remove(e,t){let i=await O(this,me,"f").removeLink(O(this,ie,"f").uuid,e,t);return Xr(O(this,ie,"f").uuid),i}async createBatch(){return await O(this,me,"f").createBatch(O(this,ie,"f").uuid)}async commitBatch(e){let t=await O(this,me,"f").commitBatch(O(this,ie,"f").uuid,e);return Xr(O(this,ie,"f").uuid),t}async getExpression(e){return await O(this,me,"f").getExpression(e)}async createExpression(e,t){return await O(this,me,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,Hi,"f").push(t):e==="link-removed"?O(this,zi,"f").push(t):e==="link-updated"&&O(this,Wi,"f").push(t)}async addSyncStateChangeListener(e){O(this,Xa,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let i=O(this,Hi,"f").indexOf(t);O(this,Hi,"f").splice(i,1)}else if(e==="link-removed"){let i=O(this,zi,"f").indexOf(t);O(this,zi,"f").splice(i,1)}else if(e==="link-updated"){let i=O(this,Wi,"f").indexOf(t);O(this,Wi,"f").splice(i,1)}}async snapshot(){return O(this,me,"f").snapshotByUUID(O(this,ie,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(i=>{delete i.data.__typename});for(let i of t.links)await this.addLinkExpression(i)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let i=new K({source:e.source,predicate:e.predicate}),n=await this.get(i),a=[];for(let s of n)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,a.push(s);let o=[e];await this.linkMutations({additions:o,removals:a},t)}async sdnaFlows(){return(await this.get(new K({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return xe.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),i=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")i.push(n);else{let o=a.flowable,s=o.source||e;(await this.get(new K({source:s,predicate:o.predicate,target:o.target}))).length>0&&i.push(n)}}return i}async startFlow(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;if(i.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(i.startAction,t,void 0)}async expressionsInFlowState(e,t){let i=await this.getFlow(e);if(!i)return[];let n=i.states.find(s=>s.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new K({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;for(let n of i.states){let a=n.stateCheck,o=a.source||t;if((await this.get(new K({source:o,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let i=await this.getFlow(e);if(!i)return[];let n=null;for(let a of i.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new K({source:s,predicate:o.predicate,target:o.target}))).length>0){n=a.name;break}}return n?i.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,i){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(o=>o.actionName===i);if(!a)throw`Action "${i}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let i of e){let n=await this.get(new K({source:"ad4m://self",predicate:i}));for(let a of n){let o=a.data.target,s=await this.get(new K({source:o,predicate:"ad4m://sdna"}));for(let c of s){let l=xe.fromUrl(c.data.target).get();typeof l=="string"&&t.push(l)}}}return t}async getSdnaForClass(e){let t=xe.from(e);if((await this.get(new K({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new K({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=xe.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,i,n){return O(this,me,"f").addSdna(O(this,ie,"f").uuid,e,t,i,n)}async addSubjectClass(e,t){return this.addSdna(e,"","subject_class",t)}async addShacl(e,t){let i=t.toLinks(),n=xe.fromUrl(`literal:string:shacl://${e}`),a=[...i.map(o=>new It({source:o.source,predicate:o.predicate,target:o.target})),new It({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new It({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=xe.fromUrl(`literal:string:shacl://${e}`),i=await this.get(new K({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(i.length===0)return null;let n=i[0].data.target,a=await this.get(new K({source:n,predicate:"sh://property"})),o=[n,...a.map(l=>l.data.target)],s=[];for(let l of o){let u=await this.get(new K({source:l}));for(let d of u)s.push({source:d.data.source,predicate:d.data.predicate,target:d.data.target})}let c=s;return ui.fromLinks(c,n)}async getAllShacl(){let e=await this.get(new K({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let i of e){let n=i.data.target,o=xe.fromUrl(n).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let i=t.toLinks(),n=xe.from(e).toUrl(),a=[...i.map(o=>new It({source:o.source,predicate:o.predicate,target:o.target})),new It({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new It({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=xe.from(e).toUrl(),i=await this.get(new K({source:t,predicate:"ad4m://flow_uri"}));if(i.length===0)return null;let n=i[0].data.target,a=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=`SELECT ?s ?p ?o WHERE {
|
|
106
|
+
`}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal:string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal:string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let i=this.properties[t],n;if(i.name&&this.targetClass){let a=fh(this.targetClass),o=mh(this.targetClass);n=`${a}${o}.${i.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:i.path}),i.datatype&&e.push({source:n,predicate:"sh://datatype",target:i.datatype}),i.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${i.nodeKind}`}),i.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal:${i.minCount}^^xsd:integer`}),i.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal:${i.maxCount}^^xsd:integer`}),i.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal:${i.pattern}`}),i.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal:${i.minInclusive}`}),i.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal:${i.maxInclusive}`}),i.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal:${i.hasValue}`}),i.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal:${i.local}`}),i.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal:${i.writable}`}),i.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal:string:${i.resolveLanguage}`}),i.setter&&i.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal:string:${JSON.stringify(i.setter)}`}),i.adder&&i.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal:string:${JSON.stringify(i.adder)}`}),i.remover&&i.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal:string:${JSON.stringify(i.remover)}`}),i.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal:string:${i.getter}`}),i.conformanceConditions&&i.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal:string:${JSON.stringify(i.conformanceConditions)}`}),i.class&&e.push({source:n,predicate:"sh://class",target:i.class})}return e}static fromLinks(e,t){let i=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new di(t,i?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace(/^literal:\/\/string:|^literal:string:/,"");n.constructor_actions=JSON.parse(c)}catch{}let o=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(o)try{let c=o.target.replace(/^literal:\/\/string:|^literal:string:/,"");n.destructor_actions=JSON.parse(c)}catch{}let s=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of s){let l=c.target,u=e.find(C=>C.source===l&&C.predicate==="sh://path");if(!u)continue;let f;if(!l.startsWith("_:")){let C=l.lastIndexOf(".");C!==-1&&(f=l.substring(C+1))}let d={name:f,path:u.target},p=e.find(C=>C.source===l&&C.predicate==="sh://datatype");p&&(d.datatype=p.target);let h=e.find(C=>C.source===l&&C.predicate==="sh://nodeKind");h&&(d.nodeKind=h.target.replace("sh://",""));let m=e.find(C=>C.source===l&&C.predicate==="sh://minCount");if(m){let C=m.target.replace(/^literal:\/\/|^literal:/,"").replace(/\^\^.*$/,"");C.startsWith("number:")&&(C=C.substring(7)),d.minCount=parseInt(C)}let g=e.find(C=>C.source===l&&C.predicate==="sh://maxCount");if(g){let C=g.target.replace(/^literal:\/\/|^literal:/,"").replace(/\^\^.*$/,"");C.startsWith("number:")&&(C=C.substring(7)),d.maxCount=parseInt(C)}let _=e.find(C=>C.source===l&&C.predicate==="sh://pattern");_&&(d.pattern=_.target.replace(/^literal:\/\/|^literal:/,""));let w=e.find(C=>C.source===l&&C.predicate==="sh://minInclusive");if(w){let C=w.target.replace(/^literal:\/\/|^literal:/,"");C.startsWith("number:")&&(C=C.substring(7)),d.minInclusive=parseFloat(C)}let y=e.find(C=>C.source===l&&C.predicate==="sh://maxInclusive");if(y){let C=y.target.replace(/^literal:\/\/|^literal:/,"");C.startsWith("number:")&&(C=C.substring(7)),d.maxInclusive=parseFloat(C)}let b=e.find(C=>C.source===l&&C.predicate==="sh://hasValue");b&&(d.hasValue=b.target.replace(/^literal:\/\/|^literal:/,""));let A=e.find(C=>C.source===l&&C.predicate==="ad4m://local");if(A){let C=A.target.replace(/^literal:\/\/|^literal:/,"");C.startsWith("boolean:")&&(C=C.substring(8)),d.local=C==="true"}let T=e.find(C=>C.source===l&&C.predicate==="ad4m://writable");if(T){let C=T.target.replace(/^literal:\/\/|^literal:/,"");C.startsWith("boolean:")&&(C=C.substring(8)),d.writable=C==="true"}let x=e.find(C=>C.source===l&&C.predicate==="ad4m://resolveLanguage");x&&(d.resolveLanguage=x.target.replace(/^literal:\/\/string:|^literal:string:/,""));let O=e.find(C=>C.source===l&&C.predicate==="ad4m://setter");if(O)try{let C=O.target.replace(/^literal:\/\/string:|^literal:string:/,"");d.setter=JSON.parse(C)}catch{}let D=e.find(C=>C.source===l&&C.predicate==="ad4m://adder");if(D)try{let C=D.target.replace(/^literal:\/\/string:|^literal:string:/,"");d.adder=JSON.parse(C)}catch{}let P=e.find(C=>C.source===l&&C.predicate==="ad4m://remover");if(P)try{let C=P.target.replace(/^literal:\/\/string:|^literal:string:/,"");d.remover=JSON.parse(C)}catch{}let U=e.find(C=>C.source===l&&C.predicate==="ad4m://getter");U&&(d.getter=U.target.replace(/^literal:\/\/string:|^literal:string:/,""));let ke=e.find(C=>C.source===l&&C.predicate==="ad4m://conformanceConditions");if(ke)try{let C=ke.target.replace(/^literal:\/\/string:|^literal:string:/,"");d.conformanceConditions=JSON.parse(C)}catch{}let Ie=e.find(C=>C.source===l&&C.predicate==="sh://class");Ie&&(d.class=Ie.target),n.addProperty(d)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new di(e.node_shape_uri,e.target_class):new di(e.target_class);for(let i of e.properties||[])t.addProperty({path:i.path,name:i.name,datatype:i.datatype,nodeKind:i.node_kind,minCount:i.min_count,maxCount:i.max_count,minInclusive:i.min_inclusive,maxInclusive:i.max_inclusive,pattern:i.pattern,hasValue:i.has_value,local:i.local,writable:i.writable,resolveLanguage:i.resolve_language,setter:i.setter,adder:i.adder,remover:i.remover,getter:i.getter,conformanceConditions:i.conformance_conditions,class:i.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let i of e.parent_shapes)t.addParentShape(i);return t}};function gh(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function Bm(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${gh(e)} your ${t} actions, with access to ${gh(i)}`}function Nr(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function o0(r){return typeof r=="string"?`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?`[${r.map(e=>o0(e)).join(", ")}]`:String(r)}function s0(r,e,t){let i=Nr(r),n=!t?.resolveLanguage||t.resolveLanguage==="literal";function a(o){return typeof o=="string"?n?`<literal:string:${Nr(o)}>`:`<${Nr(o)}>`:`<literal:string:${o}>`}if(Array.isArray(e)){let o=e.map(a).join(", ");return`FILTER EXISTS { ?target <${i}> ?_val . FILTER(?_val IN (${o})) }`}else if(typeof e=="object"&&e!==null){let o=e,s=[];if(o.not!==void 0)if(Array.isArray(o.not)){let l=o.not.map(u=>a(u)).join(", ");s.push(`FILTER NOT EXISTS { ?target <${i}> ?_nval . FILTER(?_nval IN (${l})) }`)}else s.push(`FILTER NOT EXISTS { ?target <${i}> ${a(o.not)} }`);return(o.gt!==void 0||o.gte!==void 0||o.lt!==void 0||o.lte!==void 0||o.between!==void 0||o.contains!==void 0)&&s.push(`FILTER EXISTS { ?target <${i}> ?_cmp }`),s.join(" ")}else return`?target <${i}> ${a(e)} .`}function Vm(r,e){let t=[];for(let[i,n]of Object.entries(r)){if(["id","author","timestamp"].includes(i))continue;let a,o;if(e){let c=e.properties[i];c?(a=c.predicate,o=c.resolveLanguage):a=i}else a=i;let s=s0(a,n,{resolveLanguage:o});s&&t.push(s)}return t}function c0(r,e,t,i,n){let a=e.prototype,o="ad4m://",s=Object.fromEntries(Object.entries(i).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(t).length>0){let h=t[Object.keys(t)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}else if(Object.keys(s).length>0){let h=s[Object.keys(s)[0]];if(h.predicate){let m=h.predicate.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}let c=`${o}${r}Shape`,l=`${o}${r}`,u=new di(c,l),f=Object.getPrototypeOf(e);if(f&&typeof f.generateSHACL=="function"){let h=f.generateSHACL();h?.shape?.nodeShapeUri&&u.addParentShape(h.shape.nodeShapeUri)}let d=[];a.subjectConstructor&&a.subjectConstructor.length&&(d=d.concat(a.subjectConstructor));let p=[];for(let h in t){let m=t[h];if(!m.through)continue;let g={name:h,path:m.through};if(m.resolveLanguage==="literal")g.datatype="xsd://string";else if(m.initial){let w=typeof a[h];w==="number"?g.datatype="xsd://integer":w==="boolean"?g.datatype="xsd://boolean":w==="string"&&(g.datatype="xsd://string")}m.required&&(g.minCount=1),g.maxCount=1,m.flag&&m.initial&&(g.hasValue=m.initial),m.local!==void 0&&(g.local=m.local),m.writable!==void 0&&(g.writable=m.writable),m.resolveLanguage&&(g.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${r}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):m.writable&&m.through&&typeof a[Bc(h)]=="function"&&(g.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let _=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal:string:":void 0);_&&(d.push({action:"addLink",source:"this",predicate:m.through,target:_}),p.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),u.addProperty(g)}for(let h in s){let m=s[h];if(!m.predicate)continue;let g={name:h,path:m.predicate};if(g.nodeKind="IRI",m.local!==void 0&&(g.local=m.local),g.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],g.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],m.getter)g.getter=m.getter;else if(m.where)try{let _=m.target?.(),w=_?_.getModelMetadata?.()??null:null,y=Vm(m.where,w);if(y.length>0){let b=Nr(m.predicate);g.getter=`SELECT ?target WHERE { <Base> <${b}> ?target . ${y.join(" ")} }`}}catch{}else if(m.target&&m.filter!==!1){let _=m.target,w=m.predicate,y=!1,b,A,T=()=>{if(!y){y=!0;try{let x=_(),O=n(w,x);O&&(b=O.getter,A=O.conformanceConditions)}catch{}}};Object.defineProperty(g,"getter",{get(){return T(),b},set(x){y=!0,b=x},enumerable:!0,configurable:!0}),Object.defineProperty(g,"conformanceConditions",{get(){return T(),A},set(x){y=!0,A=x},enumerable:!0,configurable:!0})}if(m.target)try{let w=m.target().generateSHACL?.();w?.shape?.nodeShapeUri&&(g.class=w.shape.nodeShapeUri)}catch{}u.addProperty(g)}return u.setConstructorActions(d),u.setDestructorActions(p),{shape:u,name:r}}var vr=new WeakMap,lt=new WeakMap,yh=new WeakMap,vh=new WeakMap,bh=new WeakMap;function ln(r){let e=yh.get(r);if(e)return e;let t={},i=[],n=r;for(;n&&n!==Object;)i.unshift(n),n=Object.getPrototypeOf(n);for(let a of i){let o=vr.get(a);o&&Object.assign(t,o)}return yh.set(r,t),t}function It(r){let e=vh.get(r);if(e)return e;let t={},i=[],n=r;for(;n&&n!==Object;)i.unshift(n),n=Object.getPrototypeOf(n);for(let a of i){let o=lt.get(a);o&&Object.assign(t,o)}return vh.set(r,t),t}function l0(r,e){let t=bh.get(r);if(t)return t;let i=e();return bh.set(r,i),i}function u0(r,e,t){vr.has(r)||vr.set(r,{}),vr.get(r)[e]=t}function p0(r,e,t){lt.has(r)||lt.set(r,{}),lt.get(r)[e]=t}function Qm(r,e){try{let t=ln(e),i=[],n=[],a=0;for(let[s,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(i.push({type:"flag",predicate:c.through,value:c.initial}),n.push(`?target <${Nr(c.through)}> <${Nr(c.initial)}> .`));for(let[s,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(i.push({type:"required",predicate:c.through}),n.push(`?target <${Nr(c.through)}> ?_v${a++} .`));return i.length===0?void 0:{getter:`SELECT ?target WHERE { <Base> <${Nr(r)}> ?target . ${n.join(" ")} }`,conformanceConditions:i}}catch{return}}function Vc(r){return function(e,t){let i=r.readOnly?!1:!!r.through;if(r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' or 'getter' option");let n=e.constructor;if(vr.has(n)||vr.set(n,{}),vr.get(n)[t]={...r,writable:i},i){let a=t;e[`set${vt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function A$(r){return Vc({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function k$(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");let i={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;vr.has(n)||vr.set(n,{}),vr.get(n)[t]=i,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function d0(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){return a0(r.name,e.prototype,ln(e),It(e))},e.generateSHACL=function(){return l0(e,()=>c0(r.name,e,ln(e),It(e),Qm))},Object.defineProperty(e,"type",{configurable:!0})}}function f0(r){let e=r.required??!1;return Vc({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal:string:uninitialized":void 0)})}function I$(r){return f0({...r,readOnly:!0})}function Qc(r,e){let t=typeof r=="function"?{...e||{},target:r}:r;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw getter expression.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function T$(r,e){let t=Qc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=n;t.through&&(i[`add${vt(s)}`]=async function(c,l){return this.addRelationValue(s,c,l)},i[`remove${vt(s)}`]=async function(c,l){return this.removeRelationValue(s,c,l)},i[`set${vt(s)}`]=async function(c,l){return this.setRelationValues(s,c,l)}),Object.defineProperty(i,s,{configurable:!0,writable:!0})}}function C$(r,e){let t=Qc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=n;t.through?(Vc({through:t.through,readOnly:!1,local:t.local})(i,n),i[`add${vt(s)}`]=async function(c){return this.addRelationValue(s,c)},i[`remove${vt(s)}`]=async function(c){return this.removeRelationValue(s,c)},i[`set${vt(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(i,s,{configurable:!0,writable:!0})}}function $$(r,e){let t=Qc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Vc({through:t.through,readOnly:!0,local:t.local})(i,n):Object.defineProperty(i,n,{configurable:!0,writable:!0})}}function O$(r,e){let t=Qc(r,e);return function(i,n){let a=i.constructor;lt.has(a)||lt.set(a,{});let o=lt.get(a);o[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(i,n,{configurable:!0,writable:!0})}}var Dr=new Map,h0=200;function Hm(r,e){return`${r}:${e}`}function m0(r,e){let t=Hm(r,e),i=Dr.get(t);if(!!i){if(Date.now()>i.expiry){Dr.delete(t);return}return i.result}}function g0(r,e,t,i=h0){let n=Date.now();for(let[o,s]of Dr)n>s.expiry&&Dr.delete(o);let a=Hm(r,e);Dr.set(a,{result:t,expiry:n+i})}function ei(r){let e=r+":";for(let[t]of Dr)t.startsWith(e)&&Dr.delete(t)}function R$(){Dr.clear()}function P$(){return Dr.size}var ua=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:xe.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal:string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal:string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let i of this._states){let n=this.stateUri(i.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:xe.from(i.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:xe.from(i.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal:string:${encodeURIComponent(JSON.stringify(i.stateCheck))}`})}for(let i of this._transitions){let n=this.transitionUri(i.fromState,i.toState),a=this.stateUri(i.fromState),o=this.stateUri(i.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:xe.from(i.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:o}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal:string:${encodeURIComponent(JSON.stringify(i.actions))}`})}return e}static fromLinks(e,t){let i="Flow";if(!t.endsWith(i))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-i.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),o=n.slice(0,a+1),s=n.slice(a+1),c=new ua(s,o),l=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(l)if(l.target==="ad4m://any")c.flowable="any";else try{let h=l.target.replace(/^literal:\/\/string:|^literal:string:/,"");c.flowable=JSON.parse(decodeURIComponent(h))}catch{c.flowable="any"}let u=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(u)try{let h=u.target.replace(/^literal:\/\/string:|^literal:string:/,"");c.startAction=JSON.parse(decodeURIComponent(h))}catch{}let f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),d=new Map;for(let h of f){let m=h.target,g=e.find(T=>T.source===m&&T.predicate==="ad4m://stateName"),_=g?xe.fromUrl(g.target).get():"";d.set(m,_);let w=e.find(T=>T.source===m&&T.predicate==="ad4m://stateValue"),y=w?xe.fromUrl(w.target).get():0,b=e.find(T=>T.source===m&&T.predicate==="ad4m://stateCheck"),A={predicate:"",target:""};if(b)try{let T=b.target.replace(/^literal:\/\/string:|^literal:string:/,"");A=JSON.parse(decodeURIComponent(T))}catch{}c.addState({name:_,value:y,stateCheck:A})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,g=e.find(P=>P.source===m&&P.predicate==="ad4m://actionName"),_=g?xe.fromUrl(g.target).get():"",y=e.find(P=>P.source===m&&P.predicate==="ad4m://fromState")?.target||"",b=d.get(y)||"",T=e.find(P=>P.source===m&&P.predicate==="ad4m://toState")?.target||"",x=d.get(T)||"",O=e.find(P=>P.source===m&&P.predicate==="ad4m://transitionActions"),D=[];if(O)try{let P=O.target.replace(/^literal:\/\/string:|^literal:string:/,"");D=JSON.parse(decodeURIComponent(P))}catch{}c.addTransition({actionName:_,fromState:b,toState:x,actions:D})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new ua(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let i of e.states||[])t.addState(i);for(let i of e.transitions||[])t.addTransition(i);return t}},ye=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},R=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},sc,ia,ai,Vi,Yi,oi,si,Qi,eo,cc,Hi,zi,Ht,to,Zu,te,ge,Wi,Gi,Ki,ro,io,Ic=class{constructor(e,t,i){sc.add(this),ia.set(this,void 0),ai.set(this,void 0),Vi.set(this,void 0),Yi.set(this,void 0),oi.set(this,void 0),si.set(this,void 0),Qi.set(this,void 0),eo.set(this,!1),cc.set(this,void 0),Hi.set(this,void 0),zi.set(this,void 0),Ht.set(this,void 0),to.set(this,void 0),ye(this,ia,e,"f"),ye(this,to,t,"f"),ye(this,Vi,i,"f"),ye(this,Yi,new Set,"f"),ye(this,Qi,null,"f"),ye(this,cc,new Promise((n,a)=>{ye(this,Hi,n,"f"),ye(this,zi,a,"f")}),"f")}async subscribe(){R(this,si,"f")&&(R(this,si,"f").call(this),ye(this,si,void 0,"f")),R(this,Ht,"f")&&(clearTimeout(R(this,Ht,"f")),ye(this,Ht,void 0,"f")),R(this,oi,"f")&&(clearTimeout(R(this,oi,"f")),ye(this,oi,void 0,"f"));try{let t;t=await R(this,Vi,"f").subscribeQuery(R(this,ia,"f"),R(this,to,"f")),ye(this,ai,t.subscriptionId,"f"),t.result?(ye(this,Qi,t.result,"f"),R(this,sc,"m",Zu).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ye(this,Ht,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),ye(this,si,R(this,Vi,"f").subscribeToQueryUpdates(R(this,ai,"f"),i=>{R(this,Ht,"f")&&(clearTimeout(R(this,Ht,"f")),ye(this,Ht,void 0,"f")),R(this,Hi,"f")&&(R(this,Hi,"f").call(this,!0),ye(this,Hi,void 0,"f"),ye(this,zi,void 0,"f")),!(i.isInit&&R(this,Qi,"f"))&&(ye(this,Qi,i,"f"),R(this,sc,"m",Zu).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),R(this,zi,"f")&&(R(this,zi,"f").call(this,t),ye(this,Hi,void 0,"f"),ye(this,zi,void 0,"f")),t}let e=async()=>{if(!R(this,eo,"f")){try{await R(this,Vi,"f").keepAliveQuery(R(this,ia,"f"),R(this,ai,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",R(this,to,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}R(this,eo,"f")||ye(this,oi,setTimeout(e,3e4),"f")}};ye(this,oi,setTimeout(e,3e4),"f")}get id(){return R(this,ai,"f")}get initialized(){return R(this,cc,"f")}get result(){return R(this,Qi,"f")}onResult(e){return R(this,Yi,"f").add(e),()=>R(this,Yi,"f").delete(e)}dispose(){ye(this,eo,!0,"f"),clearTimeout(R(this,oi,"f")),R(this,si,"f")&&R(this,si,"f").call(this),R(this,Yi,"f").clear(),R(this,Ht,"f")&&(clearTimeout(R(this,Ht,"f")),ye(this,Ht,void 0,"f")),R(this,ai,"f")&&R(this,Vi,"f").disposeQuerySubscription(R(this,ia,"f"),R(this,ai,"f")).catch(e=>console.error("Error disposing query subscription:",e))}};ia=new WeakMap,ai=new WeakMap,Vi=new WeakMap,Yi=new WeakMap,oi=new WeakMap,si=new WeakMap,Qi=new WeakMap,eo=new WeakMap,cc=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Ht=new WeakMap,to=new WeakMap,sc=new WeakSet,Zu=function r(e){for(let t of R(this,Yi,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Yu=class{constructor(e,t){te.set(this,void 0),ge.set(this,void 0),Wi.set(this,void 0),Gi.set(this,void 0),Ki.set(this,void 0),ro.set(this,void 0),io.set(this,new Set),ye(this,Wi,[],"f"),ye(this,Gi,[],"f"),ye(this,Ki,[],"f"),ye(this,ro,[],"f"),ye(this,te,e,"f"),ye(this,ge,t,"f"),this.uuid=R(this,te,"f").uuid,this.name=R(this,te,"f").name,this.owners=R(this,te,"f").owners,this.sharedUrl=R(this,te,"f").sharedUrl,this.neighbourhood=R(this,te,"f").neighbourhood,this.state=R(this,te,"f").state,R(this,ge,"f").addPerspectiveLinkAddedListener(R(this,te,"f").uuid,R(this,Wi,"f")),R(this,ge,"f").addPerspectiveLinkRemovedListener(R(this,te,"f").uuid,R(this,Gi,"f")),R(this,ge,"f").addPerspectiveLinkUpdatedListener(R(this,te,"f").uuid,R(this,Ki,"f")),R(this,ge,"f").addPerspectiveSyncStateChangeListener(R(this,te,"f").uuid,R(this,ro,"f"))}updateHandle(e){if(e.uuid!==R(this,te,"f").uuid)throw new Error(`PerspectiveProxy.updateHandle: UUID mismatch \u2014 proxy is bound to "${R(this,te,"f").uuid}" but received handle with UUID "${e.uuid}". This would silently diverge from listeners registered under the original UUID.`);ye(this,te,e,"f"),this.uuid=e.uuid,this.name=e.name,this.owners=e.owners,this.sharedUrl=e.sharedUrl,this.neighbourhood=e.neighbourhood,this.state=e.state}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,i,n){let a=await R(this,ge,"f").executeCommands(R(this,te,"f").uuid,JSON.stringify(e),t,JSON.stringify(i),n);return ei(R(this,te,"f").uuid),a}async get(e){return await R(this,ge,"f").queryLinks(R(this,te,"f").uuid,e)}async infer(e){return await R(this,ge,"f").queryProlog(R(this,te,"f").uuid,e)}async querySparql(e){let t=m0(R(this,te,"f").uuid,e);if(t!==void 0)return t;let i=await R(this,ge,"f").querySparql(R(this,te,"f").uuid,e);return g0(R(this,te,"f").uuid,e,i),i}async add(e,t="shared",i){let n=await R(this,ge,"f").addLink(R(this,te,"f").uuid,e,t,i);return ei(R(this,te,"f").uuid),n}async addLinks(e,t="shared",i){let n=await R(this,ge,"f").addLinks(R(this,te,"f").uuid,e,t,i);return ei(R(this,te,"f").uuid),n}async removeLinks(e,t){let i=await R(this,ge,"f").removeLinks(R(this,te,"f").uuid,e,t);return ei(R(this,te,"f").uuid),i}async linkMutations(e,t="shared"){let i=await R(this,ge,"f").linkMutations(R(this,te,"f").uuid,e,t);return ei(R(this,te,"f").uuid),i}async addLinkExpression(e,t="shared",i){return await R(this,ge,"f").addLinkExpression(R(this,te,"f").uuid,e,t,i)}async update(e,t,i){let n=await R(this,ge,"f").updateLink(R(this,te,"f").uuid,e,t,i);return ei(R(this,te,"f").uuid),n}async remove(e,t){let i=await R(this,ge,"f").removeLink(R(this,te,"f").uuid,e,t);return ei(R(this,te,"f").uuid),i}async createBatch(){return await R(this,ge,"f").createBatch(R(this,te,"f").uuid)}async commitBatch(e){let t=await R(this,ge,"f").commitBatch(R(this,te,"f").uuid,e);return ei(R(this,te,"f").uuid),t}async getExpression(e){return await R(this,ge,"f").getExpression(e)}async createExpression(e,t){return await R(this,ge,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?R(this,Wi,"f").push(t):e==="link-removed"?R(this,Gi,"f").push(t):e==="link-updated"&&R(this,Ki,"f").push(t)}async addSyncStateChangeListener(e){R(this,ro,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let i=R(this,Wi,"f").indexOf(t);R(this,Wi,"f").splice(i,1)}else if(e==="link-removed"){let i=R(this,Gi,"f").indexOf(t);R(this,Gi,"f").splice(i,1)}else if(e==="link-updated"){let i=R(this,Ki,"f").indexOf(t);R(this,Ki,"f").splice(i,1)}}async snapshot(){return R(this,ge,"f").snapshotByUUID(R(this,te,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(i=>{delete i.data.__typename});for(let i of t.links)await this.addLinkExpression(i)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let i=new J({source:e.source,predicate:e.predicate}),n=await this.get(i),a=[];for(let s of n)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,a.push(s);let o=[e];await this.linkMutations({additions:o,removals:a},t)}async sdnaFlows(){return(await this.get(new J({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return xe.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),i=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")i.push(n);else{let o=a.flowable,s=o.source||e;(await this.get(new J({source:s,predicate:o.predicate,target:o.target}))).length>0&&i.push(n)}}return i}async startFlow(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;if(i.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(i.startAction,t,void 0)}async expressionsInFlowState(e,t){let i=await this.getFlow(e);if(!i)return[];let n=i.states.find(s=>s.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new J({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;for(let n of i.states){let a=n.stateCheck,o=a.source||t;if((await this.get(new J({source:o,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let i=await this.getFlow(e);if(!i)return[];let n=null;for(let a of i.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new J({source:s,predicate:o.predicate,target:o.target}))).length>0){n=a.name;break}}return n?i.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,i){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(o=>o.actionName===i);if(!a)throw`Action "${i}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let i of e){let n=await this.get(new J({source:"ad4m://self",predicate:i}));for(let a of n){let o=a.data.target,s=await this.get(new J({source:o,predicate:"ad4m://sdna"}));for(let c of s){let l=xe.fromUrl(c.data.target).get();typeof l=="string"&&t.push(l)}}}return t}async getSdnaForClass(e){let t=xe.from(e);if((await this.get(new J({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new J({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=xe.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,i,n){return R(this,ge,"f").addSdna(R(this,te,"f").uuid,e,t,i,n)}async addSubjectClass(e,t){return this.addSdna(e,"","subject_class",t)}async addShacl(e,t){let i=t.toLinks(),n=xe.fromUrl(`literal:string:shacl://${e}`),a=[...i.map(o=>new Tt({source:o.source,predicate:o.predicate,target:o.target})),new Tt({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Tt({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=xe.fromUrl(`literal:string:shacl://${e}`),i=await this.get(new J({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(i.length===0)return null;let n=i[0].data.target,a=await this.get(new J({source:n,predicate:"sh://property"})),o=[n,...a.map(l=>l.data.target)],s=[];for(let l of o){let u=await this.get(new J({source:l}));for(let f of u)s.push({source:f.data.source,predicate:f.data.predicate,target:f.data.target})}let c=s;return di.fromLinks(c,n)}async getAllShacl(){let e=await this.get(new J({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let i of e){let n=i.data.target,o=xe.fromUrl(n).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let i=t.toLinks(),n=xe.from(e).toUrl(),a=[...i.map(o=>new Tt({source:o.source,predicate:o.predicate,target:o.target})),new Tt({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Tt({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=xe.from(e).toUrl(),i=await this.get(new J({source:t,predicate:"ad4m://flow_uri"}));if(i.length===0)return null;let n=i[0].data.target,a=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=`SELECT ?s ?p ?o WHERE {
|
|
107
107
|
?s ?p ?o .
|
|
108
108
|
FILTER(?s = <${n}> || STRSTARTS(STR(?s), "${a}"))
|
|
109
|
-
}`,c=(await this.querySparql(o)||[]).map(l=>({source:l.s,predicate:l.p,target:l.o}));return ca.fromLinks(c,n)}async subjectClasses(){try{let t=(await this.get(new K({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(i=>{let a=i.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(i=>i.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,i,n){let a;if(typeof e=="string")a=e,await O(this,me,"f").createSubject(O(this,ie,"f").uuid,JSON.stringify({className:a,initialValues:i}),t,i?JSON.stringify(i):void 0,n);else{let o=e,s=o.className||o.constructor?.className||o.constructor?.prototype?.className||await this.findClassByProperties(o);if(!s)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await O(this,me,"f").createSubject(O(this,ie,"f").uuid,JSON.stringify({className:s,initialValues:i}),t,i?JSON.stringify(i):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await O(this,me,"f").getSubjectData(O(this,ie,"f").uuid,JSON.stringify({className:e}),t));let i=e,n=i.className||i.constructor?.className||i.constructor?.prototype?.className||await this.findClassByProperties(i);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await O(this,me,"f").getSubjectData(O(this,ie,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let i=this.escapeRegExp(e),n=new RegExp(`[/:#]${i}Shape$`),a=await this.get(new K({predicate:t}));for(let o of a)if(n.test(o.data.source)){let s="literal:string:";if(o.data.target.startsWith(s)){let c=o.data.target.slice(s.length),l=c;try{l=decodeURIComponent(c)}catch{}try{return JSON.parse(l)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,i){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,i)}async isSubjectInstance(e,t){let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(i);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${i}`),!1;if(n.requiredTriples.length===0)return(await this.get(new K({source:e}))).length>0;for(let a of n.requiredTriples){let o;a.target?o=new K({source:e,predicate:a.predicate,target:a.target}):o=new K({source:e,predicate:a.predicate});let s=await this.get(o);if(!s||s.length===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=new _o(this,e,i);return await n.init(),n}async getSubjectClassMetadata(e){return this.getSubjectClassMetadataFromSDNA(e)}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let i=[],n=[],a=new Map,o=new Map,s=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&s.add(c.path),c.adder&&c.adder.length>0?o.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){i.push(c.predicate);let l=s.has(c.predicate);c.target&&c.target!=="value"&&!l?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:i,requiredTriples:n,properties:a,relations:o}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}async findInstancesByMetadata(e){if(e.requiredTriples.length===0){let o=await this.get(new K({})),s=new Set(o.map(c=>c.data.source));return Array.from(s).map(c=>({base:c}))}let t=e.requiredTriples[0],i;t.target?i=new K({predicate:t.predicate,target:t.target}):i=new K({predicate:t.predicate});let n=await this.get(i),a=[...new Set(n.map(o=>o.data.source))];for(let o=1;o<e.requiredTriples.length;o++){let s=e.requiredTriples[o],c=[];for(let l of a){let u;s.target?u=new K({source:l,predicate:s.predicate,target:s.target}):u=new K({source:l,predicate:s.predicate}),(await this.get(u)).length>0&&c.push(l)}a=c}return a.map(o=>({base:o}))}async getPropertyValueViaSparql(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(i);if(!a)return;let o=await this.get(new K({source:e,predicate:a.predicate}));if(!o||o.length===0)return;let s=o[0].data.target;if(a.resolveLanguage&&s)try{let c=await this.getExpression(s);try{return JSON.parse(c.data)}catch{return c.data}}catch{return s}return s}async getRelationValuesViaSparql(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(i);if(!a)return[];let o=await this.get(new K({source:e,predicate:a.predicate}));if(!o||o.length===0)return[];o.sort((c,l)=>new Date(c.timestamp).getTime()-new Date(l.timestamp).getTime());let s=o.map(c=>c.data.target).filter(c=>c!==""&&c!=="");if(a.condition&&s.length>0)try{let c=[];for(let l of s){let u=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${l.replace(/'/g,"\\'")}'`),d=u.match(/in\.uri\s*=\s*'([^']+)'/),f=u.match(/predicate\s*=\s*'([^']+)'/),p=u.match(/out\.uri\s*=\s*'([^']+)'/);if(d||f||p){let h={};d&&(h.source=d[1]),f&&(h.predicate=f[1]),p&&(h.target=p[1]),(await this.get(new K(h))).length>0&&c.push(l)}else c.push(l)}s=c}catch(c){console.warn(`Failed to apply condition filter for ${i}:`,c)}if(a.instanceFilter)try{let c=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return c?await this.batchCheckSubjectInstances(s,c):this.filterInstancesSequential(s,a.instanceFilter)}catch{return this.filterInstancesSequential(s,a.instanceFilter)}return s}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let a=[];for(let o of e)(await this.get(new K({source:o}))).length>0&&a.push(o);return a}let i=[];for(let a of t.requiredTriples){let o=new Set;for(let s of e){let c;a.target?c=new K({source:s,predicate:a.predicate,target:a.target}):c=new K({source:s,predicate:a.predicate}),(await this.get(c)).length>0&&o.add(s)}i.push(o)}return i.length===0?e:e.filter(a=>i.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let i=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&i.push(n)}catch{continue}return i}async getAllSubjectInstances(e){let t=[],i=typeof e=="function";typeof e=="string"?t=[e]:i?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let o=await this.getSubjectClassMetadataFromSDNA(a);if(o){let s=await this.findInstancesByMetadata(o);for(let c of s||[])try{let l;i?(l=new e(this,c.base),await l.get()):(l=new _o(this,c.base,a),await l.init()),n.push(l)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let i=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let o=await this.findInstancesByMetadata(a);for(let s of o||[])try{let c=new _o(this,s.base,n);await c.init(),i.push(c)}catch{}}}return i}async findClassByProperties(e){let t=[],i=[],a=Object.getPrototypeOf(e)?.constructor,o=a?sn(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(p=>!Array.isArray(e[p]));let s=a?Object.fromEntries(Object.entries(hr(a)).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany")):{};if(Object.keys(s).length>0?i=Object.keys(s).filter(p=>p!=="isSubjectInstance"):i=Object.keys(e).filter(p=>Array.isArray(e[p])&&p!=="isSubjectInstance"),t.length===0&&i.length===0)return null;let c=await this.get(new K({predicate:"rdf://type",target:"ad4m://SubjectClass"})),l=await this.get(new K({predicate:"sh://property"})),u=await this.get(new K({predicate:"sh://collection"})),d=[...c.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target})),...l.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target})),...u.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target}))];if(d.length===0)return null;let f=new Map;for(let p of d)if(p.predicate==="rdf://type"&&p.target==="ad4m://SubjectClass"){let h=p.shape_source,m=h.indexOf("://");if(m<0)continue;let y=h.substring(m+3).split("/").pop();if(!y)continue;f.set(y,{shapeUri:h,properties:[],relations:[]})}for(let p of d)if(p.predicate==="sh://property"||p.predicate==="sh://collection"){for(let[h,m]of f)if(p.shape_source.endsWith(`${h}Shape`)){let y=p.target.lastIndexOf(".");if(y<0)continue;let b=p.target.substring(y+1);p.predicate==="sh://property"?m.properties.push(b):m.relations.push(b)}}for(let[p,h]of f){let m=t.every(b=>h.properties.includes(b)),y=i.every(b=>h.relations.includes(b));if(m&&y)return p}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){return this.ensureSubjectClass(e)}async ensureSubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(O(this,eo,"f").has(t))return;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:i}=e.generateSHACL(),n=JSON.stringify(i.toJSON());await this.addSdna(t,"","subject_class",n),O(this,eo,"f").add(t)}clearEnsuredSubjectClasses(){O(this,eo,"f").clear()}getNeighbourhoodProxy(){return O(this,me,"f").getNeighbourhoodProxy(O(this,ie,"f").uuid)}get ai(){return O(this,me,"f").aiClient}async subscribeInfer(e){let t=new Ac(this.uuid,e,O(this,me,"f"));return await t.subscribe(),await t.initialized,t}async subscribeQuery(e){let t=new Ac(this.uuid,e,O(this,me,"f"));return await t.subscribe(),await t.initialized,t}};ie=new WeakMap,me=new WeakMap,Hi=new WeakMap,zi=new WeakMap,Wi=new WeakMap,Xa=new WeakMap,eo=new WeakMap;var ei=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},X=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ce,to,ro,io,cc,no,lc,uc,ft=`
|
|
109
|
+
}`,c=(await this.querySparql(o)||[]).map(l=>({source:l.s,predicate:l.p,target:l.o}));return ua.fromLinks(c,n)}async subjectClasses(){try{let t=(await this.get(new J({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(i=>{let a=i.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(i=>i.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,i,n){let a;if(typeof e=="string")a=e,await R(this,ge,"f").createSubject(R(this,te,"f").uuid,JSON.stringify({className:a,initialValues:i}),t,i?JSON.stringify(i):void 0,n);else{let o=e,s=o.className||o.constructor?.className||o.constructor?.prototype?.className||await this.findClassByProperties(o);if(!s)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await R(this,ge,"f").createSubject(R(this,te,"f").uuid,JSON.stringify({className:s,initialValues:i}),t,i?JSON.stringify(i):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await R(this,ge,"f").getSubjectData(R(this,te,"f").uuid,JSON.stringify({className:e}),t));let i=e,n=i.className||i.constructor?.className||i.constructor?.prototype?.className||await this.findClassByProperties(i);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await R(this,ge,"f").getSubjectData(R(this,te,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let i=this.escapeRegExp(e),n=new RegExp(`[/:#]${i}Shape$`),a=await this.get(new J({predicate:t}));for(let o of a)if(n.test(o.data.source)){let s="literal:string:";if(o.data.target.startsWith(s)){let c=o.data.target.slice(s.length),l=c;try{l=decodeURIComponent(c)}catch{}try{return JSON.parse(l)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,i){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,i)}async isSubjectInstance(e,t){let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(i);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${i}`),!1;if(n.requiredTriples.length===0)return(await this.get(new J({source:e}))).length>0;for(let a of n.requiredTriples){let o;a.target?o=new J({source:e,predicate:a.predicate,target:a.target}):o=new J({source:e,predicate:a.predicate});let s=await this.get(o);if(!s||s.length===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=new Eo(this,e,i);return await n.init(),n}async getSubjectClassMetadata(e){return this.getSubjectClassMetadataFromSDNA(e)}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let i=[],n=[],a=new Map,o=new Map,s=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&s.add(c.path),c.adder&&c.adder.length>0?o.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){i.push(c.predicate);let l=s.has(c.predicate);c.target&&c.target!=="value"&&!l?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:i,requiredTriples:n,properties:a,relations:o}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}async findInstancesByMetadata(e){if(e.requiredTriples.length===0){let o=await this.get(new J({})),s=new Set(o.map(c=>c.data.source));return Array.from(s).map(c=>({base:c}))}let t=e.requiredTriples[0],i;t.target?i=new J({predicate:t.predicate,target:t.target}):i=new J({predicate:t.predicate});let n=await this.get(i),a=[...new Set(n.map(o=>o.data.source))];for(let o=1;o<e.requiredTriples.length;o++){let s=e.requiredTriples[o],c=[];for(let l of a){let u;s.target?u=new J({source:l,predicate:s.predicate,target:s.target}):u=new J({source:l,predicate:s.predicate}),(await this.get(u)).length>0&&c.push(l)}a=c}return a.map(o=>({base:o}))}async getPropertyValueViaSparql(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(i);if(!a)return;let o=await this.get(new J({source:e,predicate:a.predicate}));if(!o||o.length===0)return;let s=o[0].data.target;if(a.resolveLanguage&&s)try{let c=await this.getExpression(s);try{return JSON.parse(c.data)}catch{return c.data}}catch{return s}return s}async getRelationValuesViaSparql(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(i);if(!a)return[];let o=await this.get(new J({source:e,predicate:a.predicate}));if(!o||o.length===0)return[];o.sort((c,l)=>new Date(c.timestamp).getTime()-new Date(l.timestamp).getTime());let s=o.map(c=>c.data.target).filter(c=>c!==""&&c!=="");if(a.condition&&s.length>0)try{let c=[];for(let l of s){let u=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${l.replace(/'/g,"\\'")}'`),f=u.match(/in\.uri\s*=\s*'([^']+)'/),d=u.match(/predicate\s*=\s*'([^']+)'/),p=u.match(/out\.uri\s*=\s*'([^']+)'/);if(f||d||p){let h={};f&&(h.source=f[1]),d&&(h.predicate=d[1]),p&&(h.target=p[1]),(await this.get(new J(h))).length>0&&c.push(l)}else c.push(l)}s=c}catch(c){console.warn(`Failed to apply condition filter for ${i}:`,c)}if(a.instanceFilter)try{let c=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return c?await this.batchCheckSubjectInstances(s,c):this.filterInstancesSequential(s,a.instanceFilter)}catch{return this.filterInstancesSequential(s,a.instanceFilter)}return s}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let a=[];for(let o of e)(await this.get(new J({source:o}))).length>0&&a.push(o);return a}let i=[];for(let a of t.requiredTriples){let o=new Set;for(let s of e){let c;a.target?c=new J({source:s,predicate:a.predicate,target:a.target}):c=new J({source:s,predicate:a.predicate}),(await this.get(c)).length>0&&o.add(s)}i.push(o)}return i.length===0?e:e.filter(a=>i.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let i=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&i.push(n)}catch{continue}return i}async getAllSubjectInstances(e){let t=[],i=typeof e=="function";typeof e=="string"?t=[e]:i?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let o=await this.getSubjectClassMetadataFromSDNA(a);if(o){let s=await this.findInstancesByMetadata(o);for(let c of s||[])try{let l;i?(l=new e(this,c.base),await l.get()):(l=new Eo(this,c.base,a),await l.init()),n.push(l)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let i=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let o=await this.findInstancesByMetadata(a);for(let s of o||[])try{let c=new Eo(this,s.base,n);await c.init(),i.push(c)}catch{}}}return i}async findClassByProperties(e){let t=[],i=[],a=Object.getPrototypeOf(e)?.constructor,o=a?ln(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(p=>!Array.isArray(e[p]));let s=a?Object.fromEntries(Object.entries(It(a)).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany")):{};if(Object.keys(s).length>0?i=Object.keys(s).filter(p=>p!=="isSubjectInstance"):i=Object.keys(e).filter(p=>Array.isArray(e[p])&&p!=="isSubjectInstance"),t.length===0&&i.length===0)return null;let c=await this.get(new J({predicate:"rdf://type",target:"ad4m://SubjectClass"})),l=await this.get(new J({predicate:"sh://property"})),u=await this.get(new J({predicate:"sh://collection"})),f=[...c.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target})),...l.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target})),...u.map(p=>({shape_source:p.data.source,predicate:p.data.predicate,target:p.data.target}))];if(f.length===0)return null;let d=new Map;for(let p of f)if(p.predicate==="rdf://type"&&p.target==="ad4m://SubjectClass"){let h=p.shape_source,m=h.indexOf("://");if(m<0)continue;let g=h.substring(m+3).split("/").pop();if(!g)continue;d.set(g,{shapeUri:h,properties:[],relations:[]})}for(let p of f)if(p.predicate==="sh://property"||p.predicate==="sh://collection"){for(let[h,m]of d)if(p.shape_source.endsWith(`${h}Shape`)){let g=p.target.lastIndexOf(".");if(g<0)continue;let _=p.target.substring(g+1);p.predicate==="sh://property"?m.properties.push(_):m.relations.push(_)}}for(let[p,h]of d){let m=t.every(_=>h.properties.includes(_)),g=i.every(_=>h.relations.includes(_));if(m&&g)return p}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){return this.ensureSubjectClass(e)}async ensureSubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(R(this,io,"f").has(t))return;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:i}=e.generateSHACL(),n=JSON.stringify(i.toJSON());await this.addSdna(t,"","subject_class",n),R(this,io,"f").add(t)}clearEnsuredSubjectClasses(){R(this,io,"f").clear()}getNeighbourhoodProxy(){return R(this,ge,"f").getNeighbourhoodProxy(R(this,te,"f").uuid)}get ai(){return R(this,ge,"f").aiClient}async subscribeInfer(e){let t=new Ic(this.uuid,e,R(this,ge,"f"));return await t.subscribe(),await t.initialized,t}async subscribeQuery(e){let t=new Ic(this.uuid,e,R(this,ge,"f"));return await t.subscribe(),await t.initialized,t}};te=new WeakMap,ge=new WeakMap,Wi=new WeakMap,Gi=new WeakMap,Ki=new WeakMap,ro=new WeakMap,io=new WeakMap;var ti=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},K=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ue,no,ao,oo,lc,so,uc,pc,Or,ft=`
|
|
110
110
|
author
|
|
111
111
|
timestamp
|
|
112
112
|
status
|
|
113
113
|
data { source, predicate, target }
|
|
114
114
|
proof { valid, invalid, signature, key }
|
|
115
|
-
`,
|
|
115
|
+
`,Jn=`
|
|
116
116
|
uuid
|
|
117
117
|
name
|
|
118
118
|
sharedUrl
|
|
@@ -133,64 +133,64 @@ neighbourhood {
|
|
|
133
133
|
}
|
|
134
134
|
author
|
|
135
135
|
}
|
|
136
|
-
`,
|
|
136
|
+
`,Tc=class{constructor(e,t=!0){ue.set(this,void 0),no.set(this,void 0),ao.set(this,void 0),oo.set(this,void 0),lc.set(this,void 0),so.set(this,void 0),uc.set(this,void 0),pc.set(this,void 0),Or.set(this,new Map),ti(this,ue,e,"f"),ti(this,no,[],"f"),ti(this,ao,[],"f"),ti(this,oo,[],"f"),ti(this,lc,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}getOrCreateProxy(e){let t=K(this,Or,"f").get(e.uuid);if(t)return t.updateHandle(e),t;let i=new Yu(e,this);return K(this,Or,"f").set(e.uuid,i),i}setExpressionClient(e){ti(this,so,e,"f")}setNeighbourhoodClient(e){ti(this,uc,e,"f")}setAIClient(e){ti(this,pc,e,"f")}get aiClient(){return K(this,pc,"f")}async all(){let{perspectives:e}=I(await K(this,ue,"f").query({query:E`query perspectives {
|
|
137
137
|
perspectives {
|
|
138
|
-
${
|
|
138
|
+
${Jn}
|
|
139
139
|
}
|
|
140
|
-
}`}));return e.map(t=>
|
|
140
|
+
}`}));return e.map(t=>this.getOrCreateProxy(t))}async byUUID(e){let t=K(this,Or,"f").get(e);if(t)return t;let{perspective:i}=I(await K(this,ue,"f").query({query:E`query perspective($uuid: String!) {
|
|
141
141
|
perspective(uuid: $uuid) {
|
|
142
|
-
${
|
|
142
|
+
${Jn}
|
|
143
143
|
}
|
|
144
|
-
}`,variables:{uuid:e}}));return
|
|
144
|
+
}`,variables:{uuid:e}}));return i?this.getOrCreateProxy(i):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=I(await K(this,ue,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
|
|
145
145
|
perspectiveSnapshot(uuid: $uuid) {
|
|
146
146
|
links { ${ft} }
|
|
147
147
|
}
|
|
148
|
-
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=
|
|
148
|
+
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
149
149
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
150
|
-
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=
|
|
150
|
+
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=I(await K(this,ue,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
151
151
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
152
152
|
${ft}
|
|
153
153
|
}
|
|
154
|
-
}`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=
|
|
154
|
+
}`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=I(await K(this,ue,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
155
155
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
156
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async querySparql(e,t){let{perspectiveQuerySparql:i}=
|
|
156
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async querySparql(e,t){let{perspectiveQuerySparql:i}=I(await K(this,ue,"f").query({query:E`query perspectiveQuerySparql($uuid: String!, $query: String!) {
|
|
157
157
|
perspectiveQuerySparql(uuid: $uuid, query: $query)
|
|
158
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:i}=
|
|
158
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:i}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
159
159
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
160
160
|
subscriptionId
|
|
161
161
|
result
|
|
162
162
|
}
|
|
163
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,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:n,result:o,isInit:s}}subscribeToQueryUpdates(e,t){let i=
|
|
163
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,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:n,result:o,isInit:s}}subscribeToQueryUpdates(e,t){let i=K(this,ue,"f").subscribe({query:E`
|
|
164
164
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
165
165
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
166
166
|
}
|
|
167
|
-
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:i}=
|
|
167
|
+
`,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:i}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
168
168
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
169
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return i}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:i}=
|
|
169
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:i}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
170
170
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
171
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return i}async add(e){let{perspectiveAdd:t}=
|
|
171
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return i}async add(e){let{perspectiveAdd:t}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
|
|
172
172
|
perspectiveAdd(name: $name) {
|
|
173
|
-
${
|
|
173
|
+
${Jn}
|
|
174
174
|
}
|
|
175
|
-
}`,variables:{name:e}}));return
|
|
175
|
+
}`,variables:{name:e}}));return this.getOrCreateProxy(t)}async update(e,t){let{perspectiveUpdate:i}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
176
176
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
177
|
-
${
|
|
177
|
+
${Jn}
|
|
178
178
|
}
|
|
179
|
-
}`,variables:{uuid:e,name:t}}));return
|
|
179
|
+
}`,variables:{uuid:e,name:t}}));return K(this,Or,"f").delete(e),this.getOrCreateProxy(i)}async remove(e){return K(this,Or,"f").delete(e),I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
|
|
180
180
|
perspectiveRemove(uuid: $uuid)
|
|
181
|
-
}`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=
|
|
181
|
+
}`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
182
182
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
183
183
|
${ft}
|
|
184
184
|
}
|
|
185
|
-
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=
|
|
185
|
+
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
186
186
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
187
187
|
${ft}
|
|
188
188
|
}
|
|
189
|
-
}`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=
|
|
189
|
+
}`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
190
190
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
191
191
|
${ft}
|
|
192
192
|
}
|
|
193
|
-
}`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=
|
|
193
|
+
}`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
194
194
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
195
195
|
additions {
|
|
196
196
|
${ft}
|
|
@@ -199,43 +199,43 @@ neighbourhood {
|
|
|
199
199
|
${ft}
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
-
}`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=
|
|
202
|
+
}`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
203
203
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
204
204
|
${ft}
|
|
205
205
|
}
|
|
206
|
-
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=
|
|
206
|
+
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
207
207
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
208
208
|
${ft}
|
|
209
209
|
}
|
|
210
|
-
}`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=
|
|
210
|
+
}`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
211
211
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
212
|
-
}`,variables:{uuid:e,link:t,batchId:i}}));return n}async addSdna(e,t,i,n,a){return
|
|
212
|
+
}`,variables:{uuid:e,link:t,batchId:i}}));return n}async addSdna(e,t,i,n,a){return I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
213
213
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
214
|
-
}`,variables:{uuid:e,name:t,sdnaCode:i||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,i,n,a){return
|
|
214
|
+
}`,variables:{uuid:e,name:t,sdnaCode:i||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,i,n,a){return I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
215
215
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
216
|
-
}`,variables:{uuid:e,commands:t,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,i,n,a){return
|
|
216
|
+
}`,variables:{uuid:e,commands:t,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,i,n,a){return I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
217
217
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
218
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,i){return
|
|
218
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,i){return I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
219
219
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
220
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await
|
|
221
|
-
perspectiveAdded { ${
|
|
220
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await K(this,so,"f").get(e)}async createExpression(e,t){return await K(this,so,"f").create(e,t)}addPerspectiveAddedListener(e){K(this,no,"f").push(e)}subscribePerspectiveAdded(){K(this,ue,"f").subscribe({query:E` subscription {
|
|
221
|
+
perspectiveAdded { ${Jn} }
|
|
222
222
|
}
|
|
223
|
-
`}).subscribe({next:e=>{
|
|
224
|
-
perspectiveUpdated { ${
|
|
223
|
+
`}).subscribe({next:e=>{let t=e.data.perspectiveAdded;K(this,no,"f").forEach(i=>{i(t)}),this.getOrCreateProxy(t)},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){K(this,ao,"f").push(e)}subscribePerspectiveUpdated(){K(this,ue,"f").subscribe({query:E` subscription {
|
|
224
|
+
perspectiveUpdated { ${Jn} }
|
|
225
225
|
}
|
|
226
|
-
`}).subscribe({next:e=>{
|
|
226
|
+
`}).subscribe({next:e=>{let t=e.data.perspectiveUpdated;K(this,ao,"f").forEach(i=>{i(t)}),K(this,Or,"f").delete(t.uuid),this.getOrCreateProxy(t)},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){K(this,lc,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){K(this,ue,"f").subscribe({query:E` subscription {
|
|
227
227
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
228
228
|
}
|
|
229
|
-
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){
|
|
229
|
+
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){K(this,oo,"f").push(e)}subscribePerspectiveRemoved(){K(this,ue,"f").subscribe({query:E` subscription {
|
|
230
230
|
perspectiveRemoved
|
|
231
231
|
}
|
|
232
|
-
`}).subscribe({next:e=>{
|
|
232
|
+
`}).subscribe({next:e=>{let t=e.data.perspectiveRemoved;K(this,oo,"f").forEach(i=>{i(t)}),K(this,Or,"f").delete(t)},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){K(this,ue,"f").subscribe({query:E` subscription {
|
|
233
233
|
perspectiveLinkAdded(uuid: "${e}") { ${ft} }
|
|
234
234
|
}
|
|
235
|
-
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){
|
|
235
|
+
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){K(this,ue,"f").subscribe({query:E` subscription {
|
|
236
236
|
perspectiveLinkRemoved(uuid: "${e}") { ${ft} }
|
|
237
237
|
}
|
|
238
|
-
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){
|
|
238
|
+
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){K(this,ue,"f").subscribe({query:E` subscription {
|
|
239
239
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
240
240
|
oldLink {
|
|
241
241
|
${ft}
|
|
@@ -245,9 +245,9 @@ neighbourhood {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkUpdated.newLink.status||delete i.data.perspectiveLinkUpdated.newLink.status,i.data.perspectiveLinkUpdated.oldLink.status||delete i.data.perspectiveLinkUpdated.oldLink.status,n(i.data.perspectiveLinkUpdated)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}getNeighbourhoodProxy(e){return new
|
|
248
|
+
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkUpdated.newLink.status||delete i.data.perspectiveLinkUpdated.newLink.status,i.data.perspectiveLinkUpdated.oldLink.status||delete i.data.perspectiveLinkUpdated.oldLink.status,n(i.data.perspectiveLinkUpdated)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}getNeighbourhoodProxy(e){return new Ju(K(this,uc,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
|
|
249
249
|
perspectiveCreateBatch(uuid: $uuid)
|
|
250
|
-
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=
|
|
250
|
+
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=I(await K(this,ue,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
251
251
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
252
252
|
additions {
|
|
253
253
|
${ft}
|
|
@@ -256,7 +256,7 @@ neighbourhood {
|
|
|
256
256
|
${ft}
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
}`,variables:{uuid:e,batchId:t}}));return i}};
|
|
259
|
+
}`,variables:{uuid:e,batchId:t}}));return i}};ue=new WeakMap,no=new WeakMap,ao=new WeakMap,oo=new WeakMap,lc=new WeakMap,so=new WeakMap,uc=new WeakMap,pc=new WeakMap,Or=new WeakMap;var Zn=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ee=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ae,co,lo,uo,po,fo,Ka=`
|
|
260
260
|
did
|
|
261
261
|
directMessageLanguage
|
|
262
262
|
perspective {
|
|
@@ -270,7 +270,7 @@ neighbourhood {
|
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
`,
|
|
273
|
+
`,Hs=`
|
|
274
274
|
requestId
|
|
275
275
|
revoked
|
|
276
276
|
auth {
|
|
@@ -286,96 +286,96 @@ neighbourhood {
|
|
|
286
286
|
can
|
|
287
287
|
}
|
|
288
288
|
}
|
|
289
|
-
`,
|
|
289
|
+
`,Yn=`
|
|
290
290
|
isInitialized
|
|
291
291
|
isUnlocked
|
|
292
292
|
did
|
|
293
293
|
didDocument
|
|
294
294
|
error
|
|
295
|
-
`,
|
|
295
|
+
`,zs=`
|
|
296
296
|
did
|
|
297
297
|
didSigningKeyId
|
|
298
298
|
deviceKeyType
|
|
299
299
|
deviceKey
|
|
300
300
|
deviceKeySignedByDid
|
|
301
301
|
didSignedByDeviceKey
|
|
302
|
-
`,
|
|
302
|
+
`,y0=`
|
|
303
303
|
signature
|
|
304
304
|
publicKey
|
|
305
|
-
`,
|
|
305
|
+
`,Ro=class{constructor(e,t=!0){ae.set(this,void 0),co.set(this,void 0),lo.set(this,void 0),uo.set(this,void 0),po.set(this,void 0),fo.set(this,void 0),Zn(this,ae,e,"f"),Zn(this,lo,[],"f"),Zn(this,uo,[],"f"),Zn(this,co,[],"f"),Zn(this,po,[],"f"),Zn(this,fo,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=I(await ee(this,ae,"f").query({query:E`query agent { agent { ${Ka} } }`})),t=new pi(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=I(await ee(this,ae,"f").query({query:E`query agentStatus {
|
|
306
306
|
agentStatus {
|
|
307
|
-
${
|
|
307
|
+
${Yn}
|
|
308
308
|
}
|
|
309
|
-
}`}));return new
|
|
309
|
+
}`}));return new Wt(e)}async generate(e){let{agentGenerate:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentGenerate(
|
|
310
310
|
$passphrase: String!
|
|
311
311
|
) {
|
|
312
312
|
agentGenerate(passphrase: $passphrase) {
|
|
313
|
-
${
|
|
313
|
+
${Yn}
|
|
314
314
|
}
|
|
315
|
-
}`,variables:{passphrase:e}}));return new
|
|
315
|
+
}`,variables:{passphrase:e}}));return new Wt(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentImport(
|
|
316
316
|
$did: String!,
|
|
317
317
|
$didDocument: String!,
|
|
318
318
|
$keystore: String!,
|
|
319
319
|
$passphrase: String!
|
|
320
320
|
) {
|
|
321
321
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
322
|
-
${
|
|
322
|
+
${Yn}
|
|
323
323
|
}
|
|
324
|
-
}`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new
|
|
324
|
+
}`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Wt(o)}async lock(e){let{agentLock:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
|
|
325
325
|
agentLock(passphrase: $passphrase) {
|
|
326
|
-
${
|
|
326
|
+
${Yn}
|
|
327
327
|
}
|
|
328
|
-
}`,variables:{passphrase:e}}));return new
|
|
328
|
+
}`,variables:{passphrase:e}}));return new Wt(t)}async unlock(e,t=!0){let{agentUnlock:i}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
329
329
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
330
|
-
${
|
|
330
|
+
${Yn}
|
|
331
331
|
}
|
|
332
|
-
}`,variables:{passphrase:e,holochain:t}}));return new
|
|
332
|
+
}`,variables:{passphrase:e,holochain:t}}));return new Wt(i)}async byDID(e){let{agentByDID:t}=I(await ee(this,ae,"f").query({query:E`query agentByDID($did: String!) {
|
|
333
333
|
agentByDID(did: $did) {
|
|
334
|
-
${
|
|
334
|
+
${Ka}
|
|
335
335
|
}
|
|
336
|
-
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=
|
|
336
|
+
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
337
337
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
338
|
-
${
|
|
338
|
+
${Ka}
|
|
339
339
|
}
|
|
340
|
-
}`,variables:{perspective:t}})),n=i,a=new
|
|
340
|
+
}`,variables:{perspective:t}})),n=i,a=new pi(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Tc(ee(this,ae,"f")),i=new Ro(ee(this,ae,"f")),n=await t.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let c of e.additions)await n.add(c);for(let c of e.removals)await n.remove(c);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
341
341
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
342
|
-
${
|
|
342
|
+
${Ka}
|
|
343
343
|
}
|
|
344
|
-
}`,variables:{directMessageLanguage:e}})),i=t,n=new
|
|
344
|
+
}`,variables:{directMessageLanguage:e}})),i=t,n=new pi(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
345
345
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
346
|
-
${
|
|
346
|
+
${zs}
|
|
347
347
|
}
|
|
348
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=
|
|
348
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
349
349
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
350
|
-
${
|
|
350
|
+
${zs}
|
|
351
351
|
}
|
|
352
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=
|
|
352
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=I(await ee(this,ae,"f").query({query:E`query agentGetEntanglementProofs {
|
|
353
353
|
agentGetEntanglementProofs {
|
|
354
|
-
${
|
|
354
|
+
${zs}
|
|
355
355
|
}
|
|
356
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=
|
|
356
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
357
357
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
358
|
-
${
|
|
358
|
+
${zs}
|
|
359
359
|
}
|
|
360
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){
|
|
361
|
-
agentUpdated { ${
|
|
360
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){ee(this,lo,"f").push(e)}addAppChangedListener(e){ee(this,co,"f").push(e)}subscribeAgentUpdated(){ee(this,ae,"f").subscribe({query:E` subscription {
|
|
361
|
+
agentUpdated { ${Ka} }
|
|
362
362
|
}
|
|
363
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;
|
|
363
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;ee(this,lo,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){ee(this,ae,"f").subscribe({query:E` subscription {
|
|
364
364
|
agentAppsChanged {
|
|
365
|
-
${
|
|
365
|
+
${Hs}
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
`}).subscribe({next:e=>{
|
|
369
|
-
agentStatusChanged { ${
|
|
368
|
+
`}).subscribe({next:e=>{ee(this,co,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ee(this,uo,"f").push(e)}subscribeAgentStatusChanged(){ee(this,ae,"f").subscribe({query:E` subscription {
|
|
369
|
+
agentStatusChanged { ${Yn} }
|
|
370
370
|
}
|
|
371
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;
|
|
371
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;ee(this,uo,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}addHostingUserInfoChangedListener(e){ee(this,po,"f").push(e)}subscribeHostingUserInfoChanged(){ee(this,ae,"f").subscribe({query:E`subscription {
|
|
372
372
|
runtimeHostingUserInfoChanged {
|
|
373
373
|
email
|
|
374
374
|
remainingCredits
|
|
375
375
|
hotWalletAddress
|
|
376
376
|
freeAccess
|
|
377
377
|
}
|
|
378
|
-
}`}).subscribe({next:e=>{let t=e.data.runtimeHostingUserInfoChanged;
|
|
378
|
+
}`}).subscribe({next:e=>{let t=e.data.runtimeHostingUserInfoChanged;ee(this,po,"f").forEach(i=>i(t))},error:e=>console.error(e)})}addComputeLogUpdatedListener(e){ee(this,fo,"f").push(e)}subscribeComputeLogUpdated(){ee(this,ae,"f").subscribe({query:E`subscription {
|
|
379
379
|
runtimeComputeLogUpdated {
|
|
380
380
|
id
|
|
381
381
|
userEmail
|
|
@@ -385,63 +385,63 @@ neighbourhood {
|
|
|
385
385
|
cost
|
|
386
386
|
creditsAfter
|
|
387
387
|
}
|
|
388
|
-
}`}).subscribe({next:e=>{let t=e.data.runtimeComputeLogUpdated;
|
|
388
|
+
}`}).subscribe({next:e=>{let t=e.data.runtimeComputeLogUpdated;ee(this,fo,"f").forEach(i=>i(t))},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=I(await ee(this,ae,"f").mutate({mutation:E`
|
|
389
389
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
390
390
|
agentRequestCapability(authInfo: $authInfo)
|
|
391
391
|
}
|
|
392
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=
|
|
392
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=I(await ee(this,ae,"f").mutate({mutation:E`
|
|
393
393
|
mutation agentPermitCapability($auth: String!) {
|
|
394
394
|
agentPermitCapability(auth: $auth)
|
|
395
395
|
}
|
|
396
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=
|
|
396
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=I(await ee(this,ae,"f").mutate({mutation:E`
|
|
397
397
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
398
398
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
399
399
|
}
|
|
400
|
-
`,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=
|
|
400
|
+
`,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=I(await ee(this,ae,"f").mutate({mutation:E`query agentGetApps {
|
|
401
401
|
agentGetApps {
|
|
402
|
-
${
|
|
402
|
+
${Hs}
|
|
403
403
|
}
|
|
404
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=
|
|
404
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
|
|
405
405
|
agentRemoveApp(requestId: $requestId) {
|
|
406
|
-
${
|
|
406
|
+
${Hs}
|
|
407
407
|
}
|
|
408
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=
|
|
408
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
|
|
409
409
|
agentRevokeToken(requestId: $requestId) {
|
|
410
|
-
${
|
|
410
|
+
${Hs}
|
|
411
411
|
}
|
|
412
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=
|
|
412
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=I(await ee(this,ae,"f").mutate({mutation:E`
|
|
413
413
|
query agentIsLocked {
|
|
414
414
|
agentIsLocked
|
|
415
415
|
}
|
|
416
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=
|
|
416
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
|
|
417
417
|
agentSignMessage(message: $message) {
|
|
418
|
-
${
|
|
418
|
+
${y0}
|
|
419
419
|
}
|
|
420
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=
|
|
420
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
421
421
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
422
422
|
did
|
|
423
423
|
success
|
|
424
424
|
error
|
|
425
425
|
}
|
|
426
|
-
}`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=
|
|
426
|
+
}`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
427
427
|
runtimeLoginUser(email: $email, password: $password)
|
|
428
|
-
}`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=
|
|
428
|
+
}`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
429
429
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
430
430
|
success
|
|
431
431
|
message
|
|
432
432
|
requiresPassword
|
|
433
433
|
isExistingUser
|
|
434
434
|
}
|
|
435
|
-
}`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=
|
|
435
|
+
}`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
436
436
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
437
|
-
}`,variables:{email:e,code:t,verificationType:i}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=
|
|
437
|
+
}`,variables:{email:e,code:t,verificationType:i}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=I(await ee(this,ae,"f").query({query:E`query runtimeHostingUserInfo {
|
|
438
438
|
runtimeHostingUserInfo {
|
|
439
439
|
email
|
|
440
440
|
remainingCredits
|
|
441
441
|
hotWalletAddress
|
|
442
442
|
freeAccess
|
|
443
443
|
}
|
|
444
|
-
}`}));return e}async computeLog(e,t,i){let{runtimeComputeLog:n}=
|
|
444
|
+
}`}));return e}async computeLog(e,t,i){let{runtimeComputeLog:n}=I(await ee(this,ae,"f").query({query:E`query runtimeComputeLog($since: String, $limit: Int, $userEmail: String) {
|
|
445
445
|
runtimeComputeLog(since: $since, limit: $limit, userEmail: $userEmail) {
|
|
446
446
|
id
|
|
447
447
|
userEmail
|
|
@@ -451,21 +451,21 @@ neighbourhood {
|
|
|
451
451
|
cost
|
|
452
452
|
creditsAfter
|
|
453
453
|
}
|
|
454
|
-
}`,variables:{since:e,limit:t,userEmail:i},fetchPolicy:"network-only"}));return n}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=
|
|
454
|
+
}`,variables:{since:e,limit:t,userEmail:i},fetchPolicy:"network-only"}));return n}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeSetHotWalletAddress($address: String!) {
|
|
455
455
|
runtimeSetHotWalletAddress(address: $address)
|
|
456
|
-
}`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=
|
|
456
|
+
}`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=I(await ee(this,ae,"f").mutate({mutation:E`mutation runtimeRequestPayment($amountHOT: String!) {
|
|
457
457
|
runtimeRequestPayment(amountHOT: $amountHOT) {
|
|
458
458
|
success
|
|
459
459
|
message
|
|
460
460
|
}
|
|
461
|
-
}`,variables:{amountHOT:e}}));return t}};
|
|
461
|
+
}`,variables:{amountHOT:e}}));return t}};ae=new WeakMap,co=new WeakMap,lo=new WeakMap,uo=new WeakMap,po=new WeakMap,fo=new WeakMap;var v0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ri=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ar,wh=`
|
|
462
462
|
name
|
|
463
463
|
address
|
|
464
464
|
settings
|
|
465
465
|
icon { code }
|
|
466
466
|
constructorIcon { code }
|
|
467
467
|
settingsIcon { code }
|
|
468
|
-
`,
|
|
468
|
+
`,Sh=`
|
|
469
469
|
name
|
|
470
470
|
address
|
|
471
471
|
description
|
|
@@ -475,45 +475,45 @@ neighbourhood {
|
|
|
475
475
|
templateAppliedParams
|
|
476
476
|
possibleTemplateParams
|
|
477
477
|
sourceCodeLink
|
|
478
|
-
`,
|
|
478
|
+
`,Xu=class{constructor(e){ar.set(this,void 0),v0(this,ar,e,"f")}async byAddress(e){let{language:t}=I(await ri(this,ar,"f").query({query:E`query byAddress($address: String!) {
|
|
479
479
|
language(address: $address) {
|
|
480
|
-
${
|
|
480
|
+
${wh}
|
|
481
481
|
}
|
|
482
|
-
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=
|
|
482
|
+
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=I(await ri(this,ar,"f").query({query:E`query byFilter($filter: String!) {
|
|
483
483
|
languages(filter: $filter) {
|
|
484
|
-
${
|
|
484
|
+
${wh}
|
|
485
485
|
}
|
|
486
|
-
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=
|
|
486
|
+
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=I(await ri(this,ar,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
487
487
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
488
|
-
}`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=
|
|
488
|
+
}`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=I(await ri(this,ar,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
|
|
489
489
|
$sourceLanguageHash: String!,
|
|
490
490
|
$templateData: String!,
|
|
491
491
|
) {
|
|
492
492
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
493
493
|
name, address
|
|
494
494
|
}
|
|
495
|
-
}`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=
|
|
495
|
+
}`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=I(await ri(this,ar,"f").mutate({mutation:E`mutation languagePublish(
|
|
496
496
|
$languagePath: String!,
|
|
497
497
|
$languageMeta: LanguageMetaInput!,
|
|
498
498
|
) {
|
|
499
499
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
500
|
-
${
|
|
500
|
+
${Sh}
|
|
501
501
|
}
|
|
502
|
-
}`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=
|
|
502
|
+
}`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=I(await ri(this,ar,"f").query({query:E`query languageMeta(
|
|
503
503
|
$address: String!,
|
|
504
504
|
) {
|
|
505
505
|
languageMeta(address: $address) {
|
|
506
|
-
${
|
|
506
|
+
${Sh}
|
|
507
507
|
}
|
|
508
|
-
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=
|
|
508
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=I(await ri(this,ar,"f").query({query:E`query languageSource(
|
|
509
509
|
$address: String!,
|
|
510
510
|
) {
|
|
511
511
|
languageSource(address: $address)
|
|
512
|
-
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=
|
|
512
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=I(await ri(this,ar,"f").mutate({mutation:E`mutation languageRemove(
|
|
513
513
|
$address: String!,
|
|
514
514
|
) {
|
|
515
515
|
languageRemove(address: $address)
|
|
516
|
-
}`,variables:{address:e}}));return t}};
|
|
516
|
+
}`,variables:{address:e}}));return t}};ar=new WeakMap;var b0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ct=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},gt,na,ep=class{constructor(e){gt.set(this,void 0),na.set(this,new Map),b0(this,gt,e,"f")}async publishFromPerspective(e,t,i){let{neighbourhoodPublishFromPerspective:n}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
|
|
517
517
|
$linkLanguage: String!,
|
|
518
518
|
$meta: PerspectiveInput!,
|
|
519
519
|
$perspectiveUUID: String!
|
|
@@ -523,7 +523,7 @@ neighbourhood {
|
|
|
523
523
|
meta: $meta,
|
|
524
524
|
perspectiveUUID: $perspectiveUUID
|
|
525
525
|
)
|
|
526
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=
|
|
526
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
527
527
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
528
528
|
uuid
|
|
529
529
|
name
|
|
@@ -545,11 +545,11 @@ neighbourhood {
|
|
|
545
545
|
author
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=
|
|
548
|
+
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=I(await ct(this,gt,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
|
|
549
549
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
550
|
-
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=
|
|
550
|
+
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=I(await ct(this,gt,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
|
|
551
551
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
552
|
-
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=
|
|
552
|
+
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=I(await ct(this,gt,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
|
|
553
553
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
554
554
|
did
|
|
555
555
|
status {
|
|
@@ -566,7 +566,7 @@ neighbourhood {
|
|
|
566
566
|
proof { valid, invalid, signature, key }
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=
|
|
569
|
+
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
|
|
570
570
|
$perspectiveUUID: String!,
|
|
571
571
|
$status: PerspectiveInput!
|
|
572
572
|
) {
|
|
@@ -574,7 +574,7 @@ neighbourhood {
|
|
|
574
574
|
perspectiveUUID: $perspectiveUUID,
|
|
575
575
|
status: $status
|
|
576
576
|
)
|
|
577
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=
|
|
577
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
|
|
578
578
|
$perspectiveUUID: String!,
|
|
579
579
|
$status: PerspectiveUnsignedInput!
|
|
580
580
|
) {
|
|
@@ -582,7 +582,7 @@ neighbourhood {
|
|
|
582
582
|
perspectiveUUID: $perspectiveUUID,
|
|
583
583
|
status: $status
|
|
584
584
|
)
|
|
585
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=
|
|
585
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
|
|
586
586
|
$perspectiveUUID: String!,
|
|
587
587
|
$remoteAgentDid: String!,
|
|
588
588
|
$payload: PerspectiveInput!
|
|
@@ -592,7 +592,7 @@ neighbourhood {
|
|
|
592
592
|
remoteAgentDid: $remoteAgentDid,
|
|
593
593
|
payload: $payload
|
|
594
594
|
)
|
|
595
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=
|
|
595
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
|
|
596
596
|
$perspectiveUUID: String!,
|
|
597
597
|
$remoteAgentDid: String!,
|
|
598
598
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -602,7 +602,7 @@ neighbourhood {
|
|
|
602
602
|
remoteAgentDid: $remoteAgentDid,
|
|
603
603
|
payload: $payload
|
|
604
604
|
)
|
|
605
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=
|
|
605
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
|
|
606
606
|
$perspectiveUUID: String!,
|
|
607
607
|
$payload: PerspectiveInput!,
|
|
608
608
|
$loopback: Boolean
|
|
@@ -612,7 +612,7 @@ neighbourhood {
|
|
|
612
612
|
payload: $payload,
|
|
613
613
|
loopback: $loopback
|
|
614
614
|
)
|
|
615
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=
|
|
615
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=I(await ct(this,gt,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
|
|
616
616
|
$perspectiveUUID: String!,
|
|
617
617
|
$payload: PerspectiveUnsignedInput!,
|
|
618
618
|
$loopback: Boolean
|
|
@@ -622,7 +622,7 @@ neighbourhood {
|
|
|
622
622
|
payload: $payload,
|
|
623
623
|
loopback: $loopback
|
|
624
624
|
)
|
|
625
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=ct(this,
|
|
625
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=ct(this,na,"f").get(e);if(i)for(let n of i)try{n(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;ct(this,gt,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
626
626
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
627
627
|
author
|
|
628
628
|
timestamp
|
|
@@ -637,7 +637,7 @@ neighbourhood {
|
|
|
637
637
|
}
|
|
638
638
|
proof { valid, invalid, signature, key }
|
|
639
639
|
}
|
|
640
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{try{let{neighbourhoodSignal:n}=
|
|
640
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{try{let{neighbourhoodSignal:n}=I(i);t.dispatchSignal(e,n)}catch(n){console.error("Error in signal subscription:",n)}},error:i=>{console.error("Signal subscription error for perspective",e,i)}})}async addSignalHandler(e,t){let i=ct(this,na,"f").get(e);i?i.push(t):(i=[],ct(this,na,"f").set(e,i),i.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let i=ct(this,na,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};gt=new WeakMap,na=new WeakMap;var Ws=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},B=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},V,ho,mo,go,zm,Gs=`
|
|
641
641
|
author
|
|
642
642
|
timestamp
|
|
643
643
|
data {
|
|
@@ -649,7 +649,7 @@ data {
|
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
proof { valid, invalid, signature, key }
|
|
652
|
-
`,
|
|
652
|
+
`,w0=`
|
|
653
653
|
description
|
|
654
654
|
appName
|
|
655
655
|
appUrl
|
|
@@ -658,74 +658,74 @@ trigger
|
|
|
658
658
|
perspectiveIds
|
|
659
659
|
webhookUrl
|
|
660
660
|
webhookAuth
|
|
661
|
-
`,
|
|
661
|
+
`,Wm=`
|
|
662
662
|
id
|
|
663
663
|
granted
|
|
664
|
-
${
|
|
665
|
-
`,
|
|
666
|
-
notification { ${
|
|
664
|
+
${w0}
|
|
665
|
+
`,S0=`
|
|
666
|
+
notification { ${Wm} }
|
|
667
667
|
perspectiveId
|
|
668
668
|
triggerMatch
|
|
669
|
-
`,
|
|
669
|
+
`,tp=class{constructor(e,t=!0){V.set(this,void 0),ho.set(this,void 0),mo.set(this,void 0),go.set(this,void 0),zm.set(this,void 0),Ws(this,V,e,"f"),Ws(this,ho,[],"f"),Ws(this,mo,[],"f"),Ws(this,go,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=I(await B(this,V,"f").query({query:E`query runtimeInfo {
|
|
670
670
|
runtimeInfo {
|
|
671
671
|
ad4mExecutorVersion,
|
|
672
672
|
isInitialized,
|
|
673
673
|
isUnlocked
|
|
674
674
|
}
|
|
675
|
-
}`}));return e}async tlsDomain(){let{runtimeTlsDomain:e}=
|
|
675
|
+
}`}));return e}async tlsDomain(){let{runtimeTlsDomain:e}=I(await B(this,V,"f").query({query:E`query runtimeTlsDomain {
|
|
676
676
|
runtimeTlsDomain
|
|
677
|
-
}`}));return e}async quit(){return
|
|
677
|
+
}`}));return e}async quit(){return I(await B(this,V,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
|
|
678
678
|
runtimeOpenLink(url: $url)
|
|
679
|
-
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=
|
|
679
|
+
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=I(await B(this,V,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
|
|
680
680
|
addTrustedAgents(agents: $agents)
|
|
681
|
-
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=
|
|
681
|
+
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=I(await B(this,V,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
682
682
|
deleteTrustedAgents(agents: $agents)
|
|
683
|
-
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=
|
|
683
|
+
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=I(await B(this,V,"f").query({query:E`query getTrustedAgents {
|
|
684
684
|
getTrustedAgents
|
|
685
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=
|
|
685
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
686
686
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
687
|
-
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=
|
|
687
|
+
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
688
688
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
689
|
-
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=
|
|
689
|
+
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=I(await B(this,V,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
|
|
690
690
|
runtimeKnownLinkLanguageTemplates
|
|
691
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=
|
|
691
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
|
|
692
692
|
runtimeAddFriends(dids: $dids)
|
|
693
|
-
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=
|
|
693
|
+
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
694
694
|
runtimeRemoveFriends(dids: $dids)
|
|
695
|
-
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=
|
|
695
|
+
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=I(await B(this,V,"f").query({query:E`query runtimeFriends {
|
|
696
696
|
runtimeFriends
|
|
697
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=
|
|
697
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=I(await B(this,V,"f").query({query:E`query runtimeHcAgentInfos {
|
|
698
698
|
runtimeHcAgentInfos
|
|
699
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=
|
|
699
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=I(await B(this,V,"f").query({query:E`query runtimeGetNetworkMetrics {
|
|
700
700
|
runtimeGetNetworkMetrics
|
|
701
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=
|
|
701
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
|
|
702
702
|
runtimeRestartHolochain
|
|
703
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=
|
|
703
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
704
704
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
705
|
-
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i,n){let{runtimeVerifyStringSignedByDid:a}=
|
|
705
|
+
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i,n){let{runtimeVerifyStringSignedByDid:a}=I(await B(this,V,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
706
706
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
707
|
-
}`,variables:{did:e,didSigningKeyId:t,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=
|
|
707
|
+
}`,variables:{did:e,didSigningKeyId:t,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
708
708
|
runtimeSetStatus(status: $status)
|
|
709
|
-
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=
|
|
710
|
-
runtimeFriendStatus(did: $did) { ${
|
|
711
|
-
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:i}=
|
|
709
|
+
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=I(await B(this,V,"f").query({query:E`query runtimeFriendStatus($did: String!) {
|
|
710
|
+
runtimeFriendStatus(did: $did) { ${Gs} }
|
|
711
|
+
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
712
712
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
713
|
-
}`,variables:{did:e,message:t}}));return i}async messageInbox(e){let{runtimeMessageInbox:t}=
|
|
714
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
715
|
-
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=
|
|
713
|
+
}`,variables:{did:e,message:t}}));return i}async messageInbox(e){let{runtimeMessageInbox:t}=I(await B(this,V,"f").query({query:E`query runtimeMessageInbox($filter: String) {
|
|
714
|
+
runtimeMessageInbox(filter: $filter) { ${Gs} }
|
|
715
|
+
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=I(await B(this,V,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
|
|
716
716
|
runtimeMessageOutbox(filter: $filter) {
|
|
717
717
|
recipient,
|
|
718
718
|
message {
|
|
719
|
-
${
|
|
719
|
+
${Gs}
|
|
720
720
|
}
|
|
721
721
|
}
|
|
722
|
-
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=
|
|
722
|
+
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
723
723
|
runtimeRequestInstallNotification(notification: $notification)
|
|
724
|
-
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=
|
|
724
|
+
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
|
|
725
725
|
runtimeGrantNotification(id: $id)
|
|
726
|
-
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=
|
|
726
|
+
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
|
|
727
727
|
runtimeExportDb(filePath: $filePath)
|
|
728
|
-
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=
|
|
728
|
+
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
|
|
729
729
|
runtimeImportDb(filePath: $filePath) {
|
|
730
730
|
perspectives { total imported failed omitted errors }
|
|
731
731
|
links { total imported failed omitted errors }
|
|
@@ -739,25 +739,25 @@ triggerMatch
|
|
|
739
739
|
trustedAgents { total imported failed omitted errors }
|
|
740
740
|
knownLinkLanguages { total imported failed omitted errors }
|
|
741
741
|
}
|
|
742
|
-
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=
|
|
743
|
-
runtimeNotifications { ${
|
|
744
|
-
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:i}=
|
|
742
|
+
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=I(await B(this,V,"f").query({query:E`query runtimeNotifications {
|
|
743
|
+
runtimeNotifications { ${Wm} }
|
|
744
|
+
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
745
745
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
746
|
-
}`,variables:{id:e,notification:t}}));return i}async removeNotification(e){let{runtimeRemoveNotification:t}=
|
|
746
|
+
}`,variables:{id:e,notification:t}}));return i}async removeNotification(e){let{runtimeRemoveNotification:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
|
|
747
747
|
runtimeRemoveNotification(id: $id)
|
|
748
|
-
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:i}=
|
|
748
|
+
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
749
749
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
750
|
-
}`,variables:{perspectiveUuid:e,filePath:t}}));return i}async importPerspective(e){let{runtimeImportPerspective:t}=
|
|
750
|
+
}`,variables:{perspectiveUuid:e,filePath:t}}));return i}async importPerspective(e){let{runtimeImportPerspective:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
|
|
751
751
|
runtimeImportPerspective(filePath: $filePath)
|
|
752
|
-
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=
|
|
752
|
+
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=I(await B(this,V,"f").query({query:E`query runtimeMultiUserEnabled {
|
|
753
753
|
runtimeMultiUserEnabled
|
|
754
|
-
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=
|
|
754
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
755
755
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
756
|
-
}`,variables:{enabled:e}}));return t}async freeHostingEnabled(){let{runtimeFreeHostingEnabled:e}=
|
|
756
|
+
}`,variables:{enabled:e}}));return t}async freeHostingEnabled(){let{runtimeFreeHostingEnabled:e}=I(await B(this,V,"f").query({query:E`query runtimeFreeHostingEnabled {
|
|
757
757
|
runtimeFreeHostingEnabled
|
|
758
|
-
}`}));return e}async setFreeHostingEnabled(e){let{runtimeSetFreeHostingEnabled:t}=
|
|
758
|
+
}`}));return e}async setFreeHostingEnabled(e){let{runtimeSetFreeHostingEnabled:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetFreeHostingEnabled($enabled: Boolean!) {
|
|
759
759
|
runtimeSetFreeHostingEnabled(enabled: $enabled)
|
|
760
|
-
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=
|
|
760
|
+
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=I(await B(this,V,"f").query({query:E`query runtimeListUsers {
|
|
761
761
|
runtimeListUsers {
|
|
762
762
|
email
|
|
763
763
|
did
|
|
@@ -767,48 +767,48 @@ triggerMatch
|
|
|
767
767
|
freeAccess
|
|
768
768
|
hotWalletAddress
|
|
769
769
|
}
|
|
770
|
-
}`}));return e}async userWalletAddress(e){let{runtimeUserWalletAddress:t}=
|
|
770
|
+
}`}));return e}async userWalletAddress(e){let{runtimeUserWalletAddress:t}=I(await B(this,V,"f").query({query:E`query runtimeUserWalletAddress($email: String!) {
|
|
771
771
|
runtimeUserWalletAddress(email: $email)
|
|
772
|
-
}`,variables:{email:e}}));return t}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=
|
|
772
|
+
}`,variables:{email:e}}));return t}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
|
|
773
773
|
runtimeEmailTestModeEnable
|
|
774
|
-
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=
|
|
774
|
+
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
|
|
775
775
|
runtimeEmailTestModeDisable
|
|
776
|
-
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=
|
|
776
|
+
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
|
|
777
777
|
runtimeEmailTestGetCode(email: $email)
|
|
778
|
-
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=
|
|
778
|
+
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
|
|
779
779
|
runtimeEmailTestClearCodes
|
|
780
|
-
}`}));return e}async emailTestSetExpiry(e,t,i){let{runtimeEmailTestSetExpiry:n}=
|
|
780
|
+
}`}));return e}async emailTestSetExpiry(e,t,i){let{runtimeEmailTestSetExpiry:n}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
781
781
|
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
782
|
-
}`,variables:{email:e,verificationType:t,expiresAt:i}}));return n}async unytAgentKey(){let{runtimeUnytAgentKey:e}=
|
|
782
|
+
}`,variables:{email:e,verificationType:t,expiresAt:i}}));return n}async unytAgentKey(){let{runtimeUnytAgentKey:e}=I(await B(this,V,"f").query({query:E`query runtimeUnytAgentKey { runtimeUnytAgentKey }`,fetchPolicy:"network-only"}));return e}async unytHotAgentPubkey(){let{runtimeHotAgentPubkey:e}=I(await B(this,V,"f").query({query:E`query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,fetchPolicy:"network-only"}));return e}async unytWalletBalance(){let{runtimeHotWalletBalance:e}=I(await B(this,V,"f").query({query:E`query runtimeHotWalletBalance { runtimeHotWalletBalance }`,fetchPolicy:"network-only"}));return e}async unytWalletHistory(e,t){let{runtimeHotWalletHistory:i}=I(await B(this,V,"f").query({query:E`query runtimeHotWalletHistory($page: Int, $perPage: Int) {
|
|
783
783
|
runtimeHotWalletHistory(page: $page, perPage: $perPage)
|
|
784
|
-
}`,variables:{page:e,perPage:t},fetchPolicy:"network-only"}));return i}async unytVersionInfo(){let{runtimeUnytVersionInfo:e}=
|
|
784
|
+
}`,variables:{page:e,perPage:t},fetchPolicy:"network-only"}));return i}async unytVersionInfo(){let{runtimeUnytVersionInfo:e}=I(await B(this,V,"f").query({query:E`query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,fetchPolicy:"network-only"}));return e}async unytSetMembraneProof(e){let{runtimeSetUnytMembraneProof:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetUnytMembraneProof($proof: String!) {
|
|
785
785
|
runtimeSetUnytMembraneProof(proof: $proof) { success message }
|
|
786
|
-
}`,variables:{proof:e}}));return t}async unytReinstallDna(){let{runtimeReinstallUnytDna:e}=
|
|
786
|
+
}`,variables:{proof:e}}));return t}async unytReinstallDna(){let{runtimeReinstallUnytDna:e}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeReinstallUnytDna {
|
|
787
787
|
runtimeReinstallUnytDna { success message }
|
|
788
|
-
}`}));return e}async unytSendHot(e,t){let{runtimeSendHot:i}=
|
|
788
|
+
}`}));return e}async unytSendHot(e,t){let{runtimeSendHot:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSendHot($recipient: String!, $amount: String!) {
|
|
789
789
|
runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
|
|
790
|
-
}`,variables:{recipient:e,amount:t}}));return i}async setUserCredits(e,t){let{runtimeSetUserCredits:i}=
|
|
790
|
+
}`,variables:{recipient:e,amount:t}}));return i}async setUserCredits(e,t){let{runtimeSetUserCredits:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
|
|
791
791
|
runtimeSetUserCredits(email: $email, amount: $amount)
|
|
792
|
-
}`,variables:{email:e,amount:t}}));return i}async setUserFreeAccess(e,t){let{runtimeSetUserFreeAccess:i}=
|
|
792
|
+
}`,variables:{email:e,amount:t}}));return i}async setUserFreeAccess(e,t){let{runtimeSetUserFreeAccess:i}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
|
|
793
793
|
runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
|
|
794
|
-
}`,variables:{email:e,enabled:t}}));return i}async setHostRates(e){let{runtimeSetHostRates:t}=
|
|
794
|
+
}`,variables:{email:e,enabled:t}}));return i}async setHostRates(e){let{runtimeSetHostRates:t}=I(await B(this,V,"f").mutate({mutation:E`mutation runtimeSetHostRates($ratesJson: String!) {
|
|
795
795
|
runtimeSetHostRates(ratesJson: $ratesJson)
|
|
796
|
-
}`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=
|
|
796
|
+
}`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=I(await B(this,V,"f").query({query:E`query runtimeHostRates {
|
|
797
797
|
runtimeHostRates
|
|
798
|
-
}`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){
|
|
799
|
-
runtimeNotificationTriggered { ${
|
|
798
|
+
}`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){B(this,go,"f").push(e)}subscribeNotificationTriggered(){B(this,V,"f").subscribe({query:E` subscription {
|
|
799
|
+
runtimeNotificationTriggered { ${S0} }
|
|
800
800
|
}
|
|
801
|
-
`}).subscribe({next:e=>{
|
|
802
|
-
runtimeMessageReceived { ${
|
|
801
|
+
`}).subscribe({next:e=>{B(this,go,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){B(this,ho,"f").push(e)}subscribeMessageReceived(){B(this,V,"f").subscribe({query:E` subscription {
|
|
802
|
+
runtimeMessageReceived { ${Gs} }
|
|
803
803
|
}
|
|
804
|
-
`}).subscribe({next:e=>{
|
|
804
|
+
`}).subscribe({next:e=>{B(this,ho,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){B(this,mo,"f").push(e)}subscribeExceptionOccurred(){B(this,V,"f").subscribe({query:E` subscription {
|
|
805
805
|
exceptionOccurred {
|
|
806
806
|
title
|
|
807
807
|
message
|
|
808
808
|
type
|
|
809
809
|
addon
|
|
810
810
|
}
|
|
811
|
-
}`}).subscribe({next:e=>{
|
|
811
|
+
}`}).subscribe({next:e=>{B(this,mo,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};V=new WeakMap,ho=new WeakMap,mo=new WeakMap,go=new WeakMap,zm=new WeakMap;var _0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Xn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Rr,rp=class{constructor(e){Rr.set(this,void 0),_0(this,Rr,e,"f")}async get(e,t=!1){if(!t)try{let n=xe.fromUrl(e).get();if(typeof n=="object"&&n!==null&&"author"in n&&"timestamp"in n&&"data"in n&&"proof"in n)return n}catch{}let{expression:i}=I(await Xn(this,Rr,"f").query({query:E`query expression($url: String!) {
|
|
812
812
|
expression(url: $url) {
|
|
813
813
|
author
|
|
814
814
|
timestamp
|
|
@@ -821,7 +821,7 @@ triggerMatch
|
|
|
821
821
|
invalid
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
|
-
}`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:t}=
|
|
824
|
+
}`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:t}=I(await Xn(this,Rr,"f").query({query:E`query expressionMany($urls: [String!]!) {
|
|
825
825
|
expressionMany(urls: $urls) {
|
|
826
826
|
author
|
|
827
827
|
timestamp
|
|
@@ -834,19 +834,19 @@ triggerMatch
|
|
|
834
834
|
invalid
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
|
-
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=
|
|
837
|
+
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=I(await Xn(this,Rr,"f").query({query:E`query expressionRaw($url: String!) {
|
|
838
838
|
expressionRaw(url: $url)
|
|
839
|
-
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:i}=
|
|
839
|
+
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:i}=I(await Xn(this,Rr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
|
|
840
840
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
841
|
-
}`,variables:{content:e,languageAddress:t}}));return i}async interactions(e){let{expressionInteractions:t}=
|
|
841
|
+
}`,variables:{content:e,languageAddress:t}}));return i}async interactions(e){let{expressionInteractions:t}=I(await Xn(this,Rr,"f").query({query:E`query expressionInteractions($url: String!) {
|
|
842
842
|
expressionInteractions(url: $url) {
|
|
843
843
|
label
|
|
844
844
|
name
|
|
845
845
|
parameters { name, type }
|
|
846
846
|
}
|
|
847
|
-
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=
|
|
847
|
+
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=I(await Xn(this,Rr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
848
848
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
849
|
-
}`,variables:{url:e,interactionCall:t}}));return i}};$r=new WeakMap;var Vc={};Vc.byteLength=v0;Vc.toByteArray=w0;Vc.fromByteArray=x0;var mr=[],Ht=[],y0=typeof Uint8Array<"u"?Uint8Array:Array,Eu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ui=0,gh=Eu.length;Ui<gh;++Ui)mr[Ui]=Eu[Ui],Ht[Eu.charCodeAt(Ui)]=Ui;var Ui,gh;Ht["-".charCodeAt(0)]=62;Ht["_".charCodeAt(0)]=63;function Vm(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function v0(r){var e=Vm(r),t=e[0],i=e[1];return(t+i)*3/4-i}function b0(r,e,t){return(e+t)*3/4-t}function w0(r){var e,t=Vm(r),i=t[0],n=t[1],a=new y0(b0(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Ht[r.charCodeAt(c)]<<18|Ht[r.charCodeAt(c+1)]<<12|Ht[r.charCodeAt(c+2)]<<6|Ht[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Ht[r.charCodeAt(c)]<<2|Ht[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Ht[r.charCodeAt(c)]<<10|Ht[r.charCodeAt(c+1)]<<4|Ht[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function S0(r){return mr[r>>18&63]+mr[r>>12&63]+mr[r>>6&63]+mr[r&63]}function _0(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(S0(i));return n.join("")}function x0(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(_0(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(mr[e>>2]+mr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(mr[e>>10]+mr[e>>4&63]+mr[e<<2&63]+"=")),n.join("")}var E0=4,yh=0,vh=1,k0=2;function ya(r){let e=r.length;for(;--e>=0;)r[e]=0}var A0=0,Qm=1,I0=2,T0=3,C0=258,gp=29,Vo=256,$o=Vo+1+gp,na=30,yp=19,Hm=2*$o+1,Zi=15,ku=16,O0=7,vp=256,zm=16,Wm=17,Gm=18,Xu=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]),pc=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]),$0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Km=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),P0=512,Pr=new Array(($o+2)*2);ya(Pr);var xo=new Array(na*2);ya(xo);var Po=new Array(P0);ya(Po);var Ro=new Array(C0-T0+1);ya(Ro);var bp=new Array(gp);ya(bp);var Tc=new Array(na);ya(Tc);function Au(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var Jm,Zm,Ym;function Iu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var Xm=r=>r<256?Po[r]:Po[256+(r>>>7)],Lo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},Tt=(r,e,t)=>{r.bi_valid>ku-t?(r.bi_buf|=e<<r.bi_valid&65535,Lo(r,r.bi_buf),r.bi_buf=e>>ku-r.bi_valid,r.bi_valid+=t-ku):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},gr=(r,e,t)=>{Tt(r,t[e*2],t[e*2+1])},eg=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},R0=r=>{r.bi_valid===16?(Lo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},L0=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=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,l,u,d,f,p,h,m=0;for(f=0;f<=Zi;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;l<Hm;l++)u=r.heap[l],f=t[t[u*2+1]*2+1]+1,f>c&&(f=c,m++),t[u*2+1]=f,!(u>i)&&(r.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),h=t[u*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[u*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(u=r.bl_count[f];u!==0;)d=r.heap[--l],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),u--)}},tg=(r,e,t)=>{let i=new Array(Zi+1),n=0,a,o;for(a=1;a<=Zi;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=eg(i[s]++,s))}},N0=()=>{let r,e,t,i,n,a=new Array(Zi+1);for(t=0,i=0;i<gp-1;i++)for(bp[i]=t,r=0;r<1<<Xu[i];r++)Ro[t++]=i;for(Ro[t-1]=i,n=0,i=0;i<16;i++)for(Tc[i]=n,r=0;r<1<<pc[i];r++)Po[n++]=i;for(n>>=7;i<na;i++)for(Tc[i]=n<<7,r=0;r<1<<pc[i]-7;r++)Po[256+n++]=i;for(e=0;e<=Zi;e++)a[e]=0;for(r=0;r<=143;)Pr[r*2+1]=8,r++,a[8]++;for(;r<=255;)Pr[r*2+1]=9,r++,a[9]++;for(;r<=279;)Pr[r*2+1]=7,r++,a[7]++;for(;r<=287;)Pr[r*2+1]=8,r++,a[8]++;for(tg(Pr,$o+1,a),r=0;r<na;r++)xo[r*2+1]=5,xo[r*2]=eg(r,5);Jm=new Au(Pr,Xu,Vo+1,$o,Zi),Zm=new Au(xo,pc,0,na,Zi),Ym=new Au(new Array(0),$0,0,yp,O0)},rg=r=>{let e;for(e=0;e<$o;e++)r.dyn_ltree[e*2]=0;for(e=0;e<na;e++)r.dyn_dtree[e*2]=0;for(e=0;e<yp;e++)r.bl_tree[e*2]=0;r.dyn_ltree[vp*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},ig=r=>{r.bi_valid>8?Lo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},bh=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},Tu=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&bh(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!bh(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},wh=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?gr(r,n,e):(o=Ro[n],gr(r,o+Vo+1,e),s=Xu[o],s!==0&&(n-=bp[o],Tt(r,n,s)),i--,o=Xm(i),gr(r,o,t),s=pc[o],s!==0&&(i-=Tc[o],Tt(r,i,s)));while(a<r.sym_next);gr(r,vp,e)},ep=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,l;for(r.heap_len=0,r.heap_max=Hm,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=c<2?++c:0,t[l*2]=1,r.depth[l]=0,r.opt_len--,n&&(r.static_len-=i[l*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)Tu(r,t,o);l=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],Tu(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[l*2]=t[o*2]+t[s*2],r.depth[l]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=l,r.heap[1]=l++,Tu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],L0(r,e),tg(t,c,r.bl_count)},Sh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[zm*2]++):s<=10?r.bl_tree[Wm*2]++:r.bl_tree[Gm*2]++,s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},_h=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do gr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(gr(r,a,r.bl_tree),s--),gr(r,zm,r.bl_tree),Tt(r,s-3,2)):s<=10?(gr(r,Wm,r.bl_tree),Tt(r,s-3,3)):(gr(r,Gm,r.bl_tree),Tt(r,s-11,7));s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},D0=r=>{let e;for(Sh(r,r.dyn_ltree,r.l_desc.max_code),Sh(r,r.dyn_dtree,r.d_desc.max_code),ep(r,r.bl_desc),e=yp-1;e>=3&&r.bl_tree[Km[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},F0=(r,e,t,i)=>{let n;for(Tt(r,e-257,5),Tt(r,t-1,5),Tt(r,i-4,4),n=0;n<i;n++)Tt(r,r.bl_tree[Km[n]*2+1],3);_h(r,r.dyn_ltree,e-1),_h(r,r.dyn_dtree,t-1)},M0=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return yh;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return vh;for(t=32;t<Vo;t++)if(r.dyn_ltree[t*2]!==0)return vh;return yh},xh=!1,U0=r=>{xh||(N0(),xh=!0),r.l_desc=new Iu(r.dyn_ltree,Jm),r.d_desc=new Iu(r.dyn_dtree,Zm),r.bl_desc=new Iu(r.bl_tree,Ym),r.bi_buf=0,r.bi_valid=0,rg(r)},ng=(r,e,t,i)=>{Tt(r,(A0<<1)+(i?1:0),3),ig(r),Lo(r,t),Lo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},j0=r=>{Tt(r,Qm<<1,3),gr(r,vp,Pr),R0(r)},q0=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===k0&&(r.strm.data_type=M0(r)),ep(r,r.l_desc),ep(r,r.d_desc),o=D0(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?ng(r,e,t,i):r.strategy===E0||a===n?(Tt(r,(Qm<<1)+(i?1:0),3),wh(r,Pr,xo)):(Tt(r,(I0<<1)+(i?1:0),3),F0(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),wh(r,r.dyn_ltree,r.dyn_dtree)),rg(r),i&&ig(r)},B0=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(Ro[t]+Vo+1)*2]++,r.dyn_dtree[Xm(e)*2]++),r.sym_next===r.sym_end),V0=U0,Q0=ng,H0=q0,z0=B0,W0=j0,G0={_tr_init:V0,_tr_stored_block:Q0,_tr_flush_block:H0,_tr_tally:z0,_tr_align:W0},K0=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},No=K0,J0=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},Z0=new Uint32Array(J0()),Y0=(r,e,t,i)=>{let n=Z0,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ze=Y0,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"},vn={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:X0,_tr_stored_block:tp,_tr_flush_block:ew,_tr_tally:pi,_tr_align:tw}=G0,{Z_NO_FLUSH:di,Z_PARTIAL_FLUSH:rw,Z_FULL_FLUSH:iw,Z_FINISH:Wt,Z_BLOCK:Eh,Z_OK:at,Z_STREAM_END:kh,Z_STREAM_ERROR:br,Z_DATA_ERROR:nw,Z_BUF_ERROR:Cu,Z_DEFAULT_COMPRESSION:aw,Z_FILTERED:ow,Z_HUFFMAN_ONLY:Ws,Z_RLE:sw,Z_FIXED:cw,Z_DEFAULT_STRATEGY:lw,Z_UNKNOWN:uw,Z_DEFLATED:Qc}=vn,pw=9,dw=15,fw=8,hw=29,mw=256,rp=mw+1+hw,gw=30,yw=19,vw=2*rp+1,bw=15,ue=3,si=258,wr=si+ue+1,ww=32,la=42,wp=57,ip=69,np=73,ap=91,op=103,Yi=113,ho=666,yt=1,va=2,ln=3,ba=4,Sw=3,Xi=(r,e)=>(r.msg=cn[e],e),Ah=r=>r*2-(r>4?9:0),oi=r=>{let e=r.length;for(;--e>=0;)r[e]=0},_w=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},xw=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,fi=xw,Lt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Dt=(r,e)=>{ew(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Lt(r.strm)},ye=(r,e)=>{r.pending_buf[r.pending++]=e},Ga=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},sp=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=No(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ze(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},ag=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-wr?r.strstart-(r.w_size-wr):0,l=r.window,u=r.w_mask,d=r.prev,f=r.strstart+si,p=l[i+o-1],h=l[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(l[n+o]!==h||l[n+o-1]!==p||l[n]!==l[i]||l[++n]!==l[i+1])){i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<f);if(a=si-(f-i),i=f-si,a>o){if(r.match_start=e,o=a,a>=s)break;p=l[i+o-1],h=l[i+o]}}while((e=d[e&u])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},ua=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-wr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),_w(r),i+=e),r.strm.avail_in===0)break;if(t=sp(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=ue)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=fi(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=fi(r,r.ins_h,r.window[n+ue-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<ue)););}while(r.lookahead<wr&&r.strm.avail_in!==0)},og=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Wt||e===di||i!==n+r.strm.avail_in)))break;o=e===Wt&&i===n+r.strm.avail_in?1:0,tp(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,Lt(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(sp(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?ba:e!==di&&e!==Wt&&r.strm.avail_in===0&&r.strstart===r.block_start?va:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(sp(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Wt)&&e!==di&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Wt&&r.strm.avail_in===0&&i===n?1:0,tp(r,r.block_start,i,o),r.block_start+=i,Lt(r.strm)),o?ln:yt)},Ou=(r,e)=>{let t,i;for(;;){if(r.lookahead<wr){if(ua(r),r.lookahead<wr&&e===di)return yt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ue&&(r.ins_h=fi(r,r.ins_h,r.window[r.strstart+ue-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-wr&&(r.match_length=ag(r,t)),r.match_length>=ue)if(i=pi(r,r.strstart-r.match_start,r.match_length-ue),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ue){r.match_length--;do r.strstart++,r.ins_h=fi(r,r.ins_h,r.window[r.strstart+ue-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=fi(r,r.ins_h,r.window[r.strstart+1]);else i=pi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Dt(r,!1),r.strm.avail_out===0))return yt}return r.insert=r.strstart<ue-1?r.strstart:ue-1,e===Wt?(Dt(r,!0),r.strm.avail_out===0?ln:ba):r.sym_next&&(Dt(r,!1),r.strm.avail_out===0)?yt:va},Yn=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<wr){if(ua(r),r.lookahead<wr&&e===di)return yt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ue&&(r.ins_h=fi(r,r.ins_h,r.window[r.strstart+ue-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ue-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-wr&&(r.match_length=ag(r,t),r.match_length<=5&&(r.strategy===ow||r.match_length===ue&&r.strstart-r.match_start>4096)&&(r.match_length=ue-1)),r.prev_length>=ue&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-ue,i=pi(r,r.strstart-1-r.prev_match,r.prev_length-ue),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=fi(r,r.ins_h,r.window[r.strstart+ue-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ue-1,r.strstart++,i&&(Dt(r,!1),r.strm.avail_out===0))return yt}else if(r.match_available){if(i=pi(r,0,r.window[r.strstart-1]),i&&Dt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return yt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=pi(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ue-1?r.strstart:ue-1,e===Wt?(Dt(r,!0),r.strm.avail_out===0?ln:ba):r.sym_next&&(Dt(r,!1),r.strm.avail_out===0)?yt:va},Ew=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=si){if(ua(r),r.lookahead<=si&&e===di)return yt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ue&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+si;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=si-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ue?(t=pi(r,1,r.match_length-ue),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=pi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Dt(r,!1),r.strm.avail_out===0))return yt}return r.insert=0,e===Wt?(Dt(r,!0),r.strm.avail_out===0?ln:ba):r.sym_next&&(Dt(r,!1),r.strm.avail_out===0)?yt:va},kw=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(ua(r),r.lookahead===0)){if(e===di)return yt;break}if(r.match_length=0,t=pi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Dt(r,!1),r.strm.avail_out===0))return yt}return r.insert=0,e===Wt?(Dt(r,!0),r.strm.avail_out===0?ln:ba):r.sym_next&&(Dt(r,!1),r.strm.avail_out===0)?yt:va};function dr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var mo=[new dr(0,0,0,0,og),new dr(4,4,8,4,Ou),new dr(4,5,16,8,Ou),new dr(4,6,32,32,Ou),new dr(4,4,16,16,Yn),new dr(8,16,32,32,Yn),new dr(8,16,128,128,Yn),new dr(8,32,128,256,Yn),new dr(32,128,258,1024,Yn),new dr(32,258,258,4096,Yn)],Aw=r=>{r.window_size=2*r.w_size,oi(r.head),r.max_lazy_match=mo[r.level].max_lazy,r.good_match=mo[r.level].good_length,r.nice_match=mo[r.level].nice_length,r.max_chain_length=mo[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ue-1,r.match_available=0,r.ins_h=0};function Iw(){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=Qc,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(vw*2),this.dyn_dtree=new Uint16Array((2*gw+1)*2),this.bl_tree=new Uint16Array((2*yw+1)*2),oi(this.dyn_ltree),oi(this.dyn_dtree),oi(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(bw+1),this.heap=new Uint16Array(2*rp+1),oi(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*rp+1),oi(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 Qo=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==la&&e.status!==wp&&e.status!==ip&&e.status!==np&&e.status!==ap&&e.status!==op&&e.status!==Yi&&e.status!==ho?1:0},sg=r=>{if(Qo(r))return Xi(r,br);r.total_in=r.total_out=0,r.data_type=uw;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?wp:e.wrap?la:Yi,r.adler=e.wrap===2?0:1,e.last_flush=-2,X0(e),at},cg=r=>{let e=sg(r);return e===at&&Aw(r.state),e},Tw=(r,e)=>Qo(r)||r.state.wrap!==2?br:(r.state.gzhead=e,at),lg=(r,e,t,i,n,a)=>{if(!r)return br;let o=1;if(e===aw&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>pw||t!==Qc||i<8||i>15||e<0||e>9||a<0||a>cw||i===8&&o!==1)return Xi(r,br);i===8&&(i=9);let s=new Iw;return r.state=s,s.strm=r,s.status=la,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ue-1)/ue),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<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,cg(r)},Cw=(r,e)=>lg(r,e,Qc,dw,fw,lw),Ow=(r,e)=>{if(Qo(r)||e>Eh||e<0)return r?Xi(r,br):br;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===ho&&e!==Wt)return Xi(r,r.avail_out===0?Cu:br);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Lt(r),r.avail_out===0)return t.last_flush=-1,at}else if(r.avail_in===0&&Ah(e)<=Ah(i)&&e!==Wt)return Xi(r,Cu);if(t.status===ho&&r.avail_in!==0)return Xi(r,Cu);if(t.status===la&&t.wrap===0&&(t.status=Yi),t.status===la){let n=Qc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Ws||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=ww),n+=31-n%31,Ga(t,n),t.strstart!==0&&(Ga(t,r.adler>>>16),Ga(t,r.adler&65535)),r.adler=1,t.status=Yi,Lt(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===wp){if(r.adler=0,ye(t,31),ye(t,139),ye(t,8),t.gzhead)ye(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),ye(t,t.gzhead.time&255),ye(t,t.gzhead.time>>8&255),ye(t,t.gzhead.time>>16&255),ye(t,t.gzhead.time>>24&255),ye(t,t.level===9?2:t.strategy>=Ws||t.level<2?4:0),ye(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ye(t,t.gzhead.extra.length&255),ye(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ze(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=ip;else if(ye(t,0),ye(t,0),ye(t,0),ye(t,0),ye(t,0),ye(t,t.level===9?2:t.strategy>=Ws||t.level<2?4:0),ye(t,Sw),t.status=Yi,Lt(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===ip){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,Lt(r),t.pending!==0)return t.last_flush=-1,at;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=np}if(t.status===np){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),Lt(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ye(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ap}if(t.status===ap){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),Lt(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ye(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n))}t.status=op}if(t.status===op){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Lt(r),t.pending!==0))return t.last_flush=-1,at;ye(t,r.adler&255),ye(t,r.adler>>8&255),r.adler=0}if(t.status=Yi,Lt(r),t.pending!==0)return t.last_flush=-1,at}if(r.avail_in!==0||t.lookahead!==0||e!==di&&t.status!==ho){let n=t.level===0?og(t,e):t.strategy===Ws?kw(t,e):t.strategy===sw?Ew(t,e):mo[t.level].func(t,e);if((n===ln||n===ba)&&(t.status=ho),n===yt||n===ln)return r.avail_out===0&&(t.last_flush=-1),at;if(n===va&&(e===rw?tw(t):e!==Eh&&(tp(t,0,0,!1),e===iw&&(oi(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Lt(r),r.avail_out===0))return t.last_flush=-1,at}return e!==Wt?at:t.wrap<=0?kh:(t.wrap===2?(ye(t,r.adler&255),ye(t,r.adler>>8&255),ye(t,r.adler>>16&255),ye(t,r.adler>>24&255),ye(t,r.total_in&255),ye(t,r.total_in>>8&255),ye(t,r.total_in>>16&255),ye(t,r.total_in>>24&255)):(Ga(t,r.adler>>>16),Ga(t,r.adler&65535)),Lt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?at:kh)},$w=r=>{if(Qo(r))return br;let e=r.state.status;return r.state=null,e===Yi?Xi(r,nw):at},Pw=(r,e)=>{let t=e.length;if(Qo(r))return br;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==la||i.lookahead)return br;if(n===1&&(r.adler=No(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(oi(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,ua(i);i.lookahead>=ue;){let c=i.strstart,l=i.lookahead-(ue-1);do i.ins_h=fi(i,i.ins_h,i.window[c+ue-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--l);i.strstart=c,i.lookahead=ue-1,ua(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ue-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,at},Rw=Cw,Lw=lg,Nw=cg,Dw=sg,Fw=Tw,Mw=Ow,Uw=$w,jw=Pw,qw="pako deflate (from Nodeca project)",Eo={deflateInit:Rw,deflateInit2:Lw,deflateReset:Nw,deflateResetKeep:Dw,deflateSetHeader:Fw,deflate:Mw,deflateEnd:Uw,deflateSetDictionary:jw,deflateInfo:qw},Bw=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),Vw=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Bw(t,i)&&(r[i]=t[i])}}return r},Qw=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Hc={assign:Vw,flattenChunks:Qw},ug=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){ug=!1}var Do=new Uint8Array(256);for(let r=0;r<256;r++)Do[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Do[254]=Do[254]=1;var Hw=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},zw=(r,e)=>{if(e<65534&&r.subarray&&ug)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},Ww=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=Do[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return zw(a,n)},Gw=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+Do[r[t]]>e?t:e},Fo={string2buf:Hw,buf2string:Ww,utf8border:Gw};function Kw(){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 pg=Kw,dg=Object.prototype.toString,{Z_NO_FLUSH:Jw,Z_SYNC_FLUSH:Zw,Z_FULL_FLUSH:Yw,Z_FINISH:Xw,Z_OK:Cc,Z_STREAM_END:eS,Z_DEFAULT_COMPRESSION:tS,Z_DEFAULT_STRATEGY:rS,Z_DEFLATED:iS}=vn;function Ho(r){this.options=Hc.assign({level:tS,method:iS,chunkSize:16384,windowBits:15,memLevel:8,strategy:rS},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pg,this.strm.avail_out=0;let t=Eo.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Cc)throw new Error(cn[t]);if(e.header&&Eo.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Fo.string2buf(e.dictionary):dg.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=Eo.deflateSetDictionary(this.strm,i),t!==Cc)throw new Error(cn[t]);this._dict_set=!0}}Ho.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?Xw:Jw,typeof r=="string"?t.input=Fo.string2buf(r):dg.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===Zw||a===Yw)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=Eo.deflate(t,a),n===eS)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=Eo.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Cc;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Ho.prototype.onData=function(r){this.chunks.push(r)};Ho.prototype.onEnd=function(r){r===Cc&&(this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Sp(r,e){let t=new Ho(e);if(t.push(r,!0),t.err)throw t.msg||cn[t.err];return t.result}function nS(r,e){return e=e||{},e.raw=!0,Sp(r,e)}function aS(r,e){return e=e||{},e.gzip=!0,Sp(r,e)}var oS=Ho,sS=Sp,cS=nS,lS=aS,uS=vn,pS={Deflate:oS,deflate:sS,deflateRaw:cS,gzip:lS,constants:uS},Gs=16209,dS=16191,fS=function r(e,t){let i,n,a,o,s,c,l,u,d,f,p,h,m,y,b,_,S,v,C,$,I,L,M,N,W=e.state;i=e.next_in,M=e.input,n=i+(e.avail_in-5),a=e.next_out,N=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=W.dmax,l=W.wsize,u=W.whave,d=W.wnext,f=W.window,p=W.hold,h=W.bits,m=W.lencode,y=W.distcode,b=(1<<W.lenbits)-1,_=(1<<W.distbits)-1;e:do{h<15&&(p+=M[i++]<<h,h+=8,p+=M[i++]<<h,h+=8),S=m[p&b];t:for(;;){if(v=S>>>24,p>>>=v,h-=v,v=S>>>16&255,v===0)N[a++]=S&65535;else if(v&16){C=S&65535,v&=15,v&&(h<v&&(p+=M[i++]<<h,h+=8),C+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=M[i++]<<h,h+=8,p+=M[i++]<<h,h+=8),S=y[p&_];r:for(;;){if(v=S>>>24,p>>>=v,h-=v,v=S>>>16&255,v&16){if($=S&65535,v&=15,h<v&&(p+=M[i++]<<h,h+=8,h<v&&(p+=M[i++]<<h,h+=8)),$+=p&(1<<v)-1,$>c){e.msg="invalid distance too far back",W.mode=Gs;break e}if(p>>>=v,h-=v,v=a-o,$>v){if(v=$-v,v>u&&W.sane){e.msg="invalid distance too far back",W.mode=Gs;break e}if(I=0,L=f,d===0){if(I+=l-v,v<C){C-=v;do N[a++]=f[I++];while(--v);I=a-$,L=N}}else if(d<v){if(I+=l+d-v,v-=d,v<C){C-=v;do N[a++]=f[I++];while(--v);if(I=0,d<C){v=d,C-=v;do N[a++]=f[I++];while(--v);I=a-$,L=N}}}else if(I+=d-v,v<C){C-=v;do N[a++]=f[I++];while(--v);I=a-$,L=N}for(;C>2;)N[a++]=L[I++],N[a++]=L[I++],N[a++]=L[I++],C-=3;C&&(N[a++]=L[I++],C>1&&(N[a++]=L[I++]))}else{I=a-$;do N[a++]=N[I++],N[a++]=N[I++],N[a++]=N[I++],C-=3;while(C>2);C&&(N[a++]=N[I++],C>1&&(N[a++]=N[I++]))}}else if((v&64)===0){S=y[(S&65535)+(p&(1<<v)-1)];continue r}else{e.msg="invalid distance code",W.mode=Gs;break e}break}}else if((v&64)===0){S=m[(S&65535)+(p&(1<<v)-1)];continue t}else if(v&32){W.mode=dS;break e}else{e.msg="invalid literal/length code",W.mode=Gs;break e}break}}while(i<n&&a<s);C=h>>3,i-=C,h-=C<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),W.hold=p,W.bits=h},Xn=15,Ih=852,Th=592,Ch=0,$u=1,Oh=2,hS=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]),mS=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]),gS=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]),yS=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]),vS=(r,e,t,i,n,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,h=0,m=0,y=0,b=0,_=0,S,v,C,$,I,L=null,M,N=new Uint16Array(Xn+1),W=new Uint16Array(Xn+1),Ie=null,Oe,T,we;for(l=0;l<=Xn;l++)N[l]=0;for(u=0;u<i;u++)N[e[t+u]]++;for(p=c,f=Xn;f>=1&&N[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&N[d]===0;d++);for(p<d&&(p=d),y=1,l=1;l<=Xn;l++)if(y<<=1,y-=N[l],y<0)return-1;if(y>0&&(r===Ch||f!==1))return-1;for(W[1]=0,l=1;l<Xn;l++)W[l+1]=W[l]+N[l];for(u=0;u<i;u++)e[t+u]!==0&&(o[W[e[t+u]]++]=u);if(r===Ch?(L=Ie=o,M=20):r===$u?(L=hS,Ie=mS,M=257):(L=gS,Ie=yS,M=0),_=0,u=0,l=d,I=a,h=p,m=0,C=-1,b=1<<p,$=b-1,r===$u&&b>Ih||r===Oh&&b>Th)return 1;for(;;){Oe=l-m,o[u]+1<M?(T=0,we=o[u]):o[u]>=M?(T=Ie[o[u]-M],we=L[o[u]-M]):(T=32+64,we=0),S=1<<l-m,v=1<<h,d=v;do v-=S,n[I+(_>>m)+v]=Oe<<24|T<<16|we|0;while(v!==0);for(S=1<<l-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,u++,--N[l]===0){if(l===f)break;l=e[t+o[u]]}if(l>p&&(_&$)!==C){for(m===0&&(m=p),I+=d,h=l-m,y=1<<h;h+m<f&&(y-=N[h+m],!(y<=0));)h++,y<<=1;if(b+=1<<h,r===$u&&b>Ih||r===Oh&&b>Th)return 1;C=_&$,n[C]=p<<24|h<<16|I-a|0}}return _!==0&&(n[I+_]=l-m<<24|64<<16|0),s.bits=p,0},ko=vS,bS=0,fg=1,hg=2,{Z_FINISH:$h,Z_BLOCK:wS,Z_TREES:Ks,Z_OK:un,Z_STREAM_END:SS,Z_NEED_DICT:_S,Z_STREAM_ERROR:Kt,Z_DATA_ERROR:mg,Z_MEM_ERROR:gg,Z_BUF_ERROR:xS,Z_DEFLATED:Ph}=vn,zc=16180,Rh=16181,Lh=16182,Nh=16183,Dh=16184,Fh=16185,Mh=16186,Uh=16187,jh=16188,qh=16189,Oc=16190,Cr=16191,Pu=16192,Bh=16193,Ru=16194,Vh=16195,Qh=16196,Hh=16197,zh=16198,Js=16199,Zs=16200,Wh=16201,Gh=16202,Kh=16203,Jh=16204,Zh=16205,Lu=16206,Yh=16207,Xh=16208,Te=16209,yg=16210,vg=16211,ES=852,kS=592,AS=15,IS=AS,em=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function TS(){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=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<zc||e.mode>vg?1:0},bg=r=>{if(bn(r))return Kt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=zc,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(ES),e.distcode=e.distdyn=new Int32Array(kS),e.sane=1,e.back=-1,un},wg=r=>{if(bn(r))return Kt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,bg(r)},Sg=(r,e)=>{let t;if(bn(r))return Kt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Kt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,wg(r))},_g=(r,e)=>{if(!r)return Kt;let t=new TS;r.state=t,t.strm=r,t.window=null,t.mode=zc;let i=Sg(r,e);return i!==un&&(r.state=null),i},CS=r=>_g(r,IS),tm=!0,Nu,Du,OS=r=>{if(tm){Nu=new Int32Array(512),Du=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(ko(fg,r.lens,0,288,Nu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;ko(hg,r.lens,0,32,Du,0,r.work,{bits:5}),tm=!1}r.lencode=Nu,r.lenbits=9,r.distcode=Du,r.distbits=5},xg=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},$S=(r,e)=>{let t,i,n,a,o,s,c,l,u,d,f,p,h,m,y=0,b,_,S,v,C,$,I,L,M=new Uint8Array(4),N,W,Ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bn(r)||!r.output||!r.input&&r.avail_in!==0)return Kt;t=r.state,t.mode===Cr&&(t.mode=Pu),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,d=s,f=c,L=un;e:for(;;)switch(t.mode){case zc:if(t.wrap===0){t.mode=Pu;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,M[0]=l&255,M[1]=l>>>8&255,t.check=Ze(t.check,M,2,0),l=0,u=0,t.mode=Rh;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=Te;break}if((l&15)!==Ph){r.msg="unknown compression method",t.mode=Te;break}if(l>>>=4,u-=4,I=(l&15)+8,t.wbits===0&&(t.wbits=I),I>15||I>t.wbits){r.msg="invalid window size",t.mode=Te;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=l&512?qh:Cr,l=0,u=0;break;case Rh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==Ph){r.msg="unknown compression method",t.mode=Te;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Te;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,t.check=Ze(t.check,M,2,0)),l=0,u=0,t.mode=Lh;case Lh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,M[2]=l>>>16&255,M[3]=l>>>24&255,t.check=Ze(t.check,M,4,0)),l=0,u=0,t.mode=Nh;case Nh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,t.check=Ze(t.check,M,2,0)),l=0,u=0,t.mode=Dh;case Dh:if(t.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(M[0]=l&255,M[1]=l>>>8&255,t.check=Ze(t.check,M,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=Fh;case Fh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(I=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),I)),t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Mh;case Mh:if(t.flags&2048){if(s===0)break e;p=0;do I=i[a+p++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Uh;case Uh:if(t.flags&4096){if(s===0)break e;p=0;do I=i[a+p++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,I)break e}else t.head&&(t.head.comment=null);t.mode=jh;case jh:if(t.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Te;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Cr;break;case qh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}r.adler=t.check=em(l),l=0,u=0,t.mode=Oc;case Oc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,_S;r.adler=t.check=1,t.mode=Cr;case Cr:if(e===wS||e===Ks)break e;case Pu:if(t.last){l>>>=u&7,u-=u&7,t.mode=Lu;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Bh;break;case 1:if(OS(t),t.mode=Js,e===Ks){l>>>=2,u-=2;break e}break;case 2:t.mode=Qh;break;case 3:r.msg="invalid block type",t.mode=Te}l>>>=2,u-=2;break;case Bh:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Te;break}if(t.length=l&65535,l=0,u=0,t.mode=Ru,e===Ks)break e;case Ru:t.mode=Vh;case Vh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Cr;break;case Qh:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.nlen=(l&31)+257,l>>>=5,u-=5,t.ndist=(l&31)+1,l>>>=5,u-=5,t.ncode=(l&15)+4,l>>>=4,u-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Te;break}t.have=0,t.mode=Hh;case Hh:for(;t.have<t.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.lens[Ie[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[Ie[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,N={bits:t.lenbits},L=ko(bS,t.lens,0,19,t.lencode,0,t.work,N),t.lenbits=N.bits,L){r.msg="invalid code lengths set",t.mode=Te;break}t.have=0,t.mode=zh;case zh:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[l&(1<<t.lenbits)-1],b=y>>>24,_=y>>>16&255,S=y&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(S<16)l>>>=b,u-=b,t.lens[t.have++]=S;else{if(S===16){for(W=b+2;u<W;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=b,u-=b,t.have===0){r.msg="invalid bit length repeat",t.mode=Te;break}I=t.lens[t.have-1],p=3+(l&3),l>>>=2,u-=2}else if(S===17){for(W=b+3;u<W;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,I=0,p=3+(l&7),l>>>=3,u-=3}else{for(W=b+7;u<W;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,I=0,p=11+(l&127),l>>>=7,u-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Te;break}for(;p--;)t.lens[t.have++]=I}}if(t.mode===Te)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Te;break}if(t.lenbits=9,N={bits:t.lenbits},L=ko(fg,t.lens,0,t.nlen,t.lencode,0,t.work,N),t.lenbits=N.bits,L){r.msg="invalid literal/lengths set",t.mode=Te;break}if(t.distbits=6,t.distcode=t.distdyn,N={bits:t.distbits},L=ko(hg,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,N),t.distbits=N.bits,L){r.msg="invalid distances set",t.mode=Te;break}if(t.mode=Js,e===Ks)break e;case Js:t.mode=Zs;case Zs:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,fS(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,t.mode===Cr&&(t.back=-1);break}for(t.back=0;y=t.lencode[l&(1<<t.lenbits)-1],b=y>>>24,_=y>>>16&255,S=y&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(_&&(_&240)===0){for(v=b,C=_,$=S;y=t.lencode[$+((l&(1<<v+C)-1)>>v)],b=y>>>24,_=y>>>16&255,S=y&65535,!(v+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=v,u-=v,t.back+=v}if(l>>>=b,u-=b,t.back+=b,t.length=S,_===0){t.mode=Zh;break}if(_&32){t.back=-1,t.mode=Cr;break}if(_&64){r.msg="invalid literal/length code",t.mode=Te;break}t.extra=_&15,t.mode=Wh;case Wh:if(t.extra){for(W=t.extra;u<W;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Gh;case Gh:for(;y=t.distcode[l&(1<<t.distbits)-1],b=y>>>24,_=y>>>16&255,S=y&65535,!(b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((_&240)===0){for(v=b,C=_,$=S;y=t.distcode[$+((l&(1<<v+C)-1)>>v)],b=y>>>24,_=y>>>16&255,S=y&65535,!(v+b<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=v,u-=v,t.back+=v}if(l>>>=b,u-=b,t.back+=b,_&64){r.msg="invalid distance code",t.mode=Te;break}t.offset=S,t.extra=_&15,t.mode=Kh;case Kh:if(t.extra){for(W=t.extra;u<W;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Te;break}t.mode=Jh;case Jh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Te;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Zs);break;case Zh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Zs;break;case Lu:if(t.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ze(t.check,n,f,o-f):No(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?l:em(l))!==t.check){r.msg="incorrect data check",t.mode=Te;break}l=0,u=0}t.mode=Yh;case Yh:if(t.wrap&&t.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Te;break}l=0,u=0}t.mode=Xh;case Xh:L=SS;break e;case Te:L=mg;break e;case yg:return gg;case vg:default:return Kt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,(t.wsize||f!==r.avail_out&&t.mode<Te&&(t.mode<Lu||e!==$h))&&xg(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ze(t.check,n,f,r.next_out-f):No(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Cr?128:0)+(t.mode===Js||t.mode===Ru?256:0),(d===0&&f===0||e===$h)&&L===un&&(L=xS),L},PS=r=>{if(bn(r))return Kt;let e=r.state;return e.window&&(e.window=null),r.state=null,un},RS=(r,e)=>{if(bn(r))return Kt;let t=r.state;return(t.wrap&2)===0?Kt:(t.head=e,e.done=!1,un)},LS=(r,e)=>{let t=e.length,i,n,a;return bn(r)||(i=r.state,i.wrap!==0&&i.mode!==Oc)?Kt:i.mode===Oc&&(n=1,n=No(n,e,t,0),n!==i.check)?mg:(a=xg(r,e,t,t),a?(i.mode=yg,gg):(i.havedict=1,un))},NS=wg,DS=Sg,FS=bg,MS=CS,US=_g,jS=$S,qS=PS,BS=RS,VS=LS,QS="pako inflate (from Nodeca project)",Rr={inflateReset:NS,inflateReset2:DS,inflateResetKeep:FS,inflateInit:MS,inflateInit2:US,inflate:jS,inflateEnd:qS,inflateGetHeader:BS,inflateSetDictionary:VS,inflateInfo:QS};function HS(){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 zS=HS,Eg=Object.prototype.toString,{Z_NO_FLUSH:WS,Z_FINISH:GS,Z_OK:Mo,Z_STREAM_END:Fu,Z_NEED_DICT:Mu,Z_STREAM_ERROR:KS,Z_DATA_ERROR:rm,Z_MEM_ERROR:JS}=vn;function zo(r){this.options=Hc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pg,this.strm.avail_out=0;let t=Rr.inflateInit2(this.strm,e.windowBits);if(t!==Mo)throw new Error(cn[t]);if(this.header=new zS,Rr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Fo.string2buf(e.dictionary):Eg.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Rr.inflateSetDictionary(this.strm,e.dictionary),t!==Mo)))throw new Error(cn[t])}zo.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?GS:WS,Eg.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Rr.inflate(t,o),a===Mu&&n&&(a=Rr.inflateSetDictionary(t,n),a===Mo?a=Rr.inflate(t,o):a===rm&&(a=Mu));t.avail_in>0&&a===Fu&&t.state.wrap>0&&r[t.next_in]!==0;)Rr.inflateReset(t),a=Rr.inflate(t,o);switch(a){case KS:case rm:case Mu:case JS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Fu))if(this.options.to==="string"){let c=Fo.utf8border(t.output,t.next_out),l=t.next_out-c,u=Fo.buf2string(t.output,c);t.next_out=l,t.avail_out=i-l,l&&t.output.set(t.output.subarray(c,c+l),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===Mo&&s===0)){if(a===Fu)return a=Rr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};zo.prototype.onData=function(r){this.chunks.push(r)};zo.prototype.onEnd=function(r){r===Mo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Hc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function _p(r,e){let t=new zo(e);if(t.push(r),t.err)throw t.msg||cn[t.err];return t.result}function ZS(r,e){return e=e||{},e.raw=!0,_p(r,e)}var YS=zo,XS=_p,e1=ZS,t1=_p,r1=vn,i1={Inflate:YS,inflate:XS,inflateRaw:e1,ungzip:t1,constants:r1},{Deflate:n1,deflate:a1,deflateRaw:o1,gzip:s1}=pS,{Inflate:c1,inflate:l1,inflateRaw:u1,ungzip:p1}=i1,d1=n1,f1=a1,h1=o1,m1=s1,g1=c1,y1=l1,v1=u1,b1=p1,w1=vn,S1={Deflate:d1,deflate:f1,deflateRaw:h1,gzip:m1,Inflate:g1,inflate:y1,inflateRaw:v1,ungzip:b1,constants:w1},Ee=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ke=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$c=class{constructor(e,t){this.input=e,this.output=t}};Ee([w(),ke("design:type",String)],$c.prototype,"input",void 0);Ee([w(),ke("design:type",String)],$c.prototype,"output",void 0);$c=Ee([Xe(),ke("design:paramtypes",[String,String])],$c);var Pc=class{constructor(e,t){this.input=e,this.output=t}};Ee([w(),ke("design:type",String)],Pc.prototype,"input",void 0);Ee([w(),ke("design:type",String)],Pc.prototype,"output",void 0);Pc=Ee([J(),ke("design:paramtypes",[String,String])],Pc);var yi=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Ee([w(),ke("design:type",String)],yi.prototype,"name",void 0);Ee([w(),ke("design:type",String)],yi.prototype,"modelId",void 0);Ee([w(),ke("design:type",String)],yi.prototype,"systemPrompt",void 0);Ee([w(),ke("design:type",Array)],yi.prototype,"promptExamples",void 0);Ee([w(),ke("design:type",String)],yi.prototype,"metaData",void 0);yi=Ee([Xe(),ke("design:paramtypes",[String,String,String,Array,String])],yi);var xr=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Ee([w(),ke("design:type",String)],xr.prototype,"name",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"modelId",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"taskId",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"systemPrompt",void 0);Ee([w(),ke("design:type",Array)],xr.prototype,"promptExamples",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"metaData",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"createdAt",void 0);Ee([w(),ke("design:type",String)],xr.prototype,"updatedAt",void 0);xr=Ee([J(),ke("design:paramtypes",[String,String,String,String,Array,String,String,String])],xr);var pn=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Ee([w(),ke("design:type",String)],pn.prototype,"model",void 0);Ee([w(),ke("design:type",String)],pn.prototype,"status",void 0);Ee([w(),ke("design:type",Number)],pn.prototype,"progress",void 0);Ee([w(),ke("design:type",Boolean)],pn.prototype,"downloaded",void 0);Ee([w(),ke("design:type",Boolean)],pn.prototype,"loaded",void 0);pn=Ee([J(),ke("design:paramtypes",[String,String,Number,Boolean,Boolean])],pn);var _1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},We=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},He,dc,cp=class{constructor(e,t=!0){He.set(this,void 0),dc.set(this,new Map),_1(this,He,e,"f")}async getModels(){let e=await We(this,He,"f").query({query:x`
|
|
849
|
+
}`,variables:{url:e,interactionCall:t}}));return i}};Rr=new WeakMap;var Hc={};Hc.byteLength=E0;Hc.toByteArray=k0;Hc.fromByteArray=C0;var mr=[],zt=[],x0=typeof Uint8Array<"u"?Uint8Array:Array,ku="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(qi=0,_h=ku.length;qi<_h;++qi)mr[qi]=ku[qi],zt[ku.charCodeAt(qi)]=qi;var qi,_h;zt["-".charCodeAt(0)]=62;zt["_".charCodeAt(0)]=63;function Gm(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function E0(r){var e=Gm(r),t=e[0],i=e[1];return(t+i)*3/4-i}function A0(r,e,t){return(e+t)*3/4-t}function k0(r){var e,t=Gm(r),i=t[0],n=t[1],a=new x0(A0(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=zt[r.charCodeAt(c)]<<18|zt[r.charCodeAt(c+1)]<<12|zt[r.charCodeAt(c+2)]<<6|zt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=zt[r.charCodeAt(c)]<<2|zt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=zt[r.charCodeAt(c)]<<10|zt[r.charCodeAt(c+1)]<<4|zt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function I0(r){return mr[r>>18&63]+mr[r>>12&63]+mr[r>>6&63]+mr[r&63]}function T0(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(I0(i));return n.join("")}function C0(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(T0(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(mr[e>>2]+mr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(mr[e>>10]+mr[e>>4&63]+mr[e<<2&63]+"=")),n.join("")}var $0=4,xh=0,Eh=1,O0=2;function ba(r){let e=r.length;for(;--e>=0;)r[e]=0}var R0=0,Km=1,P0=2,L0=3,N0=258,Sp=29,Ho=256,Po=Ho+1+Sp,oa=30,_p=19,Jm=2*Po+1,Xi=15,Iu=16,D0=7,xp=256,Zm=16,Ym=17,Xm=18,ip=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]),dc=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]),F0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),eg=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),M0=512,Pr=new Array((Po+2)*2);ba(Pr);var Ao=new Array(oa*2);ba(Ao);var Lo=new Array(M0);ba(Lo);var No=new Array(N0-L0+1);ba(No);var Ep=new Array(Sp);ba(Ep);var Cc=new Array(oa);ba(Cc);function Tu(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var tg,rg,ig;function Cu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var ng=r=>r<256?Lo[r]:Lo[256+(r>>>7)],Do=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},Ct=(r,e,t)=>{r.bi_valid>Iu-t?(r.bi_buf|=e<<r.bi_valid&65535,Do(r,r.bi_buf),r.bi_buf=e>>Iu-r.bi_valid,r.bi_valid+=t-Iu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},gr=(r,e,t)=>{Ct(r,t[e*2],t[e*2+1])},ag=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},U0=r=>{r.bi_valid===16?(Do(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},j0=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=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,l,u,f,d,p,h,m=0;for(d=0;d<=Xi;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;l<Jm;l++)u=r.heap[l],d=t[t[u*2+1]*2+1]+1,d>c&&(d=c,m++),t[u*2+1]=d,!(u>i)&&(r.bl_count[d]++,p=0,u>=s&&(p=o[u-s]),h=t[u*2],r.opt_len+=h*(d+p),a&&(r.static_len+=h*(n[u*2+1]+p)));if(m!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(d=c;d!==0;d--)for(u=r.bl_count[d];u!==0;)f=r.heap[--l],!(f>i)&&(t[f*2+1]!==d&&(r.opt_len+=(d-t[f*2+1])*t[f*2],t[f*2+1]=d),u--)}},og=(r,e,t)=>{let i=new Array(Xi+1),n=0,a,o;for(a=1;a<=Xi;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=ag(i[s]++,s))}},q0=()=>{let r,e,t,i,n,a=new Array(Xi+1);for(t=0,i=0;i<Sp-1;i++)for(Ep[i]=t,r=0;r<1<<ip[i];r++)No[t++]=i;for(No[t-1]=i,n=0,i=0;i<16;i++)for(Cc[i]=n,r=0;r<1<<dc[i];r++)Lo[n++]=i;for(n>>=7;i<oa;i++)for(Cc[i]=n<<7,r=0;r<1<<dc[i]-7;r++)Lo[256+n++]=i;for(e=0;e<=Xi;e++)a[e]=0;for(r=0;r<=143;)Pr[r*2+1]=8,r++,a[8]++;for(;r<=255;)Pr[r*2+1]=9,r++,a[9]++;for(;r<=279;)Pr[r*2+1]=7,r++,a[7]++;for(;r<=287;)Pr[r*2+1]=8,r++,a[8]++;for(og(Pr,Po+1,a),r=0;r<oa;r++)Ao[r*2+1]=5,Ao[r*2]=ag(r,5);tg=new Tu(Pr,ip,Ho+1,Po,Xi),rg=new Tu(Ao,dc,0,oa,Xi),ig=new Tu(new Array(0),F0,0,_p,D0)},sg=r=>{let e;for(e=0;e<Po;e++)r.dyn_ltree[e*2]=0;for(e=0;e<oa;e++)r.dyn_dtree[e*2]=0;for(e=0;e<_p;e++)r.bl_tree[e*2]=0;r.dyn_ltree[xp*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},cg=r=>{r.bi_valid>8?Do(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Ah=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},$u=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&Ah(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!Ah(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},kh=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?gr(r,n,e):(o=No[n],gr(r,o+Ho+1,e),s=ip[o],s!==0&&(n-=Ep[o],Ct(r,n,s)),i--,o=ng(i),gr(r,o,t),s=dc[o],s!==0&&(i-=Cc[o],Ct(r,i,s)));while(a<r.sym_next);gr(r,xp,e)},np=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,l;for(r.heap_len=0,r.heap_max=Jm,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=c<2?++c:0,t[l*2]=1,r.depth[l]=0,r.opt_len--,n&&(r.static_len-=i[l*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)$u(r,t,o);l=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],$u(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[l*2]=t[o*2]+t[s*2],r.depth[l]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=l,r.heap[1]=l++,$u(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],j0(r,e),og(t,c,r.bl_count)},Ih=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[Zm*2]++):s<=10?r.bl_tree[Ym*2]++:r.bl_tree[Xm*2]++,s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},Th=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do gr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(gr(r,a,r.bl_tree),s--),gr(r,Zm,r.bl_tree),Ct(r,s-3,2)):s<=10?(gr(r,Ym,r.bl_tree),Ct(r,s-3,3)):(gr(r,Xm,r.bl_tree),Ct(r,s-11,7));s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},B0=r=>{let e;for(Ih(r,r.dyn_ltree,r.l_desc.max_code),Ih(r,r.dyn_dtree,r.d_desc.max_code),np(r,r.bl_desc),e=_p-1;e>=3&&r.bl_tree[eg[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},V0=(r,e,t,i)=>{let n;for(Ct(r,e-257,5),Ct(r,t-1,5),Ct(r,i-4,4),n=0;n<i;n++)Ct(r,r.bl_tree[eg[n]*2+1],3);Th(r,r.dyn_ltree,e-1),Th(r,r.dyn_dtree,t-1)},Q0=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return xh;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Eh;for(t=32;t<Ho;t++)if(r.dyn_ltree[t*2]!==0)return Eh;return xh},Ch=!1,H0=r=>{Ch||(q0(),Ch=!0),r.l_desc=new Cu(r.dyn_ltree,tg),r.d_desc=new Cu(r.dyn_dtree,rg),r.bl_desc=new Cu(r.bl_tree,ig),r.bi_buf=0,r.bi_valid=0,sg(r)},lg=(r,e,t,i)=>{Ct(r,(R0<<1)+(i?1:0),3),cg(r),Do(r,t),Do(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},z0=r=>{Ct(r,Km<<1,3),gr(r,xp,Pr),U0(r)},W0=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===O0&&(r.strm.data_type=Q0(r)),np(r,r.l_desc),np(r,r.d_desc),o=B0(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?lg(r,e,t,i):r.strategy===$0||a===n?(Ct(r,(Km<<1)+(i?1:0),3),kh(r,Pr,Ao)):(Ct(r,(P0<<1)+(i?1:0),3),V0(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),kh(r,r.dyn_ltree,r.dyn_dtree)),sg(r),i&&cg(r)},G0=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(No[t]+Ho+1)*2]++,r.dyn_dtree[ng(e)*2]++),r.sym_next===r.sym_end),K0=H0,J0=lg,Z0=W0,Y0=G0,X0=z0,ew={_tr_init:K0,_tr_stored_block:J0,_tr_flush_block:Z0,_tr_tally:Y0,_tr_align:X0},tw=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},Fo=tw,rw=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},iw=new Uint32Array(rw()),nw=(r,e,t,i)=>{let n=iw,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ze=nw,un={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"},wn={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:aw,_tr_stored_block:ap,_tr_flush_block:ow,_tr_tally:fi,_tr_align:sw}=ew,{Z_NO_FLUSH:hi,Z_PARTIAL_FLUSH:cw,Z_FULL_FLUSH:lw,Z_FINISH:Gt,Z_BLOCK:$h,Z_OK:at,Z_STREAM_END:Oh,Z_STREAM_ERROR:br,Z_DATA_ERROR:uw,Z_BUF_ERROR:Ou,Z_DEFAULT_COMPRESSION:pw,Z_FILTERED:dw,Z_HUFFMAN_ONLY:Ks,Z_RLE:fw,Z_FIXED:hw,Z_DEFAULT_STRATEGY:mw,Z_UNKNOWN:gw,Z_DEFLATED:zc}=wn,yw=9,vw=15,bw=8,ww=29,Sw=256,op=Sw+1+ww,_w=30,xw=19,Ew=2*op+1,Aw=15,de=3,li=258,wr=li+de+1,kw=32,pa=42,Ap=57,sp=69,cp=73,lp=91,up=103,en=113,yo=666,yt=1,wa=2,pn=3,Sa=4,Iw=3,tn=(r,e)=>(r.msg=un[e],e),Rh=r=>r*2-(r>4?9:0),ci=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Tw=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},Cw=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,mi=Cw,Nt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Ft=(r,e)=>{ow(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Nt(r.strm)},be=(r,e)=>{r.pending_buf[r.pending++]=e},Ja=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},pp=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=Fo(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ze(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},ug=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-wr?r.strstart-(r.w_size-wr):0,l=r.window,u=r.w_mask,f=r.prev,d=r.strstart+li,p=l[i+o-1],h=l[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(l[n+o]!==h||l[n+o-1]!==p||l[n]!==l[i]||l[++n]!==l[i+1])){i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<d);if(a=li-(d-i),i=d-li,a>o){if(r.match_start=e,o=a,a>=s)break;p=l[i+o-1],h=l[i+o]}}while((e=f[e&u])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},da=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-wr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Tw(r),i+=e),r.strm.avail_in===0)break;if(t=pp(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=de)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=mi(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=mi(r,r.ins_h,r.window[n+de-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<de)););}while(r.lookahead<wr&&r.strm.avail_in!==0)},pg=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Gt||e===hi||i!==n+r.strm.avail_in)))break;o=e===Gt&&i===n+r.strm.avail_in?1:0,ap(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,Nt(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(pp(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?Sa:e!==hi&&e!==Gt&&r.strm.avail_in===0&&r.strstart===r.block_start?wa:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(pp(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Gt)&&e!==hi&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Gt&&r.strm.avail_in===0&&i===n?1:0,ap(r,r.block_start,i,o),r.block_start+=i,Nt(r.strm)),o?pn:yt)},Ru=(r,e)=>{let t,i;for(;;){if(r.lookahead<wr){if(da(r),r.lookahead<wr&&e===hi)return yt;if(r.lookahead===0)break}if(t=0,r.lookahead>=de&&(r.ins_h=mi(r,r.ins_h,r.window[r.strstart+de-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-wr&&(r.match_length=ug(r,t)),r.match_length>=de)if(i=fi(r,r.strstart-r.match_start,r.match_length-de),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=de){r.match_length--;do r.strstart++,r.ins_h=mi(r,r.ins_h,r.window[r.strstart+de-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=mi(r,r.ins_h,r.window[r.strstart+1]);else i=fi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Ft(r,!1),r.strm.avail_out===0))return yt}return r.insert=r.strstart<de-1?r.strstart:de-1,e===Gt?(Ft(r,!0),r.strm.avail_out===0?pn:Sa):r.sym_next&&(Ft(r,!1),r.strm.avail_out===0)?yt:wa},ea=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<wr){if(da(r),r.lookahead<wr&&e===hi)return yt;if(r.lookahead===0)break}if(t=0,r.lookahead>=de&&(r.ins_h=mi(r,r.ins_h,r.window[r.strstart+de-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=de-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-wr&&(r.match_length=ug(r,t),r.match_length<=5&&(r.strategy===dw||r.match_length===de&&r.strstart-r.match_start>4096)&&(r.match_length=de-1)),r.prev_length>=de&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-de,i=fi(r,r.strstart-1-r.prev_match,r.prev_length-de),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=mi(r,r.ins_h,r.window[r.strstart+de-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=de-1,r.strstart++,i&&(Ft(r,!1),r.strm.avail_out===0))return yt}else if(r.match_available){if(i=fi(r,0,r.window[r.strstart-1]),i&&Ft(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return yt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=fi(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<de-1?r.strstart:de-1,e===Gt?(Ft(r,!0),r.strm.avail_out===0?pn:Sa):r.sym_next&&(Ft(r,!1),r.strm.avail_out===0)?yt:wa},$w=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=li){if(da(r),r.lookahead<=li&&e===hi)return yt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=de&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+li;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=li-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=de?(t=fi(r,1,r.match_length-de),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=fi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Ft(r,!1),r.strm.avail_out===0))return yt}return r.insert=0,e===Gt?(Ft(r,!0),r.strm.avail_out===0?pn:Sa):r.sym_next&&(Ft(r,!1),r.strm.avail_out===0)?yt:wa},Ow=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(da(r),r.lookahead===0)){if(e===hi)return yt;break}if(r.match_length=0,t=fi(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Ft(r,!1),r.strm.avail_out===0))return yt}return r.insert=0,e===Gt?(Ft(r,!0),r.strm.avail_out===0?pn:Sa):r.sym_next&&(Ft(r,!1),r.strm.avail_out===0)?yt:wa};function fr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var vo=[new fr(0,0,0,0,pg),new fr(4,4,8,4,Ru),new fr(4,5,16,8,Ru),new fr(4,6,32,32,Ru),new fr(4,4,16,16,ea),new fr(8,16,32,32,ea),new fr(8,16,128,128,ea),new fr(8,32,128,256,ea),new fr(32,128,258,1024,ea),new fr(32,258,258,4096,ea)],Rw=r=>{r.window_size=2*r.w_size,ci(r.head),r.max_lazy_match=vo[r.level].max_lazy,r.good_match=vo[r.level].good_length,r.nice_match=vo[r.level].nice_length,r.max_chain_length=vo[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=de-1,r.match_available=0,r.ins_h=0};function Pw(){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=zc,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(Ew*2),this.dyn_dtree=new Uint16Array((2*_w+1)*2),this.bl_tree=new Uint16Array((2*xw+1)*2),ci(this.dyn_ltree),ci(this.dyn_dtree),ci(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Aw+1),this.heap=new Uint16Array(2*op+1),ci(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*op+1),ci(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 zo=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==pa&&e.status!==Ap&&e.status!==sp&&e.status!==cp&&e.status!==lp&&e.status!==up&&e.status!==en&&e.status!==yo?1:0},dg=r=>{if(zo(r))return tn(r,br);r.total_in=r.total_out=0,r.data_type=gw;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Ap:e.wrap?pa:en,r.adler=e.wrap===2?0:1,e.last_flush=-2,aw(e),at},fg=r=>{let e=dg(r);return e===at&&Rw(r.state),e},Lw=(r,e)=>zo(r)||r.state.wrap!==2?br:(r.state.gzhead=e,at),hg=(r,e,t,i,n,a)=>{if(!r)return br;let o=1;if(e===pw&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>yw||t!==zc||i<8||i>15||e<0||e>9||a<0||a>hw||i===8&&o!==1)return tn(r,br);i===8&&(i=9);let s=new Pw;return r.state=s,s.strm=r,s.status=pa,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+de-1)/de),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<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,fg(r)},Nw=(r,e)=>hg(r,e,zc,vw,bw,mw),Dw=(r,e)=>{if(zo(r)||e>$h||e<0)return r?tn(r,br):br;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===yo&&e!==Gt)return tn(r,r.avail_out===0?Ou:br);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Nt(r),r.avail_out===0)return t.last_flush=-1,at}else if(r.avail_in===0&&Rh(e)<=Rh(i)&&e!==Gt)return tn(r,Ou);if(t.status===yo&&r.avail_in!==0)return tn(r,Ou);if(t.status===pa&&t.wrap===0&&(t.status=en),t.status===pa){let n=zc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Ks||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=kw),n+=31-n%31,Ja(t,n),t.strstart!==0&&(Ja(t,r.adler>>>16),Ja(t,r.adler&65535)),r.adler=1,t.status=en,Nt(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===Ap){if(r.adler=0,be(t,31),be(t,139),be(t,8),t.gzhead)be(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),be(t,t.gzhead.time&255),be(t,t.gzhead.time>>8&255),be(t,t.gzhead.time>>16&255),be(t,t.gzhead.time>>24&255),be(t,t.level===9?2:t.strategy>=Ks||t.level<2?4:0),be(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(be(t,t.gzhead.extra.length&255),be(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ze(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=sp;else if(be(t,0),be(t,0),be(t,0),be(t,0),be(t,0),be(t,t.level===9?2:t.strategy>=Ks||t.level<2?4:0),be(t,Iw),t.status=en,Nt(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===sp){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,Nt(r),t.pending!==0)return t.last_flush=-1,at;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=cp}if(t.status===cp){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),Nt(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=lp}if(t.status===lp){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),Nt(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n))}t.status=up}if(t.status===up){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Nt(r),t.pending!==0))return t.last_flush=-1,at;be(t,r.adler&255),be(t,r.adler>>8&255),r.adler=0}if(t.status=en,Nt(r),t.pending!==0)return t.last_flush=-1,at}if(r.avail_in!==0||t.lookahead!==0||e!==hi&&t.status!==yo){let n=t.level===0?pg(t,e):t.strategy===Ks?Ow(t,e):t.strategy===fw?$w(t,e):vo[t.level].func(t,e);if((n===pn||n===Sa)&&(t.status=yo),n===yt||n===pn)return r.avail_out===0&&(t.last_flush=-1),at;if(n===wa&&(e===cw?sw(t):e!==$h&&(ap(t,0,0,!1),e===lw&&(ci(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Nt(r),r.avail_out===0))return t.last_flush=-1,at}return e!==Gt?at:t.wrap<=0?Oh:(t.wrap===2?(be(t,r.adler&255),be(t,r.adler>>8&255),be(t,r.adler>>16&255),be(t,r.adler>>24&255),be(t,r.total_in&255),be(t,r.total_in>>8&255),be(t,r.total_in>>16&255),be(t,r.total_in>>24&255)):(Ja(t,r.adler>>>16),Ja(t,r.adler&65535)),Nt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?at:Oh)},Fw=r=>{if(zo(r))return br;let e=r.state.status;return r.state=null,e===en?tn(r,uw):at},Mw=(r,e)=>{let t=e.length;if(zo(r))return br;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==pa||i.lookahead)return br;if(n===1&&(r.adler=Fo(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(ci(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,da(i);i.lookahead>=de;){let c=i.strstart,l=i.lookahead-(de-1);do i.ins_h=mi(i,i.ins_h,i.window[c+de-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--l);i.strstart=c,i.lookahead=de-1,da(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=de-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,at},Uw=Nw,jw=hg,qw=fg,Bw=dg,Vw=Lw,Qw=Dw,Hw=Fw,zw=Mw,Ww="pako deflate (from Nodeca project)",ko={deflateInit:Uw,deflateInit2:jw,deflateReset:qw,deflateResetKeep:Bw,deflateSetHeader:Vw,deflate:Qw,deflateEnd:Hw,deflateSetDictionary:zw,deflateInfo:Ww},Gw=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),Kw=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)Gw(t,i)&&(r[i]=t[i])}}return r},Jw=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Wc={assign:Kw,flattenChunks:Jw},mg=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){mg=!1}var Mo=new Uint8Array(256);for(let r=0;r<256;r++)Mo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Mo[254]=Mo[254]=1;var Zw=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},Yw=(r,e)=>{if(e<65534&&r.subarray&&mg)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},Xw=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=Mo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return Yw(a,n)},eS=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+Mo[r[t]]>e?t:e},Uo={string2buf:Zw,buf2string:Xw,utf8border:eS};function tS(){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 gg=tS,yg=Object.prototype.toString,{Z_NO_FLUSH:rS,Z_SYNC_FLUSH:iS,Z_FULL_FLUSH:nS,Z_FINISH:aS,Z_OK:$c,Z_STREAM_END:oS,Z_DEFAULT_COMPRESSION:sS,Z_DEFAULT_STRATEGY:cS,Z_DEFLATED:lS}=wn;function Wo(r){this.options=Wc.assign({level:sS,method:lS,chunkSize:16384,windowBits:15,memLevel:8,strategy:cS},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gg,this.strm.avail_out=0;let t=ko.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==$c)throw new Error(un[t]);if(e.header&&ko.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=Uo.string2buf(e.dictionary):yg.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=ko.deflateSetDictionary(this.strm,i),t!==$c)throw new Error(un[t]);this._dict_set=!0}}Wo.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?aS:rS,typeof r=="string"?t.input=Uo.string2buf(r):yg.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===iS||a===nS)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ko.deflate(t,a),n===oS)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ko.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===$c;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Wo.prototype.onData=function(r){this.chunks.push(r)};Wo.prototype.onEnd=function(r){r===$c&&(this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function kp(r,e){let t=new Wo(e);if(t.push(r,!0),t.err)throw t.msg||un[t.err];return t.result}function uS(r,e){return e=e||{},e.raw=!0,kp(r,e)}function pS(r,e){return e=e||{},e.gzip=!0,kp(r,e)}var dS=Wo,fS=kp,hS=uS,mS=pS,gS=wn,yS={Deflate:dS,deflate:fS,deflateRaw:hS,gzip:mS,constants:gS},Js=16209,vS=16191,bS=function r(e,t){let i,n,a,o,s,c,l,u,f,d,p,h,m,g,_,w,y,b,A,T,x,O,D,P,U=e.state;i=e.next_in,D=e.input,n=i+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=U.dmax,l=U.wsize,u=U.whave,f=U.wnext,d=U.window,p=U.hold,h=U.bits,m=U.lencode,g=U.distcode,_=(1<<U.lenbits)-1,w=(1<<U.distbits)-1;e:do{h<15&&(p+=D[i++]<<h,h+=8,p+=D[i++]<<h,h+=8),y=m[p&_];t:for(;;){if(b=y>>>24,p>>>=b,h-=b,b=y>>>16&255,b===0)P[a++]=y&65535;else if(b&16){A=y&65535,b&=15,b&&(h<b&&(p+=D[i++]<<h,h+=8),A+=p&(1<<b)-1,p>>>=b,h-=b),h<15&&(p+=D[i++]<<h,h+=8,p+=D[i++]<<h,h+=8),y=g[p&w];r:for(;;){if(b=y>>>24,p>>>=b,h-=b,b=y>>>16&255,b&16){if(T=y&65535,b&=15,h<b&&(p+=D[i++]<<h,h+=8,h<b&&(p+=D[i++]<<h,h+=8)),T+=p&(1<<b)-1,T>c){e.msg="invalid distance too far back",U.mode=Js;break e}if(p>>>=b,h-=b,b=a-o,T>b){if(b=T-b,b>u&&U.sane){e.msg="invalid distance too far back",U.mode=Js;break e}if(x=0,O=d,f===0){if(x+=l-b,b<A){A-=b;do P[a++]=d[x++];while(--b);x=a-T,O=P}}else if(f<b){if(x+=l+f-b,b-=f,b<A){A-=b;do P[a++]=d[x++];while(--b);if(x=0,f<A){b=f,A-=b;do P[a++]=d[x++];while(--b);x=a-T,O=P}}}else if(x+=f-b,b<A){A-=b;do P[a++]=d[x++];while(--b);x=a-T,O=P}for(;A>2;)P[a++]=O[x++],P[a++]=O[x++],P[a++]=O[x++],A-=3;A&&(P[a++]=O[x++],A>1&&(P[a++]=O[x++]))}else{x=a-T;do P[a++]=P[x++],P[a++]=P[x++],P[a++]=P[x++],A-=3;while(A>2);A&&(P[a++]=P[x++],A>1&&(P[a++]=P[x++]))}}else if((b&64)===0){y=g[(y&65535)+(p&(1<<b)-1)];continue r}else{e.msg="invalid distance code",U.mode=Js;break e}break}}else if((b&64)===0){y=m[(y&65535)+(p&(1<<b)-1)];continue t}else if(b&32){U.mode=vS;break e}else{e.msg="invalid literal/length code",U.mode=Js;break e}break}}while(i<n&&a<s);A=h>>3,i-=A,h-=A<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),U.hold=p,U.bits=h},ta=15,Ph=852,Lh=592,Nh=0,Pu=1,Dh=2,wS=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]),SS=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]),_S=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]),xS=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]),ES=(r,e,t,i,n,a,o,s)=>{let c=s.bits,l=0,u=0,f=0,d=0,p=0,h=0,m=0,g=0,_=0,w=0,y,b,A,T,x,O=null,D,P=new Uint16Array(ta+1),U=new Uint16Array(ta+1),ke=null,Ie,C,we;for(l=0;l<=ta;l++)P[l]=0;for(u=0;u<i;u++)P[e[t+u]]++;for(p=c,d=ta;d>=1&&P[d]===0;d--);if(p>d&&(p=d),d===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<d&&P[f]===0;f++);for(p<f&&(p=f),g=1,l=1;l<=ta;l++)if(g<<=1,g-=P[l],g<0)return-1;if(g>0&&(r===Nh||d!==1))return-1;for(U[1]=0,l=1;l<ta;l++)U[l+1]=U[l]+P[l];for(u=0;u<i;u++)e[t+u]!==0&&(o[U[e[t+u]]++]=u);if(r===Nh?(O=ke=o,D=20):r===Pu?(O=wS,ke=SS,D=257):(O=_S,ke=xS,D=0),w=0,u=0,l=f,x=a,h=p,m=0,A=-1,_=1<<p,T=_-1,r===Pu&&_>Ph||r===Dh&&_>Lh)return 1;for(;;){Ie=l-m,o[u]+1<D?(C=0,we=o[u]):o[u]>=D?(C=ke[o[u]-D],we=O[o[u]-D]):(C=32+64,we=0),y=1<<l-m,b=1<<h,f=b;do b-=y,n[x+(w>>m)+b]=Ie<<24|C<<16|we|0;while(b!==0);for(y=1<<l-1;w&y;)y>>=1;if(y!==0?(w&=y-1,w+=y):w=0,u++,--P[l]===0){if(l===d)break;l=e[t+o[u]]}if(l>p&&(w&T)!==A){for(m===0&&(m=p),x+=f,h=l-m,g=1<<h;h+m<d&&(g-=P[h+m],!(g<=0));)h++,g<<=1;if(_+=1<<h,r===Pu&&_>Ph||r===Dh&&_>Lh)return 1;A=w&T,n[A]=p<<24|h<<16|x-a|0}}return w!==0&&(n[x+w]=l-m<<24|64<<16|0),s.bits=p,0},Io=ES,AS=0,vg=1,bg=2,{Z_FINISH:Fh,Z_BLOCK:kS,Z_TREES:Zs,Z_OK:dn,Z_STREAM_END:IS,Z_NEED_DICT:TS,Z_STREAM_ERROR:Jt,Z_DATA_ERROR:wg,Z_MEM_ERROR:Sg,Z_BUF_ERROR:CS,Z_DEFLATED:Mh}=wn,Gc=16180,Uh=16181,jh=16182,qh=16183,Bh=16184,Vh=16185,Qh=16186,Hh=16187,zh=16188,Wh=16189,Oc=16190,Cr=16191,Lu=16192,Gh=16193,Nu=16194,Kh=16195,Jh=16196,Zh=16197,Yh=16198,Ys=16199,Xs=16200,Xh=16201,em=16202,tm=16203,rm=16204,im=16205,Du=16206,nm=16207,am=16208,Ce=16209,_g=16210,xg=16211,$S=852,OS=592,RS=15,PS=RS,om=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function LS(){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 Sn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Gc||e.mode>xg?1:0},Eg=r=>{if(Sn(r))return Jt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Gc,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($S),e.distcode=e.distdyn=new Int32Array(OS),e.sane=1,e.back=-1,dn},Ag=r=>{if(Sn(r))return Jt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Eg(r)},kg=(r,e)=>{let t;if(Sn(r))return Jt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,Ag(r))},Ig=(r,e)=>{if(!r)return Jt;let t=new LS;r.state=t,t.strm=r,t.window=null,t.mode=Gc;let i=kg(r,e);return i!==dn&&(r.state=null),i},NS=r=>Ig(r,PS),sm=!0,Fu,Mu,DS=r=>{if(sm){Fu=new Int32Array(512),Mu=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(Io(vg,r.lens,0,288,Fu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Io(bg,r.lens,0,32,Mu,0,r.work,{bits:5}),sm=!1}r.lencode=Fu,r.lenbits=9,r.distcode=Mu,r.distbits=5},Tg=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},FS=(r,e)=>{let t,i,n,a,o,s,c,l,u,f,d,p,h,m,g=0,_,w,y,b,A,T,x,O,D=new Uint8Array(4),P,U,ke=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Sn(r)||!r.output||!r.input&&r.avail_in!==0)return Jt;t=r.state,t.mode===Cr&&(t.mode=Lu),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,f=s,d=c,O=dn;e:for(;;)switch(t.mode){case Gc:if(t.wrap===0){t.mode=Lu;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,D[0]=l&255,D[1]=l>>>8&255,t.check=Ze(t.check,D,2,0),l=0,u=0,t.mode=Uh;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=Ce;break}if((l&15)!==Mh){r.msg="unknown compression method",t.mode=Ce;break}if(l>>>=4,u-=4,x=(l&15)+8,t.wbits===0&&(t.wbits=x),x>15||x>t.wbits){r.msg="invalid window size",t.mode=Ce;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=l&512?Wh:Cr,l=0,u=0;break;case Uh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==Mh){r.msg="unknown compression method",t.mode=Ce;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Ce;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(D[0]=l&255,D[1]=l>>>8&255,t.check=Ze(t.check,D,2,0)),l=0,u=0,t.mode=jh;case jh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(D[0]=l&255,D[1]=l>>>8&255,D[2]=l>>>16&255,D[3]=l>>>24&255,t.check=Ze(t.check,D,4,0)),l=0,u=0,t.mode=qh;case qh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(D[0]=l&255,D[1]=l>>>8&255,t.check=Ze(t.check,D,2,0)),l=0,u=0,t.mode=Bh;case Bh:if(t.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(D[0]=l&255,D[1]=l>>>8&255,t.check=Ze(t.check,D,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=Vh;case Vh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(x=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),x)),t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Qh;case Qh:if(t.flags&2048){if(s===0)break e;p=0;do x=i[a+p++],t.head&&x&&t.length<65536&&(t.head.name+=String.fromCharCode(x));while(x&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,x)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Hh;case Hh:if(t.flags&4096){if(s===0)break e;p=0;do x=i[a+p++],t.head&&x&&t.length<65536&&(t.head.comment+=String.fromCharCode(x));while(x&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,x)break e}else t.head&&(t.head.comment=null);t.mode=zh;case zh:if(t.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Ce;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Cr;break;case Wh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}r.adler=t.check=om(l),l=0,u=0,t.mode=Oc;case Oc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,TS;r.adler=t.check=1,t.mode=Cr;case Cr:if(e===kS||e===Zs)break e;case Lu:if(t.last){l>>>=u&7,u-=u&7,t.mode=Du;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Gh;break;case 1:if(DS(t),t.mode=Ys,e===Zs){l>>>=2,u-=2;break e}break;case 2:t.mode=Jh;break;case 3:r.msg="invalid block type",t.mode=Ce}l>>>=2,u-=2;break;case Gh:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Ce;break}if(t.length=l&65535,l=0,u=0,t.mode=Nu,e===Zs)break e;case Nu:t.mode=Kh;case Kh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Cr;break;case Jh:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.nlen=(l&31)+257,l>>>=5,u-=5,t.ndist=(l&31)+1,l>>>=5,u-=5,t.ncode=(l&15)+4,l>>>=4,u-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Ce;break}t.have=0,t.mode=Zh;case Zh:for(;t.have<t.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.lens[ke[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[ke[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},O=Io(AS,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,O){r.msg="invalid code lengths set",t.mode=Ce;break}t.have=0,t.mode=Yh;case Yh:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[l&(1<<t.lenbits)-1],_=g>>>24,w=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(y<16)l>>>=_,u-=_,t.lens[t.have++]=y;else{if(y===16){for(U=_+2;u<U;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=_,u-=_,t.have===0){r.msg="invalid bit length repeat",t.mode=Ce;break}x=t.lens[t.have-1],p=3+(l&3),l>>>=2,u-=2}else if(y===17){for(U=_+3;u<U;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,x=0,p=3+(l&7),l>>>=3,u-=3}else{for(U=_+7;u<U;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,x=0,p=11+(l&127),l>>>=7,u-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Ce;break}for(;p--;)t.lens[t.have++]=x}}if(t.mode===Ce)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Ce;break}if(t.lenbits=9,P={bits:t.lenbits},O=Io(vg,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,O){r.msg="invalid literal/lengths set",t.mode=Ce;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},O=Io(bg,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,O){r.msg="invalid distances set",t.mode=Ce;break}if(t.mode=Ys,e===Zs)break e;case Ys:t.mode=Xs;case Xs:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,bS(r,d),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,t.mode===Cr&&(t.back=-1);break}for(t.back=0;g=t.lencode[l&(1<<t.lenbits)-1],_=g>>>24,w=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(w&&(w&240)===0){for(b=_,A=w,T=y;g=t.lencode[T+((l&(1<<b+A)-1)>>b)],_=g>>>24,w=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,t.back+=b}if(l>>>=_,u-=_,t.back+=_,t.length=y,w===0){t.mode=im;break}if(w&32){t.back=-1,t.mode=Cr;break}if(w&64){r.msg="invalid literal/length code",t.mode=Ce;break}t.extra=w&15,t.mode=Xh;case Xh:if(t.extra){for(U=t.extra;u<U;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=em;case em:for(;g=t.distcode[l&(1<<t.distbits)-1],_=g>>>24,w=g>>>16&255,y=g&65535,!(_<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((w&240)===0){for(b=_,A=w,T=y;g=t.distcode[T+((l&(1<<b+A)-1)>>b)],_=g>>>24,w=g>>>16&255,y=g&65535,!(b+_<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=b,u-=b,t.back+=b}if(l>>>=_,u-=_,t.back+=_,w&64){r.msg="invalid distance code",t.mode=Ce;break}t.offset=y,t.extra=w&15,t.mode=tm;case tm:if(t.extra){for(U=t.extra;u<U;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Ce;break}t.mode=rm;case rm:if(c===0)break e;if(p=d-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Ce;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Xs);break;case im:if(c===0)break e;n[o++]=t.length,c--,t.mode=Xs;break;case Du:if(t.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ze(t.check,n,d,o-d):Fo(t.check,n,d,o-d)),d=c,t.wrap&4&&(t.flags?l:om(l))!==t.check){r.msg="incorrect data check",t.mode=Ce;break}l=0,u=0}t.mode=nm;case nm:if(t.wrap&&t.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Ce;break}l=0,u=0}t.mode=am;case am:O=IS;break e;case Ce:O=wg;break e;case _g:return Sg;case xg:default:return Jt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,(t.wsize||d!==r.avail_out&&t.mode<Ce&&(t.mode<Du||e!==Fh))&&Tg(r,r.output,r.next_out,d-r.avail_out),f-=r.avail_in,d-=r.avail_out,r.total_in+=f,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ze(t.check,n,d,r.next_out-d):Fo(t.check,n,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Cr?128:0)+(t.mode===Ys||t.mode===Nu?256:0),(f===0&&d===0||e===Fh)&&O===dn&&(O=CS),O},MS=r=>{if(Sn(r))return Jt;let e=r.state;return e.window&&(e.window=null),r.state=null,dn},US=(r,e)=>{if(Sn(r))return Jt;let t=r.state;return(t.wrap&2)===0?Jt:(t.head=e,e.done=!1,dn)},jS=(r,e)=>{let t=e.length,i,n,a;return Sn(r)||(i=r.state,i.wrap!==0&&i.mode!==Oc)?Jt:i.mode===Oc&&(n=1,n=Fo(n,e,t,0),n!==i.check)?wg:(a=Tg(r,e,t,t),a?(i.mode=_g,Sg):(i.havedict=1,dn))},qS=Ag,BS=kg,VS=Eg,QS=NS,HS=Ig,zS=FS,WS=MS,GS=US,KS=jS,JS="pako inflate (from Nodeca project)",Lr={inflateReset:qS,inflateReset2:BS,inflateResetKeep:VS,inflateInit:QS,inflateInit2:HS,inflate:zS,inflateEnd:WS,inflateGetHeader:GS,inflateSetDictionary:KS,inflateInfo:JS};function ZS(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var YS=ZS,Cg=Object.prototype.toString,{Z_NO_FLUSH:XS,Z_FINISH:e1,Z_OK:jo,Z_STREAM_END:Uu,Z_NEED_DICT:ju,Z_STREAM_ERROR:t1,Z_DATA_ERROR:cm,Z_MEM_ERROR:r1}=wn;function Go(r){this.options=Wc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new gg,this.strm.avail_out=0;let t=Lr.inflateInit2(this.strm,e.windowBits);if(t!==jo)throw new Error(un[t]);if(this.header=new YS,Lr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Uo.string2buf(e.dictionary):Cg.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Lr.inflateSetDictionary(this.strm,e.dictionary),t!==jo)))throw new Error(un[t])}Go.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?e1:XS,Cg.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Lr.inflate(t,o),a===ju&&n&&(a=Lr.inflateSetDictionary(t,n),a===jo?a=Lr.inflate(t,o):a===cm&&(a=ju));t.avail_in>0&&a===Uu&&t.state.wrap>0&&r[t.next_in]!==0;)Lr.inflateReset(t),a=Lr.inflate(t,o);switch(a){case t1:case cm:case ju:case r1:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Uu))if(this.options.to==="string"){let c=Uo.utf8border(t.output,t.next_out),l=t.next_out-c,u=Uo.buf2string(t.output,c);t.next_out=l,t.avail_out=i-l,l&&t.output.set(t.output.subarray(c,c+l),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===jo&&s===0)){if(a===Uu)return a=Lr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Go.prototype.onData=function(r){this.chunks.push(r)};Go.prototype.onEnd=function(r){r===jo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Wc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ip(r,e){let t=new Go(e);if(t.push(r),t.err)throw t.msg||un[t.err];return t.result}function i1(r,e){return e=e||{},e.raw=!0,Ip(r,e)}var n1=Go,a1=Ip,o1=i1,s1=Ip,c1=wn,l1={Inflate:n1,inflate:a1,inflateRaw:o1,ungzip:s1,constants:c1},{Deflate:u1,deflate:p1,deflateRaw:d1,gzip:f1}=yS,{Inflate:h1,inflate:m1,inflateRaw:g1,ungzip:y1}=l1,v1=u1,b1=p1,w1=d1,S1=f1,_1=h1,x1=m1,E1=g1,A1=y1,k1=wn,I1={Deflate:v1,deflate:b1,deflateRaw:w1,gzip:S1,Inflate:_1,inflate:x1,inflateRaw:E1,ungzip:A1,constants:k1},Ee=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ae=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Rc=class{constructor(e,t){this.input=e,this.output=t}};Ee([S(),Ae("design:type",String)],Rc.prototype,"input",void 0);Ee([S(),Ae("design:type",String)],Rc.prototype,"output",void 0);Rc=Ee([Xe(),Ae("design:paramtypes",[String,String])],Rc);var Pc=class{constructor(e,t){this.input=e,this.output=t}};Ee([S(),Ae("design:type",String)],Pc.prototype,"input",void 0);Ee([S(),Ae("design:type",String)],Pc.prototype,"output",void 0);Pc=Ee([Y(),Ae("design:paramtypes",[String,String])],Pc);var bi=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Ee([S(),Ae("design:type",String)],bi.prototype,"name",void 0);Ee([S(),Ae("design:type",String)],bi.prototype,"modelId",void 0);Ee([S(),Ae("design:type",String)],bi.prototype,"systemPrompt",void 0);Ee([S(),Ae("design:type",Array)],bi.prototype,"promptExamples",void 0);Ee([S(),Ae("design:type",String)],bi.prototype,"metaData",void 0);bi=Ee([Xe(),Ae("design:paramtypes",[String,String,String,Array,String])],bi);var xr=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Ee([S(),Ae("design:type",String)],xr.prototype,"name",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"modelId",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"taskId",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"systemPrompt",void 0);Ee([S(),Ae("design:type",Array)],xr.prototype,"promptExamples",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"metaData",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"createdAt",void 0);Ee([S(),Ae("design:type",String)],xr.prototype,"updatedAt",void 0);xr=Ee([Y(),Ae("design:paramtypes",[String,String,String,String,Array,String,String,String])],xr);var fn=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Ee([S(),Ae("design:type",String)],fn.prototype,"model",void 0);Ee([S(),Ae("design:type",String)],fn.prototype,"status",void 0);Ee([S(),Ae("design:type",Number)],fn.prototype,"progress",void 0);Ee([S(),Ae("design:type",Boolean)],fn.prototype,"downloaded",void 0);Ee([S(),Ae("design:type",Boolean)],fn.prototype,"loaded",void 0);fn=Ee([Y(),Ae("design:paramtypes",[String,String,Number,Boolean,Boolean])],fn);var T1=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},We=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},He,fc,dp=class{constructor(e,t=!0){He.set(this,void 0),fc.set(this,new Map),T1(this,He,e,"f")}async getModels(){let e=await We(this,He,"f").query({query:E`
|
|
850
850
|
query {
|
|
851
851
|
aiGetModels {
|
|
852
852
|
id
|
|
@@ -870,23 +870,23 @@ triggerMatch
|
|
|
870
870
|
modelType
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
|
-
`});return
|
|
873
|
+
`});return I(e).aiGetModels}async addModel(e){let t=await We(this,He,"f").mutate({mutation:E`
|
|
874
874
|
mutation($model: ModelInput!) {
|
|
875
875
|
aiAddModel(model: $model)
|
|
876
876
|
}
|
|
877
|
-
`,variables:{model:e}});return
|
|
877
|
+
`,variables:{model:e}});return I(t).aiAddModel}async updateModel(e,t){let i=await We(this,He,"f").mutate({mutation:E`
|
|
878
878
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
879
879
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
880
880
|
}
|
|
881
|
-
`,variables:{modelId:e,model:t}});return
|
|
881
|
+
`,variables:{modelId:e,model:t}});return I(i).aiUpdateModel}async removeModel(e){let t=await We(this,He,"f").mutate({mutation:E`
|
|
882
882
|
mutation($modelId: String!) {
|
|
883
883
|
aiRemoveModel(modelId: $modelId)
|
|
884
884
|
}
|
|
885
|
-
`,variables:{modelId:e}});return
|
|
885
|
+
`,variables:{modelId:e}});return I(t).aiRemoveModel}async setDefaultModel(e,t){let i=await We(this,He,"f").mutate({mutation:E`
|
|
886
886
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
887
887
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
888
888
|
}
|
|
889
|
-
`,variables:{modelId:t,modelType:e}});return
|
|
889
|
+
`,variables:{modelId:t,modelType:e}});return I(i).aiSetDefaultModel}async getDefaultModel(e){let t=await We(this,He,"f").query({query:E`
|
|
890
890
|
query($modelType: ModelType!) {
|
|
891
891
|
aiGetDefaultModel(modelType: $modelType) {
|
|
892
892
|
id
|
|
@@ -910,7 +910,7 @@ triggerMatch
|
|
|
910
910
|
modelType
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
`,variables:{modelType:e}});return
|
|
913
|
+
`,variables:{modelType:e}});return I(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=I(await We(this,He,"f").query({query:E`
|
|
914
914
|
query {
|
|
915
915
|
aiTasks {
|
|
916
916
|
name
|
|
@@ -926,7 +926,7 @@ triggerMatch
|
|
|
926
926
|
updatedAt
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
`}));return e}async addTask(e,t,i,n,a){let o=new
|
|
929
|
+
`}));return e}async addTask(e,t,i,n,a){let o=new bi(e,t,i,n,a),{aiAddTask:s}=I(await We(this,He,"f").mutate({mutation:E`
|
|
930
930
|
mutation AiAddTask($task: AITaskInput!) {
|
|
931
931
|
aiAddTask(task: $task) {
|
|
932
932
|
name
|
|
@@ -942,7 +942,7 @@ triggerMatch
|
|
|
942
942
|
updatedAt
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=
|
|
945
|
+
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=I(await We(this,He,"f").mutate({mutation:E`
|
|
946
946
|
mutation AiRemoveTask($taskId: String!) {
|
|
947
947
|
aiRemoveTask(taskId: $taskId) {
|
|
948
948
|
name
|
|
@@ -958,7 +958,7 @@ triggerMatch
|
|
|
958
958
|
updatedAt
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
|
-
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:i}=
|
|
961
|
+
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:i}=I(await We(this,He,"f").mutate({mutation:E`
|
|
962
962
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
963
963
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
964
964
|
name
|
|
@@ -974,7 +974,7 @@ triggerMatch
|
|
|
974
974
|
updatedAt
|
|
975
975
|
}
|
|
976
976
|
}
|
|
977
|
-
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=
|
|
977
|
+
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=I(await We(this,He,"f").query({query:E`
|
|
978
978
|
query AiModelLoadingStatus($model: String!) {
|
|
979
979
|
aiModelLoadingStatus(model: $model) {
|
|
980
980
|
model
|
|
@@ -984,30 +984,30 @@ triggerMatch
|
|
|
984
984
|
downloaded
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
|
-
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:i}=
|
|
987
|
+
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:i}=I(await We(this,He,"f").mutate({mutation:E`
|
|
988
988
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
989
989
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
990
990
|
}
|
|
991
|
-
`,variables:{taskId:e,prompt:t}}));return i}async embed(e,t){let{aiEmbed:i}=
|
|
991
|
+
`,variables:{taskId:e,prompt:t}}));return i}async embed(e,t){let{aiEmbed:i}=I(await We(this,He,"f").mutate({mutation:E`
|
|
992
992
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
993
993
|
aiEmbed(modelId: $modelId, text: $text)
|
|
994
994
|
}
|
|
995
|
-
`,variables:{modelId:e,text:t}})),n=
|
|
995
|
+
`,variables:{modelId:e,text:t}})),n=Hc.toByteArray(i);return JSON.parse(I1.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i){let{aiOpenTranscriptionStream:n}=I(await We(this,He,"f").mutate({mutation:E`
|
|
996
996
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
997
997
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
998
998
|
}
|
|
999
|
-
`,variables:{modelId:e,params:i}})),a=We(this,He,"f").subscribe({query:
|
|
999
|
+
`,variables:{modelId:e,params:i}})),a=We(this,He,"f").subscribe({query:E` subscription {
|
|
1000
1000
|
aiTranscriptionText(streamId: "${n}")
|
|
1001
|
-
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return We(this,
|
|
1001
|
+
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return We(this,fc,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=I(await We(this,He,"f").mutate({mutation:E`
|
|
1002
1002
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
1003
1003
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
1004
1004
|
}
|
|
1005
|
-
`,variables:{streamId:e}})),i=We(this,
|
|
1005
|
+
`,variables:{streamId:e}})),i=We(this,fc,"f").get(e);return i.closed||i.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:i}=I(await We(this,He,"f").mutate({mutation:E`
|
|
1006
1006
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
1007
1007
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
1008
1008
|
}
|
|
1009
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};He=new WeakMap,
|
|
1010
|
-
${e.query}`);let i=new t(e.perspective,e.query,this.perspectiveClient);i.isSPARQL=!0,i.initialized&&typeof i.initialized.catch=="function"&&i.initialized.catch(()=>{});try{await i.subscribe(),await i.initialized}catch(a){let o=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${o}`);try{i.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),i.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let o=this.seenMessages.get(e.id)??new Set,s=[];for(let u of a)u&&u.source&&!o.has(u.source)&&s.push(u.source);if(s.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${s.length} new message(s) out of ${a.length} total`);let c=[];for(let u of s){let
|
|
1009
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};He=new WeakMap,fc=new WeakMap;var ii=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Qe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},hr,hc,bo,mc,wo,Ji,gc,So,qo=class{constructor(e,t=!0){hr.set(this,void 0),hc.set(this,void 0),bo.set(this,void 0),mc.set(this,void 0),wo.set(this,void 0),Ji.set(this,void 0),gc.set(this,void 0),So.set(this,void 0),ii(this,hr,e,"f"),ii(this,hc,new Ro(Qe(this,hr,"f"),t),"f"),ii(this,bo,new rp(Qe(this,hr,"f")),"f"),ii(this,mc,new Xu(Qe(this,hr,"f")),"f"),ii(this,wo,new ep(Qe(this,hr,"f")),"f"),ii(this,So,new dp(Qe(this,hr,"f"),t),"f"),ii(this,Ji,new Tc(Qe(this,hr,"f"),t),"f"),Qe(this,Ji,"f").setExpressionClient(Qe(this,bo,"f")),Qe(this,Ji,"f").setNeighbourhoodClient(Qe(this,wo,"f")),Qe(this,Ji,"f").setAIClient(Qe(this,So,"f")),ii(this,gc,new tp(Qe(this,hr,"f"),t),"f")}get agent(){return Qe(this,hc,"f")}get expression(){return Qe(this,bo,"f")}get languages(){return Qe(this,mc,"f")}get neighbourhood(){return Qe(this,wo,"f")}get perspective(){return Qe(this,Ji,"f")}get runtime(){return Qe(this,gc,"f")}get ai(){return Qe(this,So,"f")}};hr=new WeakMap,hc=new WeakMap,bo=new WeakMap,mc=new WeakMap,wo=new WeakMap,Ji=new WeakMap,gc=new WeakMap,So=new WeakMap;var fp;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(fp||(fp={}));var Tp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Cp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rn=class{constructor(e,t){this.language=e,this.expression=t}};Tp([S(),Cp("design:type",yr)],rn.prototype,"language",void 0);Tp([S(),Cp("design:type",String)],rn.prototype,"expression",void 0);rn=Tp([Y(),Cp("design:paramtypes",[yr,String])],rn);function j$(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function q$(r){if(r.startsWith("literal:")){let a=new yr;a.address="literal",a.name="literal";let o=r.substring(8);return new rn(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new yr;return s.address=a,new rn(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new yr;return a.address="did",new rn(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var jt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Er=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Lc=class{};jt([S(),Er("design:type",String)],Lc.prototype,"name",void 0);jt([S(),Er("design:type",String)],Lc.prototype,"type",void 0);Lc=jt([Y()],Lc);var Bo=class{};jt([S(),Er("design:type",String)],Bo.prototype,"label",void 0);jt([S(),Er("design:type",String)],Bo.prototype,"name",void 0);jt([S(),Er("design:type",Array)],Bo.prototype,"parameters",void 0);Bo=jt([Y()],Bo);var Nc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};jt([S(),Er("design:type",String)],Nc.prototype,"name",void 0);jt([S(),Er("design:type",String)],Nc.prototype,"parametersStringified",void 0);Nc=jt([Xe(),Er("design:paramtypes",[String,Object])],Nc);var Dc=class{};jt([S(),Er("design:type",String)],Dc.prototype,"did",void 0);jt([S(),Er("design:type",sn)],Dc.prototype,"status",void 0);Dc=jt([Y()],Dc);var _n=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},_a=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},wi=class{};_n([S(),_a("design:type",String)],wi.prototype,"name",void 0);_n([S(),_a("design:type",String)],wi.prototype,"address",void 0);_n([S(),_a("design:type",String)],wi.prototype,"settings",void 0);_n([S(),_a("design:type",an)],wi.prototype,"icon",void 0);_n([S(),_a("design:type",an)],wi.prototype,"constructorIcon",void 0);_n([S(),_a("design:type",an)],wi.prototype,"settingsIcon",void 0);wi=_n([Y()],wi);var bt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},$t=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},or=class{};bt([S(),$t("design:type",String)],or.prototype,"name",void 0);bt([S(),$t("design:type",String)],or.prototype,"address",void 0);bt([S(),$t("design:type",String)],or.prototype,"description",void 0);bt([S(),$t("design:type",String)],or.prototype,"author",void 0);bt([S(),$t("design:type",Boolean)],or.prototype,"templated",void 0);bt([S(),$t("design:type",String)],or.prototype,"templateSourceLanguageAddress",void 0);bt([S(),$t("design:type",String)],or.prototype,"templateAppliedParams",void 0);bt([S(),$t("design:type",Array)],or.prototype,"possibleTemplateParams",void 0);bt([S(),$t("design:type",String)],or.prototype,"sourceCodeLink",void 0);or=bt([Y()],or);var fa=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};bt([S(),$t("design:type",String)],fa.prototype,"name",void 0);bt([S(),$t("design:type",String)],fa.prototype,"description",void 0);bt([S(),$t("design:type",Array)],fa.prototype,"possibleTemplateParams",void 0);bt([S(),$t("design:type",String)],fa.prototype,"sourceCodeLink",void 0);fa=bt([Xe(),$t("design:paramtypes",[String,String])],fa);var lm=class{},um=class extends Ei(){},pm=class{},Kc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},$p=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Fc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Kc([S(),$p("design:type",String)],Fc.prototype,"linkLanguage",void 0);Kc([S(),$p("design:type",Sr)],Fc.prototype,"meta",void 0);Fc=Kc([Y(),$p("design:paramtypes",[String,Sr])],Fc);var hp=class extends Ei(){};hp=Kc([Y()],hp);var xn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},En=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mp;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(mp||(mp={}));var Si=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=mp.Private}};xn([S(),En("design:type",String)],Si.prototype,"uuid",void 0);xn([S(),En("design:type",String)],Si.prototype,"name",void 0);xn([S(),En("design:type",String)],Si.prototype,"state",void 0);xn([S(),En("design:type",String)],Si.prototype,"sharedUrl",void 0);xn([S(),En("design:type",hp)],Si.prototype,"neighbourhood",void 0);xn([S(),En("design:type",Array)],Si.prototype,"owners",void 0);Si=xn([Y(),En("design:paramtypes",[String,String,String])],Si);var dm=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SPARQL query:
|
|
1010
|
+
${e.query}`);let i=new t(e.perspective,e.query,this.perspectiveClient);i.isSPARQL=!0,i.initialized&&typeof i.initialized.catch=="function"&&i.initialized.catch(()=>{});try{await i.subscribe(),await i.initialized}catch(a){let o=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${o}`);try{i.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),i.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let o=this.seenMessages.get(e.id)??new Set,s=[];for(let u of a)u&&u.source&&!o.has(u.source)&&s.push(u.source);if(s.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${s.length} new message(s) out of ${a.length} total`);let c=[];for(let u of s){let f=[];try{let d=`SELECT ?source WHERE { ?source <ad4m://has_child> <${u}> . }`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let p=await this.perspectiveClient.querySparql(e.perspective,d);if(Array.isArray(p))for(let h of p)h&&h.source&&f.push(h.source)}catch(d){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${d?.message??d}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${f.length} parent(s): ${f.join(", ")}`),c.push({address:u,parents:f})}for(let u of s)o.add(u);this.seenMessages.set(e.id,o);let l=this.debounceTimers.get(e.id);l&&clearTimeout(l),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,c),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let o=this.debounceTimers.get(e.id);o&&clearTimeout(o),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,i),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let i=this.proxies.get(e);if(i){try{i.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,i]of this.seenMessages)e[t]=Array.from(i);this.onPersist(this.getActive(),e)}}},Jc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},$g=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Mc=class{};Jc([S(),$g("design:type",Array)],Mc.prototype,"additions",void 0);Jc([S(),$g("design:type",Array)],Mc.prototype,"removals",void 0);Mc=Jc([Y()],Mc);var fm=class extends Ei(){};fm=Jc([Y()],fm);var hm=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ra=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_o,Zi,ec="smart_literal://content";function C1(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var Vo=class{constructor(e,t){_o.set(this,void 0),Zi.set(this,void 0),hm(this,_o,e,"f"),hm(this,Zi,t,"f")}get base(){return ra(this,Zi,"f")}static async create(e,t){let i=xe.from(C1(10)).toUrl(),n=new Vo(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new J({source:t,predicate:ec}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new J({predicate:ec}))).map(i=>new Vo(e,i.data.source))}async get(){let e=await ra(this,_o,"f").getSingleTarget(new J({source:ra(this,Zi,"f"),predicate:ec}));if(!e)throw`No content for smart literal ${ra(this,Zi,"f")}`;return xe.fromUrl(e).get()}async set(e){let t=xe.from(e);await ra(this,_o,"f").setSingleTarget(new Tt({source:ra(this,Zi,"f"),predicate:ec,target:t.toUrl()}))}};_o=new WeakMap,Zi=new WeakMap;function aa(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,i=It(t);if(r.field){let n=i[r.field];if(!n)throw new Error(`parent(): field "${r.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(i))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function mm(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function gm(){return`
|
|
1011
1011
|
findall(
|
|
1012
1012
|
[T, A],
|
|
1013
1013
|
link(Base, _, _, T, A),
|
|
@@ -1015,28 +1015,37 @@ ${e.query}`);let i=new t(e.perspective,e.query,this.perspectiveClient);i.isSPARQ
|
|
|
1015
1015
|
),
|
|
1016
1016
|
sort(AllLinks, SortedLinks),
|
|
1017
1017
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1018
|
-
`}function
|
|
1018
|
+
`}function $1(r){return`
|
|
1019
1019
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1020
1020
|
% Constrain to specified properties if provided
|
|
1021
1021
|
${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1022
1022
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1023
1023
|
), Properties)
|
|
1024
|
-
`}function
|
|
1025
|
-
`)}function
|
|
1024
|
+
`}function ym(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=t==="id"?"Base":vt(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:l,lte:u,gt:f,gte:d}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:f,symbol:">"},{value:d,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function vm(r){return r?"length(UnsortedInstances, TotalCount)":""}function bm(r){if(!r)return"SortedInstances = UnsortedInstances";let e=Object.entries(r);if(e.length===1){let[i,n]=e[0];return`sort_instances(UnsortedInstances, "${i}", "${n}", SortedInstances)`}let t=[];for(let i=e.length-1;i>=0;i--){let[n,a]=e[i],o=i===e.length-1?"UnsortedInstances":`MultiSortIntermediate${i+1}`,s=i===0?"SortedInstances":`MultiSortIntermediate${i}`;t.push(`sort_instances(${o}, "${n}", "${a}", ${s})`)}return t.join(`,
|
|
1025
|
+
`)}function wm(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Sm(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function _m(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function Op(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function Og(r,e){return Op(r.type)===e}function Rg(r){return Og(r,"array")}function xm(r){return Og(r,"object")}function O1(r){let e=Op(r.type);return e==="number"||e==="integer"}function Pg(r,e){if(e.namespace)return e.namespace;if(r["x-ad4m"]?.namespace)return r["x-ad4m"].namespace;if(r.title)return`${r.title.toLowerCase()}://`;if(r.$id)try{let i=new URL(r.$id).pathname.split("/").filter(n=>n);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:
|
|
1026
1026
|
- options.namespace
|
|
1027
1027
|
- schema["x-ad4m"].namespace
|
|
1028
1028
|
- schema.title
|
|
1029
|
-
- valid schema.$id`)}function
|
|
1030
|
-
${
|
|
1031
|
-
?source ${
|
|
1032
|
-
?source ${
|
|
1033
|
-
?source ${
|
|
1034
|
-
?source ${
|
|
1035
|
-
{ SELECT DISTINCT ?source WHERE { ?source ?cf_structPred ?cf_structTarget . FILTER(?cf_structPred IN (${
|
|
1029
|
+
- valid schema.$id`)}function Lg(r,e,t,i,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let o=_m(i),[s,c]=o.includes("://")?o.split("://"):["",o],l=c||"";return n.predicateTemplate.replace("${namespace}",l).replace("${scheme}",s).replace("${ns}",l).replace("${title}",r.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(r.title||"",e);let a=_m(i);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function Za(r,e,t,i,n){return t.propertyOptions?.[r]?.[i]!==void 0?t.propertyOptions[r][i]:e["x-ad4m"]?.[i]!==void 0?e["x-ad4m"][i]:t[i]!==void 0?t[i]:n}function R1(r){switch(r){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function P1(r,e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let i=Pg(e,t),n=class extends r{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},o={};if(e.properties)for(let[c,l]of Object.entries(e.properties)){let u=Lg(e,c,l,i,t),f=e.required?.includes(c)||!1,d=Op(l.type);if(Rg(l)){o[c]={through:u,local:Za(c,l,t,"local")},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:[]});let h=`add${vt(c)}`,m=`remove${vt(c)}`,g=`set${vt(c)}`;n.prototype[h]=function(){},n.prototype[m]=function(){},n.prototype[g]=function(){}}else{let h=Za(c,l,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let m=Za(c,l,t,"local"),g=Za(c,l,t,"readOnly");if(g===void 0){let y=l["x-ad4m"]?.writable;g=y!==void 0?!y:!1}let _=!g,w=Za(c,l,t,"initial");if(xm(l)&&!h&&(h="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),h==null&&O1(l)&&(h="literal"),h==null&&(h="literal"),f&&!w&&(xm(l)?w="literal:json:{}":w="ad4m://undefined"),a[c]={through:u,required:f,writable:_,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...w&&{initial:w}},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:R1(d)}),_){let y=Bc(c);n.prototype[y]=function(){}}}}for(let[c,l]of Object.entries(a))u0(n,c,l);for(let[c,l]of Object.entries(o))p0(n,c,{predicate:l.through||"",kind:"hasMany",...l.getter!==void 0&&{getter:l.getter},...l.local!==void 0&&{local:l.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,d0({name:t.name})(n),n}function Uc(r,e,t){if(!t)return!1;for(let[i,n]of Object.entries(t)){if(i==="base"||i==="id")continue;if(i==="author"||i==="timestamp")return!0;let a=r.properties[i];if(!a)continue;let o=e[i];if(o&&(o.kind==="belongsToOne"||o.kind==="belongsToMany"))return!0;if(Ng(a)&&typeof n=="object"&&n!==null&&!Array.isArray(n)){let s=n;if(s.gt!==void 0||s.gte!==void 0||s.lt!==void 0||s.lte!==void 0||s.between!==void 0||s.contains!==void 0)return!0}}return!1}function Ng(r){return!(r.flag||r.resolveLanguage&&r.resolveLanguage!=="literal")}function L1(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function ni(r){return typeof r=="string"?`"${L1(r)}"`:`"${String(r)}"`}function Z(r){return`<${r}>`}function N1(r,e){let t=e.properties[r];if(t){if(t.required&&!t.getter&&!(t.flag&&t.initial))return`?cfTarget_${r}`;if(t.initial&&!t.flag)return`?cfInitTarget_${r}`}return`?wTarget_${r}`}function D1(r,e,t,i){let n=[],a=[];if(t.parent){let p=aa(t.parent,i);n.push(`
|
|
1030
|
+
${Z(t.parent.id)} ${Z(p)} ?source .`)}let o=!1;for(let[,p]of Object.entries(r.properties))if(p.required){if(p.getter)continue;o=!0,p.flag&&p.initial?n.push(`
|
|
1031
|
+
?source ${Z(p.predicate)} ${Z(p.initial)} .`):n.push(`
|
|
1032
|
+
?source ${Z(p.predicate)} ?cfTarget_${p.name} .`)}if(!o){for(let[,p]of Object.entries(r.properties))if(p.initial){o=!0,p.flag?n.push(`
|
|
1033
|
+
?source ${Z(p.predicate)} ${Z(p.initial)} .`):n.push(`
|
|
1034
|
+
?source ${Z(p.predicate)} ?cfInitTarget_${p.name} .`);break}}if(!o&&n.length===0){let p=[];for(let[,h]of Object.entries(r.properties))h.predicate&&p.push(Z(h.predicate));if(r.relations)for(let[,h]of Object.entries(r.relations))h.predicate&&p.push(Z(h.predicate));p.length>0&&n.push(`
|
|
1035
|
+
{ SELECT DISTINCT ?source WHERE { ?source ?cf_structPred ?cf_structTarget . FILTER(?cf_structPred IN (${p.join(", ")})) } }`)}let{joins:s,filters:c}=Rp(r,e,t.where);n.push(...s),a.push(...c);let l=n.join(`
|
|
1036
1036
|
`),u=a.length>0?`FILTER(
|
|
1037
1037
|
${a.join(` &&
|
|
1038
1038
|
`)}
|
|
1039
|
-
)`:"";return
|
|
1039
|
+
)`:"",d=!Uc(r,e,t.where)&&(t.limit!==void 0||t.offset!==void 0)&&t.order!==void 0&&Object.keys(t.order).length>0?M1(n,a,r,t):"";return d?`
|
|
1040
|
+
SELECT ?source ?predicate ?target ?author ?timestamp WHERE {
|
|
1041
|
+
${d}${l}
|
|
1042
|
+
GRAPH ?linkGraph { ?source ?predicate ?target . }
|
|
1043
|
+
FILTER(isIRI(?source) && isIRI(?predicate))
|
|
1044
|
+
?linkGraph <ad4m://ontology/author> ?author .
|
|
1045
|
+
?linkGraph <ad4m://ontology/timestamp> ?timestamp .
|
|
1046
|
+
${u}
|
|
1047
|
+
}
|
|
1048
|
+
`.trim():`
|
|
1040
1049
|
SELECT ?source ?predicate ?target ?author ?timestamp WHERE {${l}
|
|
1041
1050
|
GRAPH ?linkGraph { ?source ?predicate ?target . }
|
|
1042
1051
|
FILTER(isIRI(?source) && isIRI(?predicate))
|
|
@@ -1044,51 +1053,103 @@ ${e.query}`);let i=new t(e.perspective,e.query,this.perspectiveClient);i.isSPARQ
|
|
|
1044
1053
|
?linkGraph <ad4m://ontology/timestamp> ?timestamp .
|
|
1045
1054
|
${u}
|
|
1046
1055
|
}
|
|
1047
|
-
${
|
|
1048
|
-
`.trim()}function
|
|
1056
|
+
${F1()}
|
|
1057
|
+
`.trim()}function F1(r,e){return""}function M1(r,e,t,i){let n=r.join(`
|
|
1058
|
+
`),a=e.length>0?`FILTER(
|
|
1059
|
+
${e.join(` &&
|
|
1060
|
+
`)}
|
|
1061
|
+
)`:"",o="",s=[],c=[],l=i.order&&Object.keys(i.order).length>0;if(i.order){let h=0,m=Object.entries(i.order).map(([g,_])=>{let w=N1(g,t);if(!n.includes(w)){let A=t.properties[g];A&&A.predicate&&!A.getter&&s.push(`
|
|
1062
|
+
OPTIONAL { ?source <${A.predicate}> ${w} . }`)}let b=`?pg_sort_${h++}`;return c.push(`(SAMPLE(${w}) AS ${b})`),_==="DESC"?`DESC(${b})`:`ASC(${b})`});m.length>0&&(o=`ORDER BY ${m.join(" ")}`)}let u=i.limit!==void 0?`LIMIT ${i.limit}`:"",f=i.offset!==void 0&&i.offset>0?`OFFSET ${i.offset}`:"",d=c.length>0?" "+c.join(" "):"",p=l?"GROUP BY ?source":"";return`
|
|
1063
|
+
{ SELECT DISTINCT ?source${d} WHERE {${n}${s.join("")}
|
|
1064
|
+
FILTER(isIRI(?source))
|
|
1065
|
+
${a}
|
|
1066
|
+
} ${p} ${o} ${u} ${f} }
|
|
1067
|
+
`}function Em(r,e,t,i){let n=[],a=[];if(t.parent){let f=aa(t.parent,i);n.push(`
|
|
1068
|
+
${Z(t.parent.id)} ${Z(f)} ?source .`)}let o=!1;for(let[,f]of Object.entries(r.properties))if(f.required){if(f.getter)continue;o=!0,f.flag&&f.initial?n.push(`
|
|
1069
|
+
?source ${Z(f.predicate)} ${Z(f.initial)} .`):n.push(`
|
|
1070
|
+
?source ${Z(f.predicate)} ?cfTarget_${f.name} .`)}if(!o){for(let[,f]of Object.entries(r.properties))if(f.initial){o=!0,f.flag?n.push(`
|
|
1071
|
+
?source ${Z(f.predicate)} ${Z(f.initial)} .`):n.push(`
|
|
1072
|
+
?source ${Z(f.predicate)} ?cfInitTarget_${f.name} .`);break}}if(!o&&n.length===0){let f=[];for(let[,d]of Object.entries(r.properties))d.predicate&&f.push(Z(d.predicate));if(r.relations)for(let[,d]of Object.entries(r.relations))d.predicate&&f.push(Z(d.predicate));f.length>0&&n.push(`
|
|
1073
|
+
{ SELECT DISTINCT ?source WHERE { ?source ?cf_structPred ?cf_structTarget . FILTER(?cf_structPred IN (${f.join(", ")})) } }`)}let{joins:s,filters:c}=Rp(r,e,t.where);n.push(...s),a.push(...c);let l=n.join(`
|
|
1074
|
+
`),u=a.length>0?`FILTER(
|
|
1075
|
+
${a.join(` &&
|
|
1076
|
+
`)}
|
|
1077
|
+
)`:"";return`
|
|
1078
|
+
SELECT (COUNT(DISTINCT ?source) AS ?count) WHERE {${l}
|
|
1079
|
+
FILTER(isIRI(?source))
|
|
1080
|
+
${u}
|
|
1081
|
+
}
|
|
1082
|
+
`.trim()}function U1(r){return`
|
|
1049
1083
|
SELECT ?source ?predicate ?target ?author ?timestamp WHERE {
|
|
1050
|
-
GRAPH ?linkGraph { ${
|
|
1084
|
+
GRAPH ?linkGraph { ${Z(r)} ?predicate ?target . }
|
|
1051
1085
|
FILTER(isIRI(?predicate))
|
|
1052
|
-
BIND(${
|
|
1086
|
+
BIND(${Z(r)} AS ?source)
|
|
1053
1087
|
?linkGraph <ad4m://ontology/author> ?author .
|
|
1054
1088
|
?linkGraph <ad4m://ontology/timestamp> ?timestamp .
|
|
1055
1089
|
}
|
|
1056
|
-
`.trim()}function
|
|
1057
|
-
?source ${
|
|
1058
|
-
?source ${
|
|
1059
|
-
?source ${
|
|
1090
|
+
`.trim()}function xo(r){let e=new Map;for(let t of r){let i=t.source;e.has(i)||e.set(i,[]),e.get(i).push({predicate:t.predicate,target:t.target,author:t.author,timestamp:t.timestamp})}return Array.from(e.entries()).map(([t,i])=>({source_uri:t,links:i}))}function Rp(r,e,t){if(!t)return{joins:[],filters:[]};let i=[],n=[];for(let[a,o]of Object.entries(t)){if(a==="base"||a==="id"){if(Array.isArray(o)){let u=o.map(f=>Z(f)).join(", ");n.push(`?source IN (${u})`)}else if(typeof o=="object"&&o!==null){let u=o;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(d=>Z(d)).join(", ");n.push(`!(?source IN (${f}))`)}else n.push(`?source != ${Z(u.not)}`)}else n.push(`?source = ${Z(String(o))}`);continue}if(a==="author"){if(Array.isArray(o)){let u=o.map(f=>ni(String(f))).join(", ");n.push(`STR(?author) IN (${u})`)}else if(typeof o=="object"&&o!==null){let u=o;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(d=>ni(String(d))).join(", ");n.push(`!(STR(?author) IN (${f}))`)}else n.push(`STR(?author) != ${ni(String(u.not))}`)}else n.push(`STR(?author) = ${ni(String(o))}`);continue}if(a==="timestamp"){if(typeof o=="object"&&o!==null&&!Array.isArray(o)){let u=o;u.gt!==void 0&&n.push(`?timestamp > ${Number(u.gt)}`),u.gte!==void 0&&n.push(`?timestamp >= ${Number(u.gte)}`),u.lt!==void 0&&n.push(`?timestamp < ${Number(u.lt)}`),u.lte!==void 0&&n.push(`?timestamp <= ${Number(u.lte)}`),u.between!==void 0&&Array.isArray(u.between)&&n.push(`?timestamp >= ${Number(u.between[0])} && ?timestamp <= ${Number(u.between[1])}`),u.not!==void 0&&n.push(`?timestamp != ${Number(u.not)}`)}else(typeof o=="number"||typeof o=="string"&&!isNaN(Number(o)))&&n.push(`?timestamp = ${Number(o)}`);continue}let s=r.properties[a];if(!s)continue;let c=e[a];if(c&&(c.kind==="belongsToOne"||c.kind==="belongsToMany"))continue;if(Ng(s))if(typeof o=="object"&&o!==null&&!Array.isArray(o)){let u=o;if((u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`
|
|
1091
|
+
?source ${Z(s.predicate)} ?wTarget_cmp_${a} .`),u.not!==void 0)if(i.push(`
|
|
1092
|
+
?source ${Z(s.predicate)} ?wTarget_${a} .`),Array.isArray(u.not)){let d=u.not.map(p=>ni(p)).join(", ");n.push(`STR(<ad4m://fn/parse_literal>(?wTarget_${a})) NOT IN (${d})`)}else n.push(`STR(<ad4m://fn/parse_literal>(?wTarget_${a})) != ${ni(u.not)}`)}else if(Array.isArray(o)){i.push(`
|
|
1093
|
+
?source ${Z(s.predicate)} ?wTarget_${a} .`);let u=o.map(f=>ni(f)).join(", ");n.push(`STR(<ad4m://fn/parse_literal>(?wTarget_${a})) IN (${u})`)}else i.push(`
|
|
1094
|
+
?source ${Z(s.predicate)} ?wTarget_${a} .`),n.push(`STR(<ad4m://fn/parse_literal>(?wTarget_${a})) = ${ni(o)}`);else if(Array.isArray(o)){let u=o.map(f=>Z(f)).join(", ");i.push(`
|
|
1095
|
+
?source ${Z(s.predicate)} ?wTarget_${a} .`),n.push(`?wTarget_${a} IN (${u})`)}else if(typeof o=="object"&&o!==null){let u=o;if(u.not!==void 0)if(Array.isArray(u.not)){let d=u.not.map(p=>Z(p)).join(", ");n.push(`
|
|
1060
1096
|
NOT EXISTS {
|
|
1061
|
-
?source ${
|
|
1062
|
-
FILTER(?wTarget_not_${a} IN (${
|
|
1097
|
+
?source ${Z(s.predicate)} ?wTarget_not_${a} .
|
|
1098
|
+
FILTER(?wTarget_not_${a} IN (${d}))
|
|
1063
1099
|
}
|
|
1064
1100
|
`)}else n.push(`
|
|
1065
1101
|
NOT EXISTS {
|
|
1066
|
-
?source ${
|
|
1102
|
+
?source ${Z(s.predicate)} ${Z(u.not)} .
|
|
1067
1103
|
}
|
|
1068
1104
|
`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`
|
|
1069
|
-
?source ${
|
|
1070
|
-
?source ${_e(s.predicate)} ${_e(String(o))} .`)}return{joins:i,filters:n}}var dn=new Map;function L1(r,e){return`${r}::${e}`}async function N1(r,e,t,i){let n=r.uuid||r.handle?.uuid||"",a=L1(n,e),o=dn.get(a),s={onResult:i,hydrate:t};if(o){o.callbacks.add(s),o.refCount++;let d;return o.latestHydrated!==void 0?d=o.latestHydrated:o.latestRaw!==void 0&&(d=await t(o.latestRaw)),{initialResult:d,dispose:()=>bm(a,s)}}let c=await r.subscribeQuery(e),l={subscription:c,callbacks:new Set([s]),latestRaw:c.result,latestHydrated:void 0,hydrating:!1,refCount:1};dn.set(a,l),c.onResult(async d=>{l.latestRaw=d,l.hydrating=!0;try{let f=l.callbacks.values().next().value;if(f){let p=await f.hydrate(d);l.latestHydrated=p;for(let h of l.callbacks)try{h.onResult(p)}catch{}}}finally{l.hydrating=!1}});let u=await t(c.result);return l.latestHydrated=u,{initialResult:u,dispose:()=>bm(a,s)}}function bm(r,e){let t=dn.get(r);!t||(t.callbacks.delete(e),t.refCount--,t.refCount<=0&&(t.subscription?.dispose&&t.subscription.dispose(),dn.delete(r)))}function WO(){for(let r of dn.values())r.subscription?.dispose&&r.subscription.dispose();dn.clear()}function GO(){return dn.size}var dp=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.engineFlag="sparql",this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}parent(e,t,i){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let o=e.constructor;return this.queryParams.parent={id:n,model:o,field:t.field},this}let a=i?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}engine(e){return this.engineFlag=e,this}async get(){let e;if(this.engineFlag==="sparql")e=await this.executeSparqlQuery();else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),i=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,i))}return e}async getSparql(){return this.executeSparqlQuery()}async executeSparqlQuery(){let e=await this.ctor.queryToSPARQL(this.perspective,this.queryParams),t=await this.perspective.querySparql(e),{results:i}=await this.processSparqlResult(t);return i}async processSparqlResult(e,t){let i=So(Array.isArray(e)?e:[]);return await this.ctor.instancesFromQueryResult(this.perspective,t||this.queryParams,i)}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.engineFlag==="sparql"){let i=await t.queryToSPARQL(this.perspective,this.queryParams),n=null,a=l=>{if(l.length===0)return"0:";let u=l.map(f=>f.id||"").sort().join(","),d=l.map(f=>f.updatedAt||f.timestamp||"").join(",");return`${l.length}:${u}:${d}`},o=async l=>{let{results:u}=await this.processSparqlResult(l);return u},s=await N1(this.perspective,i,o,l=>{let u=a(l);u!==n&&(n=u,e(l))});this.currentSubscription={dispose:s.dispose};let c=s.initialResult;return n=a(c),c}else{let i=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(i);let n=async o=>{let{results:s}=await t.instancesFromPrologResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return a}}async subscribeSparql(e){this.dispose();let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{results:o}=await this.processSparqlResult(a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.processSparqlResult(this.currentSubscription.result);return n}async count(){if(this.engineFlag==="sparql"){let e=await this.ctor.queryToSPARQL(this.perspective,this.queryParams),t=await this.perspective.querySparql(e),{totalCount:i}=await this.processSparqlResult(t);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSparql(){let e=this.engineFlag;this.engineFlag="sparql";try{return await this.count()}finally{this.engineFlag=e}}async countSubscribe(e){if(this.dispose(),this.engineFlag==="sparql"){let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{totalCount:o}=await this.processSparqlResult(a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.processSparqlResult(this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let o=a?.[0]?.TotalCount||0;e(o)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async countSubscribeSparql(e){this.dispose();let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{totalCount:o}=await this.processSparqlResult(a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.processSparqlResult(this.currentSubscription.result);return n}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.engineFlag==="sparql"){let n=await this.ctor.queryToSPARQL(this.perspective,i),a=await this.perspective.querySparql(n),{results:o,totalCount:s}=await this.processSparqlResult(a,i);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSparql(e,t){let i=this.engineFlag;this.engineFlag="sparql";try{return await this.paginate(e,t)}finally{this.engineFlag=i}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.engineFlag==="sparql"){let a=await this.ctor.queryToSPARQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeQuery(a);let o=async u=>{let{results:d,totalCount:f}=await this.processSparqlResult(u,n);i({results:d,totalCount:f,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.processSparqlResult(this.currentSubscription.result,n);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:d,totalCount:f}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:d,totalCount:f,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}async paginateSubscribeSparql(e,t,i){let n=this.engineFlag;this.engineFlag="sparql";try{return await this.paginateSubscribe(e,t,i)}finally{this.engineFlag=n}}};function Xs(r){return Array.isArray(r)?r.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):r}function Uu(r,e){if(Array.isArray(e))return e.includes(r);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(r):r!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return r>=t.between[0]&&r<=t.between[1];let i=!0;return t.gt!==void 0&&(i=i&&r>t.gt),t.gte!==void 0&&(i=i&&r>=t.gte),t.lt!==void 0&&(i=i&&r<t.lt),t.lte!==void 0&&(i=i&&r<=t.lte),t.contains!==void 0&&(typeof r=="string"?i=i&&r.includes(String(t.contains)):Array.isArray(r)?i=i&&r.includes(t.contains):i=!1),i}return r===e}async function D1(r,e,t,i){let n=r;if(r!=null&&r!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof r=="string"&&!r.startsWith("literal:"))try{let a=await t.getExpression(r);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof r=="string"&&r.startsWith("literal:"))try{let a=xe.fromUrl(r).get();n=a.data!==void 0?a.data:a}catch{}else typeof r=="string"&&i&&(i==="number"?n=Number(r):i==="boolean"&&(n=r==="true"||r==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function wm(r,e,t,i,n){if(!e||e.length===0)return;let a=null,o=null,s=null,c=n&&n.length>0?new Set(n):null,l=new Map;for(let[h,m]of Object.entries(t.properties))m.getter||c&&!c.has(h)||l.set(m.predicate,[h,m]);let u=new Map,d=[];for(let[h,m]of Object.entries(t.relations))if(!m.getter){if(m.target&&m.filter!==!1){d.push([h,m]);continue}u.set(m.predicate,[h,m])}for(let[h,m]of d)u.has(m.predicate)||u.set(m.predicate,[h,m]);let f=new Map,p=new Map;for(let h=0;h<e.length;h++){let m=e[h],{predicate:y,target:b,author:_,timestamp:S}=m;if(b==="None"||b===void 0||b===null)continue;S!=null&&((a==null||S<a)&&(a=S,s=_??null),(o==null||S>o)&&(o=S));let v=l.get(y);if(v){f.get(v[0]),f.set(v[0],{target:b,timestamp:S});continue}let C=u.get(y);if(C){let[$]=C,I=p.get($);I||(I=[],p.set($,I)),I.push({target:b,timestamp:S??"",index:h})}}for(let[h,{target:m}]of f){let[,y]=l.get(t.properties[h].predicate),b=typeof r[h];r[h]=await D1(m,y,i,b!=="undefined"?b:void 0)}for(let[h,m]of p)m.sort((y,b)=>{let _=String(y.timestamp).localeCompare(String(b.timestamp));return _!==0?_:y.index-b.index}),r[h]=m.map(y=>y.target).filter(y=>y!=null&&y!==""&&y!=="None");s&&(r.author=s),a!=null&&(r.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),o!=null&&(r.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}async function F1(r,e,t){let i=Object.fromEntries(await Promise.all(t.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let d=Array.from(o,h=>h.codePointAt(0)),f=d.every(h=>h<=255),p=d.some(h=>h>=128);if(f&&p)try{let h=Uint8Array.from(d),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==o&&(c=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:h})}}if(s){let d=await r.getExpression(o);if(d)try{c=JSON.parse(d.data)}catch{c=d.data}}let u=sn(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(c=u(c)),[a,c]}))),n=Object.fromEntries(Object.entries(i).filter(([a])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(e,n)}function M1(r,e){let t=Um(r,e);if(!t){let i=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${i}".`);return}return t.getter}async function Sm(r,e,t,i){`${r.id}`;let a=i?.requestedProperties&&i.requestedProperties.length>0?new Set(i.requestedProperties):null;for(let[o,s]of Object.entries(t.properties))if(!(a&&!a.has(o))&&s.getter)try{let c=s.getter,l=c.replace(/\?source\b/g,`<${r.id}>`).replace(/<Base>/g,`<${r.id}>`).replace(/Base/g,`<${r.id}>`),u=l.trim().toUpperCase();if(u.startsWith("SELECT")||u.startsWith("ASK")||u.startsWith("CONSTRUCT")){let d=await e.querySparql(l);if(u.startsWith("ASK"))r[o]=d===!0||d==="true";else if(d&&d.length>0){let f=d[0],p=Object.keys(f)[0],h=f[p]?.value??f[p];h!=null&&h!=="None"&&h!==""&&(r[o]=h)}}else console.warn(`Unsupported legacy getter syntax for property ${o} \u2014 use native SPARQL (SELECT/ASK): ${c.slice(0,100)}`)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,s]of Object.entries(t.relations)){if(a&&!a.has(o)&&!(i?.include&&o in i.include))continue;let c=s,l=c.getter;if(!l&&c.where&&c.direction!=="reverse")try{let d=c.target?.(),f=d?d.getModelMetadata?.()??null:null,p=!0;if(f)for(let h of Object.keys(c.where)){if(["id","author","timestamp"].includes(h))continue;let m=f.properties[h];if(m&&(!m.resolveLanguage||m.resolveLanguage==="literal")){p=!1;break}}else p=!1;if(p){let h=Mm(c.where,f);h.length>0&&(l=`SELECT ?target WHERE { <Base> <${Lr(c.predicate)}> ?target . ${h.join(" ")} }`)}}catch(d){console.warn(`[Ad4mModel] where-clause compilation failed for relation "${o}":`,d)}if(!l&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let d=c.target();l=M1(c.predicate,d),l||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(d){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,d)}if(l)try{let d=l.replace(/\?source\b/g,`<${r.id}>`).replace(/<Base>/g,`<${r.id}>`).replace(/\bBase\b/g,`<${r.id}>`),f=d.trim().toUpperCase();if(f.startsWith("SELECT")||f.startsWith("ASK")||f.startsWith("CONSTRUCT")){let p=await e.querySparql(d);if(p&&p.length>0){let h=p.map(m=>{let y=Object.keys(m)[0];return m[y]?.value??m[y]}).filter(m=>m!=null&&m!==""&&m!=="None");r[o]=h}}else console.warn(`Unsupported legacy getter syntax for relation ${o} \u2014 use native SPARQL (SELECT/ASK): ${l.slice(0,100)}`)}catch(d){console.warn(`Failed to evaluate getter for ${o}:`,d)}let u=r[o];if(c.where&&Array.isArray(u)&&u.length>0){let d=c.target?.();if(d){let f=[];for(let p of u)try{let h=new d(e,p);await h.get();let m=!0;for(let[y,b]of Object.entries(c.where))if(h[y]!==b){m=!1;break}m&&f.push(p)}catch{f.push(p)}r[o]=f}}}}async function Ao(r,e,t,i){if(!i||Object.keys(i).length===0)return;let n=hr(r);for(let[a,o]of Object.entries(i)){let s=n[a];if(!s){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=s.target(),l=typeof o=="object"&&o!==null?o:void 0,u=l?.include;if(s.kind==="belongsToOne"||s.kind==="belongsToMany"){for(let b of e){let S=(await t.get(new K({predicate:s.predicate,target:b.id}))).filter(v=>v.data.target===b.id).map(v=>v.data.source);if(s.kind==="belongsToOne"){if(S.length===0){b[a]=null;continue}let v=S[S.length-1];try{let C=new c(t,v);await C.get(),b[a]=C}catch{b[a]=null}}else{let v=[];if(l&&(l.where||l.order||l.properties)){let C={id:S,...l.where??{}};v=await c.findAll(t,{where:C,...l.order&&{order:l.order},...l.properties&&{properties:l.properties}})}else await Promise.all(S.map(async C=>{try{let $=new c(t,C);await $.get(l?.properties?{properties:l.properties}:void 0),v.push($)}catch{}}));if(l?.order&&!(l.where||l.properties)){let C=Object.entries(l.order);v=v.sort(($,I)=>{for(let[L,M]of C){let N=String($[L]??""),W=String(I[L]??""),Ie=N.localeCompare(W);if(Ie!==0)return M==="DESC"?-Ie:Ie}return 0})}if(l?.offset!=null||l?.limit!=null){let C=l.offset??0,$=l.limit!=null?C+l.limit:void 0;v=v.slice(C,$)}b[a]=v,u&&v.length>0&&await Ao(c,v,t,u)}}continue}let d=new Set,f=new Map;for(let b of e){let _=b[a];if(f.set(b,Array.isArray(_)?[..._]:_),_!=null)if(Array.isArray(_))for(let S of _)typeof S=="string"?d.add(S):S&&typeof S=="object"&&typeof S.id=="string"&&d.add(S.id);else typeof _=="string"?d.add(_):_&&typeof _=="object"&&typeof _.id=="string"&&d.add(_.id)}if(d.size===0)continue;let p=new Map,m={where:{id:Array.from(d),...l?.where??{}},...l?.order&&{order:l.order},...l?.properties&&{properties:l.properties}},y=await c.findAll(t,m);for(let b of y)p.set(b.id,b);for(let b of e){let _=f.get(b);if(_!=null)if(Array.isArray(_)){let S=_.map(v=>typeof v=="string"?p.has(v)?p.get(v):null:v&&typeof v=="object"&&typeof v.id=="string"?p.has(v.id)?p.get(v.id):v:null).filter(v=>v!==null);if(l?.order){let v=Object.entries(l.order);S=S.sort((C,$)=>{for(let[I,L]of v){let M=String(C[I]??""),N=String($[I]??""),W=M.localeCompare(N);if(W!==0)return L==="DESC"?-W:W}return 0})}if(l?.offset!=null||l?.limit!=null){let v=l.offset??0,C=l.limit!=null?v+l.limit:void 0;S=S.slice(v,C)}s.maxCount===1?(S.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${S.length} values found; keeping the last`),b[a]=S.length>0?S[S.length-1]:null):b[a]=S}else typeof _=="string"&&p.has(_)?b[a]=p.get(_):_&&typeof _=="object"&&typeof _.id=="string"&&(b[a]=p.has(_.id)?p.get(_.id):_)}if(u){let b=Array.from(p.values());await Ao(c,b,t,u)}}}var da=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===da)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,i={},n=sn(this);for(let[d,f]of Object.entries(n)){let p=f;i[d]={name:d,predicate:p.through||"",required:p.required||!1,readOnly:!(p.writable??!1),...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=hr(this),s=Object.fromEntries(Object.entries(o).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let[d,f]of Object.entries(s)){let p=f;a[d]={name:d,predicate:p.predicate||"",...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter},direction:p.kind==="belongsToMany"||p.kind==="belongsToOne"?"reverse":"forward",...p.target!==void 0&&{target:p.target},...p.filter!==void 0&&{filter:p.filter},...p.where!==void 0&&{where:p.where}}}let c=Object.keys(i).length>0,l=Object.keys(a).length>0;if(!(c||l)&&e.__jsonSchema){let d=e.__jsonSchema,f=e.__jsonSchemaOptions||{};if(d.properties)for(let[p,h]of Object.entries(d.properties)){let m=Ig(h),y=Cg(d,p,h,Tg(d,f),f);if(m)a[p]={name:p,predicate:y,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let b=d.required?.includes(p)||!1;i[p]={name:p,predicate:y,required:b,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:i,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||xe.from(Dm(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return sn(t)[e]}getRelationOptions(e){let t=this.constructor;return hr(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateRelationAction(e,t){let i=this.getRelationOptions(e);if(!i)throw new Error(`Relation "${e}" has no metadata defined`);if(!i.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.predicate,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){return F1(e,t,i)}takeSnapshot(e){let i=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(i.properties)){let o=this[a];n[a]=Xs(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(i.relations)){let o=this[a];n[a]=Xs(Array.isArray(o)?[...o]:o)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in i.relations){let o=this[a];n[a]=Xs(Array.isArray(o)?[...o]:o)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let i=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let o=Xs(this[a]),s=this._snapshot[a];if(Array.isArray(o)||Array.isArray(s)){let c=Array.isArray(o)?[...o].sort():[],l=Array.isArray(s)?[...s].sort():[];(c.length!==l.length||c.some((u,d)=>u!==l[d]))&&i.push(a)}else o!==s&&i.push(a)}return i}async getData(e){try{let t=this.constructor,i=t.getModelMetadata(),n=P1(this._baseExpression),a=await this._perspective.querySparql(n);if(a&&a.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await wm(this,a,i,this._perspective,l)}let o=hr(t),s=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,u]of Object.entries(o)){if(u.kind!=="belongsToOne"&&u.kind!=="belongsToMany"||s&&!s.has(l))continue;let f=(await this._perspective.get(new K({predicate:u.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);u.kind==="belongsToOne"?this[l]=f.length>0?f[f.length-1]:null:this[l]=f}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Sm(this,this._perspective,i,c),e?.include&&await Ao(t,[this],this._perspective,e.include)}catch(t){console.error(`SPARQL getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,i){let{properties:n,where:a,order:o,offset:s,limit:c,count:l}=t,u=i||await this.getClassName(e),d=t.parent?wo(t.parent,this):void 0,f=[pm(),um(t.parent,d),E1(n),dm(a)],p=[fm(l),hm(o),mm(s),gm(c)];return`
|
|
1105
|
+
?source ${Z(s.predicate)} ?wTarget_cmp_${a} .`)}else i.push(`
|
|
1106
|
+
?source ${Z(s.predicate)} ${Z(String(o))} .`)}return{joins:i,filters:n}}function gp(r){if(!Array.isArray(r)||r.length===0)return null;let e=r[0],t=e.count?.value??e.count;if(t==null)return null;let i=typeof t=="number"?t:parseInt(String(t),10);return isNaN(i)?null:i}function j1(r,e,t,i,n){let a=[],o=[];a.push(`
|
|
1107
|
+
?parent ${Z(t)} ?source .`);let s=i.map(p=>Z(p)).join(", ");o.push(`?parent IN (${s})`);let c=!1;for(let[,p]of Object.entries(r.properties))if(p.required){if(p.getter)continue;c=!0,p.flag&&p.initial?a.push(`
|
|
1108
|
+
?source ${Z(p.predicate)} ${Z(p.initial)} .`):a.push(`
|
|
1109
|
+
?source ${Z(p.predicate)} ?cfTarget_${p.name} .`)}if(!c){for(let[,p]of Object.entries(r.properties))if(p.initial){c=!0,p.flag?a.push(`
|
|
1110
|
+
?source ${Z(p.predicate)} ${Z(p.initial)} .`):a.push(`
|
|
1111
|
+
?source ${Z(p.predicate)} ?cfInitTarget_${p.name} .`);break}}if(!c&&a.length<=1){let p=[];for(let[,h]of Object.entries(r.properties))h.predicate&&p.push(Z(h.predicate));if(r.relations)for(let[,h]of Object.entries(r.relations))h.predicate&&p.push(Z(h.predicate));p.length>0&&a.push(`
|
|
1112
|
+
{ SELECT DISTINCT ?source WHERE { ?source ?cf_structPred ?cf_structTarget . FILTER(?cf_structPred IN (${p.join(", ")})) } }`)}let{joins:l,filters:u}=Rp(r,e,n);a.push(...l),o.push(...u);let f=a.join(`
|
|
1113
|
+
`),d=o.length>0?`FILTER(
|
|
1114
|
+
${o.join(` &&
|
|
1115
|
+
`)}
|
|
1116
|
+
)`:"";return`
|
|
1117
|
+
SELECT ?parent (COUNT(DISTINCT ?source) AS ?count) WHERE {${f}
|
|
1118
|
+
GRAPH ?linkGraph { ?source ?predicate ?target . }
|
|
1119
|
+
FILTER(isIRI(?source) && isIRI(?predicate))
|
|
1120
|
+
?linkGraph <ad4m://ontology/author> ?author .
|
|
1121
|
+
?linkGraph <ad4m://ontology/timestamp> ?timestamp .
|
|
1122
|
+
${d}
|
|
1123
|
+
}
|
|
1124
|
+
GROUP BY ?parent
|
|
1125
|
+
`.trim()}function q1(r){let e=new Map;if(!Array.isArray(r))return e;for(let t of r){let i=t.parent?.value??t.parent,n=t.count?.value??t.count;if(!i||n===void 0||n===null)continue;let a=typeof n=="number"?n:parseInt(String(n),10);isNaN(a)||e.set(String(i),a)}return e}var hn=new Map;function B1(r,e){return`${r}::${e}`}async function V1(r,e,t,i){let n=r.uuid||r.handle?.uuid||"",a=B1(n,e),o=hn.get(a),s={onResult:i,hydrate:t};if(o){o.callbacks.add(s),o.refCount++;let f;return o.latestHydrated!==void 0?f=o.latestHydrated:o.latestRaw!==void 0&&(f=await t(o.latestRaw)),{initialResult:f,dispose:()=>Am(a,s)}}let c=await r.subscribeQuery(e),l={subscription:c,callbacks:new Set([s]),latestRaw:c.result,latestHydrated:void 0,hydrating:!1,refCount:1};hn.set(a,l),c.onResult(async f=>{let d=l.latestRaw;l.latestRaw=f,l.hydrating=!0;try{let p=l.callbacks.values().next().value;if(p){let h=Array.isArray(d)?d:[],m=Array.isArray(f)?f:[],g=l.latestHydrated;if(g&&Array.isArray(g)&&m.length>h.length&&m.length-h.length<=5){let w=new Set(h.map(T=>`${T.source}|${T.predicate}|${T.target}`)),y=m.filter(T=>!w.has(`${T.source}|${T.predicate}|${T.target}`)),b=new Set(m.map(T=>`${T.source}|${T.predicate}|${T.target}`));if(h.filter(T=>!b.has(`${T.source}|${T.predicate}|${T.target}`)).length===0&&y.length>0){let T=new Set(h.map(O=>O.source));if(y.every(O=>!T.has(O.source)))try{let O=await p.hydrate(y);if(Array.isArray(O)){let D=[...g,...O];l.latestHydrated=D;for(let P of l.callbacks)try{P.onResult(D)}catch{}return}}catch{}}}let _=await p.hydrate(f);l.latestHydrated=_;for(let w of l.callbacks)try{w.onResult(_)}catch{}}}finally{l.hydrating=!1}});let u=await t(c.result);return l.latestHydrated=u,{initialResult:u,dispose:()=>Am(a,s)}}function Am(r,e){let t=hn.get(r);!t||(t.callbacks.delete(e),t.refCount--,t.refCount<=0&&(t.subscription?.dispose&&t.subscription.dispose(),hn.delete(r)))}function eO(){for(let r of hn.values())r.subscription?.dispose&&r.subscription.dispose();hn.clear()}function tO(){return hn.size}var yp=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.engineFlag="sparql",this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}parent(e,t,i){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let o=e.constructor;return this.queryParams.parent={id:n,model:o,field:t.field},this}let a=i?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}deepQuery(){return this.queryParams.deepQuery=!0,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}engine(e){return this.engineFlag=e,this}async get(){let e;if(this.engineFlag==="sparql")e=await this.executeSparqlQuery();else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),i=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,i))}return e}async getSparql(){return this.executeSparqlQuery()}async executeSparqlQuery(){let e=await this.ctor.queryToSPARQL(this.perspective,this.queryParams),t=await this.perspective.querySparql(e),{results:i}=await this.processSparqlResult(t);return i}async processSparqlResult(e,t,i=!1){let n=xo(Array.isArray(e)?e:[]);return await this.ctor.instancesFromQueryResult(this.perspective,t||this.queryParams,n,i)}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.engineFlag==="sparql"){let i=await t.queryToSPARQL(this.perspective,this.queryParams),n=null,a=l=>l.length===0?"0:":JSON.stringify(l,(u,f)=>typeof f=="function"?void 0:f),o=async l=>{let{results:u}=await this.processSparqlResult(l);return u},s=await V1(this.perspective,i,o,l=>{let u=a(l);u!==n&&(n=u,e(l))});this.currentSubscription={dispose:s.dispose};let c=s.initialResult;return n=a(c),c}else{let i=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(i);let n=async o=>{let{results:s}=await t.instancesFromPrologResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return a}}async subscribeSparql(e){this.dispose();let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{results:o}=await this.processSparqlResult(a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.processSparqlResult(this.currentSubscription.result);return n}async count(){if(this.engineFlag==="sparql"){let e=this.ctor.getModelMetadata(),t=It(this.ctor);if(Uc(e,t,this.queryParams.where)){let a=await this.ctor.queryToSPARQL(this.perspective,this.queryParams),o=await this.perspective.querySparql(a),{totalCount:s}=await this.processSparqlResult(o,void 0,!0);return s}let i=await this.ctor.countQueryToSPARQL(this.perspective,this.queryParams),n=await this.perspective.querySparql(i);return gp(n)??0}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSparql(){let e=this.engineFlag;this.engineFlag="sparql";try{return await this.count()}finally{this.engineFlag=e}}async countSubscribe(e){if(this.dispose(),this.engineFlag==="sparql"){let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{totalCount:o}=await this.processSparqlResult(a,void 0,!0);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.processSparqlResult(this.currentSubscription.result,void 0,!0);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let o=a?.[0]?.TotalCount||0;e(o)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async countSubscribeSparql(e){this.dispose();let t=await this.ctor.queryToSPARQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeQuery(t);let i=async a=>{let{totalCount:o}=await this.processSparqlResult(a,void 0,!0);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.processSparqlResult(this.currentSubscription.result,void 0,!0);return n}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.engineFlag==="sparql"){let n=await this.ctor.queryToSPARQL(this.perspective,i),a=await this.perspective.querySparql(n),{results:o,totalCount:s}=await this.processSparqlResult(a,i,!0);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSparql(e,t){let i=this.engineFlag;this.engineFlag="sparql";try{return await this.paginate(e,t)}finally{this.engineFlag=i}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.engineFlag==="sparql"){let a={...this.queryParams||{}};delete a.limit,delete a.offset;let o=await this.ctor.queryToSPARQL(this.perspective,a);this.currentSubscription=await this.perspective.subscribeQuery(o);let s={...this.queryParams||{},count:!0},c=async h=>{let{results:m,totalCount:g}=await this.processSparqlResult(h,s,!0),_=e*(t-1),w=m.slice(_,_+e);i({results:w,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(c);let{results:l,totalCount:u}=await this.processSparqlResult(this.currentSubscription.result,s,!0),f=e*(t-1);return{results:l.slice(f,f+e),totalCount:u,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:f,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:f,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}async paginateSubscribeSparql(e,t,i){let n=this.engineFlag;this.engineFlag="sparql";try{return await this.paginateSubscribe(e,t,i)}finally{this.engineFlag=n}}};function Ya(r){return Array.isArray(r)?r.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):r}function qu(r,e){if(Array.isArray(e))return e.includes(r);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(r):r!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return r>=t.between[0]&&r<=t.between[1];let i=!0;return t.gt!==void 0&&(i=i&&r>t.gt),t.gte!==void 0&&(i=i&&r>=t.gte),t.lt!==void 0&&(i=i&&r<t.lt),t.lte!==void 0&&(i=i&&r<=t.lte),t.contains!==void 0&&(typeof r=="string"?i=i&&r.includes(String(t.contains)):Array.isArray(r)?i=i&&r.includes(t.contains):i=!1),i}return r===e}async function Q1(r,e,t,i){let n=r;if(r!=null&&r!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof r=="string"&&!r.startsWith("literal:"))try{let a=await t.getExpression(r);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof r=="string"&&r.startsWith("literal:"))try{let a=xe.fromUrl(r).get();n=a.data!==void 0?a.data:a}catch{}else typeof r=="string"&&i&&(i==="number"?n=Number(r):i==="boolean"&&(n=r==="true"||r==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function km(r,e,t,i,n){if(!e||e.length===0)return;let a=null,o=null,s=null,c=n&&n.length>0?new Set(n):null,l=new Map;for(let[h,m]of Object.entries(t.properties))m.getter||c&&!c.has(h)||l.set(m.predicate,[h,m]);let u=new Map,f=[];for(let[h,m]of Object.entries(t.relations))if(!m.getter){if(m.target&&m.filter!==!1){f.push([h,m]);continue}u.set(m.predicate,[h,m])}for(let[h,m]of f)u.has(m.predicate)||u.set(m.predicate,[h,m]);let d=new Map,p=new Map;for(let h=0;h<e.length;h++){let m=e[h],{predicate:g,target:_,author:w,timestamp:y}=m;if(_==="None"||_===void 0||_===null)continue;y!=null&&((a==null||y<a)&&(a=y,s=w??null),(o==null||y>o)&&(o=y));let b=l.get(g);if(b){d.get(b[0]),d.set(b[0],{target:_,timestamp:y});continue}let A=u.get(g);if(A){let[T]=A,x=p.get(T);x||(x=[],p.set(T,x)),x.push({target:_,timestamp:y??"",index:h})}}for(let[h,{target:m}]of d){let[,g]=l.get(t.properties[h].predicate),_=typeof r[h];r[h]=await Q1(m,g,i,_!=="undefined"?_:void 0)}for(let[h,m]of p)m.sort((g,_)=>{let w=String(g.timestamp).localeCompare(String(_.timestamp));return w!==0?w:g.index-_.index}),r[h]=m.map(g=>g.target).filter(g=>g!=null&&g!==""&&g!=="None");s&&(r.author=s),a!=null&&(r.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),o!=null&&(r.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}async function H1(r,e,t){let i=Object.fromEntries(await Promise.all(t.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let f=Array.from(o,h=>h.codePointAt(0)),d=f.every(h=>h<=255),p=f.some(h=>h>=128);if(d&&p)try{let h=Uint8Array.from(f),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==o&&(c=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:h})}}if(s){let f=await r.getExpression(o);if(f)try{c=JSON.parse(f.data)}catch{c=f.data}}let u=ln(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(c=u(c)),[a,c]}))),n=Object.fromEntries(Object.entries(i).filter(([a])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(e,n)}function z1(r,e){let t=Qm(r,e);if(!t){let i=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${i}".`);return}return t.getter}async function Bu(r,e,t,i){`${r.id}`;let a=i?.requestedProperties&&i.requestedProperties.length>0?new Set(i.requestedProperties):null;if(!i?.skipPropertyGetters){for(let[o,s]of Object.entries(t.properties))if(!(a&&!a.has(o))&&s.getter)try{let c=s.getter,l=c.replace(/\?source\b/g,`<${r.id}>`).replace(/<Base>/g,`<${r.id}>`).replace(/Base/g,`<${r.id}>`),u=l.trim().toUpperCase();if(u.startsWith("SELECT")||u.startsWith("ASK")||u.startsWith("CONSTRUCT")){let f=await e.querySparql(l);if(u.startsWith("ASK"))r[o]=f===!0||f==="true";else if(f&&f.length>0){let d=f[0],p=Object.keys(d)[0],h=d[p]?.value??d[p];h!=null&&h!=="None"&&h!==""&&(r[o]=h)}}else console.warn(`Unsupported legacy getter syntax for property ${o} \u2014 use native SPARQL (SELECT/ASK): ${c.slice(0,100)}`)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}}for(let[o,s]of Object.entries(t.relations)){if(a&&!a.has(o)&&!(i?.include&&o in i.include))continue;let c=s,l=c.getter;if(!l&&c.where&&c.direction!=="reverse")try{let f=c.target?.(),d=f?f.getModelMetadata?.()??null:null,p=!0;if(d)for(let h of Object.keys(c.where)){if(["id","author","timestamp"].includes(h))continue;let m=d.properties[h];if(m&&(!m.resolveLanguage||m.resolveLanguage==="literal")){p=!1;break}}else p=!1;if(p){let h=Vm(c.where,d);h.length>0&&(l=`SELECT ?target WHERE { <Base> <${Nr(c.predicate)}> ?target . ${h.join(" ")} }`)}}catch(f){console.warn(`[Ad4mModel] where-clause compilation failed for relation "${o}":`,f)}if(!l&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let f=c.target();l=z1(c.predicate,f),l||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(f){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,f)}if(l)try{let f=l.replace(/\?source\b/g,`<${r.id}>`).replace(/<Base>/g,`<${r.id}>`).replace(/\bBase\b/g,`<${r.id}>`),d=f.trim().toUpperCase();if(d.startsWith("SELECT")||d.startsWith("ASK")||d.startsWith("CONSTRUCT")){let p=await e.querySparql(f);if(p&&p.length>0){let h=p.map(m=>{let g=Object.keys(m)[0];return m[g]?.value??m[g]}).filter(m=>m!=null&&m!==""&&m!=="None");r[o]=h}}else console.warn(`Unsupported legacy getter syntax for relation ${o} \u2014 use native SPARQL (SELECT/ASK): ${l.slice(0,100)}`)}catch(f){console.warn(`Failed to evaluate getter for ${o}:`,f)}let u=r[o];if(c.where&&Array.isArray(u)&&u.length>0){let f=c.target?.();if(f){let d=[];for(let p of u)try{let h=new f(e,p);await h.get();let m=!0;for(let[g,_]of Object.entries(c.where))if(h[g]!==_){m=!1;break}m&&d.push(p)}catch{d.push(p)}r[o]=d}}}}async function To(r,e,t,i){if(!i||Object.keys(i).length===0)return;let n=It(r),a=[];for(let[o,s]of Object.entries(i))o.startsWith("$")&&s!==null&&typeof s=="object"&&"from"in s&&a.push([o,s]);for(let[o,s]of a){let c=n[s.from];if(!c){console.warn(`include projection "${o}": relation "${s.from}" not found in metadata, skipping`);for(let f of e)f[o]=s.count?0:[];continue}let l=c.target(),u=e.map(f=>f.id).filter(Boolean);if(s.count){let f=l.getModelMetadata?.()??null,d=l.getAllRelationsMetadata?.()??{},p=new Map;if(f&&u.length>0)try{let h=j1(f,d,c.predicate,u,s.where),m=await t.querySparql(h),g=Array.isArray(m)?m:m?.results?.bindings??m?.bindings??[];p=q1(g)}catch(h){console.warn(`include projection "${o}" count query failed, falling back to 0:`,h)}for(let h of e)h[o]=p.get(h.id)??0}else if(c.kind==="belongsToOne"||c.kind==="belongsToMany")if(u.length>0){let d=`SELECT ?source ?target WHERE {
|
|
1126
|
+
GRAPH ?g { ?source <${c.predicate}> ?target }
|
|
1127
|
+
FILTER(?target IN (${u.map(g=>`<${g}>`).join(", ")}))
|
|
1128
|
+
}`,p=new Map;try{let g=await t.querySparql(d),_=Array.isArray(g)?g:g?.results?.bindings??g?.bindings??[];for(let w of _){let y=w.source?.value??w.source,b=w.target?.value??w.target;!y||!b||(p.has(b)||p.set(b,[]),p.get(b).push(y))}}catch(g){console.warn(`include projection "${o}" reverse SPARQL failed:`,g)}let h=new Set;for(let g of p.values())for(let _ of g)h.add(_);let m=new Map;if(h.size>0){let g=await l.findAll(t,{where:{id:Array.from(h),...s.where??{}}});for(let _ of g)m.set(_.id,_)}for(let g of e){let w=(p.get(g.id)??[]).map(y=>m.get(y)).filter(y=>y!=null);s.limit!=null?s.limit===1?g[o]=w[0]??null:g[o]=w.slice(0,s.limit):g[o]=w}}else for(let d of e)d[o]=s.limit===1?null:[];else{let d=new Set,p=new Map;for(let m of e){let g=m[s.from],_=[];if(Array.isArray(g))for(let w of g){let y=typeof w=="string"?w:w?.id;y&&(d.add(y),_.push(y))}else typeof g=="string"?(d.add(g),_.push(g)):g?.id&&(d.add(g.id),_.push(g.id));p.set(m,_)}let h=new Map;if(d.size>0){let m=await l.findAll(t,{where:{id:Array.from(d),...s.where??{}}});for(let g of m)h.set(g.id,g)}for(let m of e){let _=(p.get(m)??[]).map(w=>h.get(w)).filter(w=>w!=null);s.limit===1?m[o]=_[0]??null:s.limit!=null?m[o]=_.slice(0,s.limit):m[o]=_}}}for(let[o,s]of Object.entries(i)){if(o.startsWith("$")&&typeof s=="object"&&s!==null&&"from"in s)continue;let c=n[o];if(!c){console.warn(`include: relation "${o}" not found in metadata, skipping`);continue}let l=c.target(),u=typeof s=="object"&&s!==null?s:void 0,f=u?.include;if(c.kind==="belongsToOne"||c.kind==="belongsToMany"){let w=e.map(T=>T.id).filter(Boolean),y=new Map;if(w.length>0){let T=`SELECT ?source ?target WHERE {
|
|
1129
|
+
GRAPH ?g { ?source <${c.predicate}> ?target }
|
|
1130
|
+
FILTER(?target IN (${w.map(x=>`<${x}>`).join(", ")}))
|
|
1131
|
+
}`;try{let x=await t.querySparql(T),O=Array.isArray(x)?x:x?.results?.bindings??x?.bindings??[];for(let D of O){let P=D.source?.value??D.source,U=D.target?.value??D.target;!P||!U||(y.has(U)||y.set(U,[]),y.get(U).push(P))}}catch(x){console.warn("Batched reverse relation SPARQL failed, falling back to sequential:",x);for(let O of e){let P=(await t.get(new J({predicate:c.predicate,target:O.id}))).filter(U=>U.data.target===O.id).map(U=>U.data.source);P.length>0&&y.set(O.id,P)}}}let b=new Set;for(let T of y.values())for(let x of T)b.add(x);let A=new Map;if(b.size>0){let T={where:{id:Array.from(b),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}};try{let x=await l.findAll(t,T);for(let O of x)A.set(O.id,O)}catch{await Promise.all(Array.from(b).map(async x=>{try{let O=new l(t,x);await O.get(u?.properties?{properties:u.properties}:void 0),A.set(x,O)}catch{}}))}}for(let T of e){let x=T.id,O=y.get(x)??[];if(c.kind==="belongsToOne"){if(O.length===0){T[o]=null;continue}let D=O[O.length-1];T[o]=A.get(D)??null}else{let D=O.map(P=>A.get(P)).filter(P=>P!=null);if(u?.order){let P=Object.entries(u.order);D=D.sort((U,ke)=>{for(let[Ie,C]of P){let we=String(U[Ie]??""),Se=String(ke[Ie]??""),se=we.localeCompare(Se);if(se!==0)return C==="DESC"?-se:se}return 0})}if(u?.offset!=null||u?.limit!=null){let P=u.offset??0,U=u.limit!=null?P+u.limit:void 0;D=D.slice(P,U)}T[o]=D,f&&D.length>0&&await To(l,D,t,f)}}continue}let d=new Set,p=new Map;for(let w of e){let y=w[o];if(p.set(w,Array.isArray(y)?[...y]:y),y!=null)if(Array.isArray(y))for(let b of y)typeof b=="string"?d.add(b):b&&typeof b=="object"&&typeof b.id=="string"&&d.add(b.id);else typeof y=="string"?d.add(y):y&&typeof y=="object"&&typeof y.id=="string"&&d.add(y.id)}if(d.size===0)continue;let h=new Map,g={where:{id:Array.from(d),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},_=await l.findAll(t,g);for(let w of _)h.set(w.id,w);for(let w of e){let y=p.get(w);if(y!=null)if(Array.isArray(y)){let b=y.map(A=>typeof A=="string"?h.has(A)?h.get(A):null:A&&typeof A=="object"&&typeof A.id=="string"?h.has(A.id)?h.get(A.id):A:null).filter(A=>A!==null);if(u?.order){let A=Object.entries(u.order);b=b.sort((T,x)=>{for(let[O,D]of A){let P=String(T[O]??""),U=String(x[O]??""),ke=P.localeCompare(U);if(ke!==0)return D==="DESC"?-ke:ke}return 0})}if(u?.offset!=null||u?.limit!=null){let A=u.offset??0,T=u.limit!=null?A+u.limit:void 0;b=b.slice(A,T)}c.maxCount===1?(b.length>1&&console.warn(`include: relation "${o}" has maxCount 1 but ${b.length} values found; keeping the last`),w[o]=b.length>0?b[b.length-1]:null):w[o]=b}else typeof y=="string"&&h.has(y)?w[o]=h.get(y):y&&typeof y=="object"&&typeof y.id=="string"&&(w[o]=h.has(y.id)?h.get(y.id):y)}if(f){let w=Array.from(h.values());await To(l,w,t,f)}}}var ha=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===ha)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,i={},n=ln(this);for(let[f,d]of Object.entries(n)){let p=d;i[f]={name:f,predicate:p.through||"",required:p.required||!1,readOnly:!(p.writable??!1),...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=It(this),s=Object.fromEntries(Object.entries(o).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));for(let[f,d]of Object.entries(s)){let p=d;a[f]={name:f,predicate:p.predicate||"",...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter},direction:p.kind==="belongsToMany"||p.kind==="belongsToOne"?"reverse":"forward",...p.target!==void 0&&{target:p.target},...p.filter!==void 0&&{filter:p.filter},...p.where!==void 0&&{where:p.where}}}let c=Object.keys(i).length>0,l=Object.keys(a).length>0;if(!(c||l)&&e.__jsonSchema){let f=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(f.properties)for(let[p,h]of Object.entries(f.properties)){let m=Rg(h),g=Lg(f,p,h,Pg(f,d),d);if(m)a[p]={name:p,predicate:g,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let _=f.required?.includes(p)||!1;i[p]={name:p,predicate:g,required:_,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:i,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||xe.from(qm(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return ln(t)[e]}getRelationOptions(e){let t=this.constructor;return It(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateRelationAction(e,t){let i=this.getRelationOptions(e);if(!i)throw new Error(`Relation "${e}" has no metadata defined`);if(!i.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.predicate,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){return H1(e,t,i)}takeSnapshot(e){let i=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(i.properties)){let o=this[a];n[a]=Ya(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(i.relations)){let o=this[a];n[a]=Ya(Array.isArray(o)?[...o]:o)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in i.relations){let o=this[a];n[a]=Ya(Array.isArray(o)?[...o]:o)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let i=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let o=Ya(this[a]),s=this._snapshot[a];if(Array.isArray(o)||Array.isArray(s)){let c=Array.isArray(o)?[...o].sort():[],l=Array.isArray(s)?[...s].sort():[];(c.length!==l.length||c.some((u,f)=>u!==l[f]))&&i.push(a)}else o!==s&&i.push(a)}return i}async getData(e){try{let t=this.constructor,i=t.getModelMetadata(),n=U1(this._baseExpression),a=await this._perspective.querySparql(n);if(a&&a.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await km(this,a,i,this._perspective,l)}let o=It(t),s=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,u]of Object.entries(o)){if(u.kind!=="belongsToOne"&&u.kind!=="belongsToMany"||s&&!s.has(l))continue;let d=(await this._perspective.get(new J({predicate:u.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);u.kind==="belongsToOne"?this[l]=d.length>0?d[d.length-1]:null:this[l]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Bu(this,this._perspective,i,c),e?.include&&await To(t,[this],this._perspective,e.include)}catch(t){console.error(`SPARQL getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,i){let{properties:n,where:a,order:o,offset:s,limit:c,count:l}=t,u=i||await this.getClassName(e),f=t.parent?aa(t.parent,this):void 0,d=[gm(),mm(t.parent,f),$1(n),ym(a)],p=[vm(l),bm(o),wm(s),Sm(c)];return`
|
|
1071
1132
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1072
1133
|
subject_class("${u}", SubjectClass),
|
|
1073
1134
|
instance(SubjectClass, Base),
|
|
1074
|
-
${
|
|
1135
|
+
${d.filter(m=>m).join(", ")}
|
|
1075
1136
|
), UnsortedInstances),
|
|
1076
1137
|
${p.filter(m=>m).join(", ")}
|
|
1077
|
-
`}static async queryToSPARQL(e,t){let i=this.getModelMetadata(),n=
|
|
1138
|
+
`}static async queryToSPARQL(e,t){let i=this.getModelMetadata(),n=It(this);return D1(i,n,t,this)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],o=(await Promise.all(i[0].AllInstances.map(async([c,l,u,f,d])=>{try{let p=new this(e,c);n.length&&Object.keys(p).forEach(m=>{!n.includes(m)&&m!=="createdAt"&&m!=="updatedAt"&&m!=="author"&&m!=="id"&&m!=="baseExpression"&&delete p[m]});let h=[...l,...u,["createdAt",f],["author",d]];return await ha.assignValuesToInstance(e,p,h),p}catch(p){return console.error(`Failed to process instance ${c}:`,p),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await To(this,o,e,t.include);let s=t.include;for(let c of o)c.takeSnapshot(s);return{results:o,totalCount:i[0].TotalCount}}static async instancesFromQueryResult(e,t,i,n=!1){if(!i||i.length===0)return{results:[],totalCount:0};let a=this.getModelMetadata(),o=t?.properties||[],s=[];for(let y of i){let b;try{if(b=y.source_uri,!b)continue;let A=y.links||[],T=new this(e,b),x=o.length>0?[...o]:void 0;if(x&&t.where)for(let O of Object.keys(t.where))x.includes(O)||x.push(O);await km(T,A,a,e,x),s.push(T)}catch(A){console.error(`Failed to process SPARQL instance ${b}:`,A)}}let c=It(this),l=Object.entries(c).filter(([y,b])=>(b.kind==="belongsToOne"||b.kind==="belongsToMany")&&(o.length===0||o.includes(y)));l.length>0&&s.length>0&&await Promise.all(s.map(async y=>{for(let[b,A]of l){let x=(await e.get(new J({predicate:A.predicate,target:y.id}))).filter(O=>O.data.target===y.id).map(O=>O.data.source);A.kind==="belongsToOne"?y[b]=x.length>0?x[x.length-1]:null:y[b]=x}}));let u=t.where?Object.keys(t.where).filter(y=>a.properties[y]?.getter):[],f=t.deepQuery===!0||u.length>0;{let y=!f,b=f?o.length>0?Array.from(new Set([...o,...u])):t.deepQuery===!0?[]:u:[],A={...b.length>0&&{requestedProperties:b},...t.include&&{include:t.include},skipPropertyGetters:y};for(let T of s)await Bu(T,e,a,A)}let d=s;t.where&&(d=s.filter(y=>{for(let[b,A]of Object.entries(t.where)){if(b==="base"||b==="id")continue;if(b==="author"||b==="timestamp"){if(!qu(y[b],A))return!1;continue}if(!(b in a.properties)){if(!qu(y[b],A))return!1;continue}if(!qu(y[b],A))return!1}return!0}));let p=t.order||(t.limit!==void 0||t.offset!==void 0?{createdAt:"ASC"}:null);if(p){let y=Object.entries(p);d.sort((b,A)=>{for(let[T,x]of y){let O=b[T],D=A[T];if(O===void 0&&D===void 0)continue;if(O===void 0)return x==="ASC"?1:-1;if(D===void 0)return x==="ASC"?-1:1;let P=0;if(typeof O=="number"&&typeof D=="number"?P=O-D:typeof O=="string"&&typeof D=="string"?P=O.localeCompare(D):P=String(O).localeCompare(String(D)),P!==0)return x==="DESC"?-P:P}return 0})}let h=It(this),m=!Uc(a,h,t.where)&&(t.limit!==void 0||t.offset!==void 0)&&t.order!==void 0&&Object.keys(t.order).length>0,g;if(m&&n)try{let y=Em(a,h,t,this),b=await e.querySparql(y);g=gp(b)??d.length}catch{g=d.length}else g=d.length;let _=d;if(!m&&(t.offset!==void 0||t.limit!==void 0)){let y=t.offset||0,b=t.limit?y+t.limit:void 0;_=d.slice(y,b)}if(o.length>0){let y=new Set(o);for(let b of _){for(let A of Object.keys(a.properties))y.has(A)||delete b[A];for(let A of Object.keys(a.relations))!y.has(A)&&!(t.include&&A in t.include)&&delete b[A];for(let A of["author","createdAt","updatedAt"])y.has(A)||delete b[A]}}t.include&&_.length>0&&await To(this,_,e,t.include);let w=t.include;for(let y of _)y.takeSnapshot(w);return{results:_,totalCount:g}}static async findAll(e,t={},i="sparql"){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");if((typeof i=="boolean"?i?"sparql":"prolog":i)==="sparql"){let a=await this.queryToSPARQL(e,t),o=await e.querySparql(a),s=xo(o),{results:c}=await this.instancesFromQueryResult(e,t,s);return c}else{let a=await this.queryToProlog(e,t),o=await e.infer(a),{results:s}=await this.instancesFromPrologResult(e,t,o);return s}}static async findOne(e,t={},i="sparql"){let n={...t,limit:1};return(await this.findAll(e,n,i))[0]??null}static async findAllAndCount(e,t={},i="sparql"){if((typeof i=="boolean"?i?"sparql":"prolog":i)==="sparql"){let a=await this.queryToSPARQL(e,t),o=await e.querySparql(a),s=xo(o);return await this.instancesFromQueryResult(e,t,s,!0)}else{let a=await this.queryToProlog(e,t),o=await e.infer(a);return await this.instancesFromPrologResult(e,t,o)}}static async paginate(e,t,i,n,a="sparql"){let o={...n||{},limit:t,offset:t*(i-1),count:!0};if((typeof a=="boolean"?a?"sparql":"prolog":a)==="sparql"){let c=await this.queryToSPARQL(e,o),l=await e.querySparql(c),u=xo(l),{results:f,totalCount:d}=await this.instancesFromQueryResult(e,o,u,!0);return{results:f,totalCount:d,pageSize:t,pageNumber:i}}else{let c=await this.queryToProlog(e,o),l=await e.infer(c),{results:u,totalCount:f}=await this.instancesFromPrologResult(e,o,l);return{results:u,totalCount:f,pageSize:t,pageNumber:i}}}static async countQueryToProlog(e,t={},i){let{where:n}=t,a=i||await this.getClassName(e),o=t.parent?aa(t.parent,this):void 0,s=[gm(),mm(t.parent,o),ym(n)],c=[vm(!0),bm(),wm(),Sm()];return`
|
|
1078
1139
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1079
1140
|
subject_class("${a}", SubjectClass),
|
|
1080
1141
|
instance(SubjectClass, Base),
|
|
1081
1142
|
${s.filter(u=>u).join(", ")}
|
|
1082
1143
|
), UnsortedInstances),
|
|
1083
1144
|
${c.filter(u=>u).join(", ")}
|
|
1084
|
-
`}static async countQueryToSPARQL(e,t){let i=
|
|
1145
|
+
`}static async countQueryToSPARQL(e,t){let i=this.getModelMetadata(),n=It(this);return Em(i,n,t,this)}static async count(e,t={},i="sparql"){if((typeof i=="boolean"?i?"sparql":"prolog":i)==="sparql"){let a=this.getModelMetadata(),o=It(this);if(Uc(a,o,t.where)){let l=await this.queryToSPARQL(e,t),u=await e.querySparql(l),f=xo(u),{totalCount:d}=await this.instancesFromQueryResult(e,t,f,!0);return d}let s=await this.countQueryToSPARQL(e,t),c=await e.querySparql(s);return gp(c)??0}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;t==null||t===""||(o&&(t=await this._perspective.createExpression(t,o)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],i))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,i){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(o=>({name:"value",value:this.resolveRelationId(o)})),i):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],i))}async addRelationValue(e,t,i){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],i))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],i))}async removeRelationValue(e,t,i){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],i))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],i))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let i=this.constructor.getModelMetadata(),n=Object.values(i.properties).some(o=>o.required||o.flag||o.initial!==void 0),a=[];if(n){let o={};for(let[c,l]of Object.entries(this))if(l!=null&&!(Array.isArray(l)&&l.length>0)&&!l?.action){let u=i.properties[c];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof l=="object"){a.push(c);continue}o[c]=l}let s=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(s,this._baseExpression,o,e)}await this.innerUpdate(!n,e);for(let o of a){let s=this[o];s!=null&&await this.setProperty(o,s,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),i={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let o=this[a];o!=null&&a!=="author"&&a!=="timestamp"&&(i[a]=o)}return i}async innerUpdate(e=!0,t){let i=this.constructor,n=this._snapshot?new Set(this.changedFields()):null,a=i.getModelMetadata(),o=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),s=Object.entries(this);for(let[c,l]of s){if(!o.has(c)||n&&!n.has(c))continue;let u=a.relations[c];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([d,p])=>d!==c&&p.predicate===u.predicate)))&&l!=null){if(l?.action)switch(l.action){case"setter":await this.setRelationValues(c,l.value,t);break;case"adder":await this.addRelationValue(c,l.value,t);break;case"remover":await this.removeRelationValue(c,l.value,t);break;default:await this.setRelationValues(c,l.value,t);break}else if(Array.isArray(l))await this.setRelationValues(c,l,t);else if(l!=null&&l!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,l,t)}}}}static async evaluateGetters(e,t,i){if(e.length===0)return;let n=this.getModelMetadata(),a=i&&i.length>0?{requestedProperties:i}:void 0,o=[];for(let[s,c]of Object.entries(n.properties))c.getter&&(!i||i.length===0||i.includes(s))&&o.push(s);for(let s of e){await Bu(s,t,n,a);let c=s;if(c._snapshot)for(let l of o){let u=s[l];c._snapshot[l]=Ya(Array.isArray(u)?[...u]:u)}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=new Set;for(let s of Object.values(t.properties))s.predicate&&n.add(s.predicate);for(let s of Object.values(t.relations))s.predicate&&n.add(s.predicate);let o=(await this._perspective.get(new J({source:this._baseExpression}))).filter(s=>s.data.predicate&&n.has(s.data.predicate));o.length>0&&await this._perspective.removeLinks(o,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new J({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},i){let n=new this(e);if(Object.assign(n,t),i?.parent&&!i?.batchId){let a=await e.createBatch();await n.save(a);let o=aa(i.parent,this),s=new Tt({source:i.parent.id,predicate:o,target:n.id});return await e.add(s,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(i?.batchId),i?.parent){let a=aa(i.parent,this),o=new Tt({source:i.parent.id,predicate:a,target:n.id});await e.add(o,"shared",i?.batchId)}return n}static async update(e,t,i){let n=new this(e,t);return await n.get(),Object.assign(n,i),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let i=await e.createBatch(),n=await t({batchId:i});return await e.commitBatch(i),n}static query(e,t){return new yp(e,this,t)}static fromJSONSchema(e,t){return P1(this,e,t)}};ha.classNamesByClass=new WeakMap;function Pp(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function W1(r,e){let t=e.properties,i=Object.values(t).filter(o=>o.flag&&o.predicate&&o.initial);if(i.length>0){let o=i.map(s=>`triple(X, '${s.predicate}', '${s.initial}')`).join(`,
|
|
1085
1146
|
`);return`${r}(X) :-
|
|
1086
1147
|
${o}.`}let n=Object.values(t).filter(o=>o.required&&o.predicate&&!o.flag);if(n.length>0){let o=n.map(s=>`triple(X, '${s.predicate}', _)`).join(`,
|
|
1087
1148
|
`);return`${r}(X) :-
|
|
1088
1149
|
${o}.`}let a=Object.values(t).filter(o=>o.predicate).map(o=>o.predicate);if(e.relations)for(let o of Object.values(e.relations))o.predicate&&a.push(o.predicate);if(a.length>0){let o=a.map(s=>`triple(X, '${s}', _)`).join(` ;
|
|
1089
1150
|
`);return`${r}(X) :-
|
|
1090
|
-
(${o}).`}return null}function
|
|
1091
|
-
`)}var
|
|
1151
|
+
(${o}).`}return null}function G1(r,e){return e.flag||!e.predicate?null:`${`${r}_${Pp(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function K1(r,e){if(!e.predicate)return null;let t=`${r}_${Pp(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function rO(r){let e=r.getModelMetadata(),t=Pp(e.className),i=[];i.push(`% ${e.className} \u2014 generated Prolog facts`);let n=W1(t,e);n&&(i.push(""),i.push("% Instance recognizer"),i.push(n));let a=Object.values(e.properties).map(s=>G1(t,s)).filter(s=>s!==null);a.length>0&&(i.push(""),i.push("% Field getters"),i.push(...a));let o=Object.values(e.relations).map(s=>K1(t,s)).filter(s=>s!==null);return o.length>0&&(i.push(""),i.push("% Relation getters"),i.push(...o)),i.join(`
|
|
1152
|
+
`)}var iO=`
|
|
1092
1153
|
type AIModelLoadingStatus {
|
|
1093
1154
|
downloaded: Boolean!
|
|
1094
1155
|
loaded: Boolean!
|
|
@@ -1714,74 +1775,74 @@ input VoiceActivityParamsInput {
|
|
|
1714
1775
|
startWindow: Float
|
|
1715
1776
|
timeBeforeSpeech: Float
|
|
1716
1777
|
}
|
|
1717
|
-
`,A=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},g=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},H=function(r,e){return function(t,i){e(t,i,r)}},Wo=new hi;Wo.author="did:ad4m:test";Wo.timestamp=Date.now();Wo.data={source:"root",target:"neighbourhood://Qm12345"};Wo.proof={signature:"",key:"",valid:!0};var ci=new an;ci.author="did:ad4m:test";ci.timestamp=Date.now().toString();ci.proof=new Dr("","");ci.data=new Sr([Wo]);var Mc=class{};A([w(),g("design:type",String)],Mc.prototype,"recipient",void 0);A([w(),g("design:type",an)],Mc.prototype,"message",void 0);Mc=A([J()],Mc);var fa=class{};A([w(),g("design:type",String)],fa.prototype,"ad4mExecutorVersion",void 0);A([w(),g("design:type",Boolean)],fa.prototype,"isInitialized",void 0);A([w(),g("design:type",Boolean)],fa.prototype,"isUnlocked",void 0);fa=A([J()],fa);var fn=class{};A([w(),g("design:type",String)],fn.prototype,"title",void 0);A([w(),g("design:type",String)],fn.prototype,"message",void 0);A([w(),g("design:type",String)],fn.prototype,"type",void 0);A([w(),g("design:type",String)],fn.prototype,"addon",void 0);fn=A([J()],fn);var Jt=class{};A([w(),g("design:type",String)],Jt.prototype,"description",void 0);A([w(),g("design:type",String)],Jt.prototype,"appName",void 0);A([w(),g("design:type",String)],Jt.prototype,"appUrl",void 0);A([w(),g("design:type",String)],Jt.prototype,"appIconPath",void 0);A([w(),g("design:type",String)],Jt.prototype,"trigger",void 0);A([w(),g("design:type",Array)],Jt.prototype,"perspectiveIds",void 0);A([w(),g("design:type",String)],Jt.prototype,"webhookUrl",void 0);A([w(),g("design:type",String)],Jt.prototype,"webhookAuth",void 0);Jt=A([Xe()],Jt);var Ft=class{};A([w(),g("design:type",String)],Ft.prototype,"id",void 0);A([w(),g("design:type",Boolean)],Ft.prototype,"granted",void 0);A([w(),g("design:type",String)],Ft.prototype,"description",void 0);A([w(),g("design:type",String)],Ft.prototype,"appName",void 0);A([w(),g("design:type",String)],Ft.prototype,"appUrl",void 0);A([w(),g("design:type",String)],Ft.prototype,"appIconPath",void 0);A([w(),g("design:type",String)],Ft.prototype,"trigger",void 0);A([w(),g("design:type",Array)],Ft.prototype,"perspectiveIds",void 0);A([w(),g("design:type",String)],Ft.prototype,"webhookUrl",void 0);A([w(),g("design:type",String)],Ft.prototype,"webhookAuth",void 0);Ft=A([J()],Ft);var ha=class{};A([w(),g("design:type",Ft)],ha.prototype,"notification",void 0);A([w(),g("design:type",String)],ha.prototype,"perspectiveId",void 0);A([w(),g("design:type",String)],ha.prototype,"triggerMatch",void 0);ha=A([J()],ha);var Ye=class{};A([w(),g("design:type",Number)],Ye.prototype,"total",void 0);A([w(),g("design:type",Number)],Ye.prototype,"imported",void 0);A([w(),g("design:type",Number)],Ye.prototype,"failed",void 0);A([w(),g("design:type",Number)],Ye.prototype,"omitted",void 0);A([w(),g("design:type",Array)],Ye.prototype,"errors",void 0);Ye=A([J()],Ye);var Mt=class{};A([w(),g("design:type",Ye)],Mt.prototype,"perspectives",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"links",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"expressions",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"perspectiveDiffs",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"notifications",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"models",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"defaultModels",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"tasks",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"friends",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"trustedAgents",void 0);A([w(),g("design:type",Ye)],Mt.prototype,"knownLinkLanguages",void 0);Mt=A([J()],Mt);var Mr=class{};A([w(),g("design:type",String)],Mr.prototype,"email",void 0);A([w(),g("design:type",String)],Mr.prototype,"did",void 0);A([w(),g("design:type",String)],Mr.prototype,"lastSeen",void 0);A([w(),g("design:type",Number)],Mr.prototype,"perspectiveCount",void 0);A([w(),g("design:type",String)],Mr.prototype,"remainingCredits",void 0);A([w(),g("design:type",Boolean)],Mr.prototype,"freeAccess",void 0);A([w(),g("design:type",String)],Mr.prototype,"hotWalletAddress",void 0);Mr=A([J()],Mr);var hn=class{};A([w(),g("design:type",Boolean)],hn.prototype,"success",void 0);A([w(),g("design:type",String)],hn.prototype,"message",void 0);A([w(),g("design:type",Boolean)],hn.prototype,"requiresPassword",void 0);A([w(),g("design:type",Boolean)],hn.prototype,"isExistingUser",void 0);hn=A([J()],hn);var wi=class{constructor(e,t,i,n=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=i,this.freeAccess=n}};A([w(),g("design:type",String)],wi.prototype,"email",void 0);A([w(),g("design:type",String)],wi.prototype,"remainingCredits",void 0);A([w(),g("design:type",String)],wi.prototype,"hotWalletAddress",void 0);A([w(),g("design:type",Boolean)],wi.prototype,"freeAccess",void 0);wi=A([J(),g("design:paramtypes",[String,String,String,Boolean])],wi);var Gt=class{constructor(e,t){this.success=e,this.message=t}};A([w(),g("design:type",Boolean)],Gt.prototype,"success",void 0);A([w(),g("design:type",String)],Gt.prototype,"message",void 0);Gt=A([J(),g("design:paramtypes",[Boolean,String])],Gt);var Ur=class{constructor(e,t,i,n,a,o,s){this.id=e,this.userEmail=t,this.timestamp=i,this.operation=n,this.cost=a,this.creditsAfter=o,this.summary=s}};A([w(),g("design:type",Number)],Ur.prototype,"id",void 0);A([w(),g("design:type",String)],Ur.prototype,"userEmail",void 0);A([w(),g("design:type",String)],Ur.prototype,"timestamp",void 0);A([w(),g("design:type",String)],Ur.prototype,"operation",void 0);A([w(),g("design:type",String)],Ur.prototype,"summary",void 0);A([w(),g("design:type",Number)],Ur.prototype,"cost",void 0);A([w(),g("design:type",Number)],Ur.prototype,"creditsAfter",void 0);Ur=A([J(),g("design:paramtypes",[Number,String,String,String,Number,Number,String])],Ur);var U=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return ci}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[ci]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:ci}]}runtimeMessageReceived(){return ci}exceptionOccurred(){return{title:"Test title",message:"Test message",type:lp.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeFreeHostingEnabled(){return!0}runtimeSetFreeHostingEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5,remainingCredits:"0",freeAccess:!1}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new on("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}runtimeHostingUserInfo(){return new wi("test@example.com","100000000",null,!1)}runtimeComputeLog(e,t,i){return[]}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Gt(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new Gt(!0,"")}runtimeSendHot(e,t){return new Gt(!0,"")}runtimeSetUnytMembraneProof(e){return new Gt(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytAgentKey(){return""}runtimeUnytVersionInfo(){return""}};A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",fa)],U.prototype,"runtimeInfo",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"addTrustedAgents",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"getTrustedAgents",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeFriends",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);A([qe(),H(0,Q()),H(1,Q()),H(2,Q()),H(3,Q()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Sr]),g("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);A([qe(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",an)],U.prototype,"runtimeFriendStatus",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,_c]),g("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);A([qe(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);A([qe(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);A([fp(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",an)],U.prototype,"runtimeMessageReceived",null);A([fp(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",fn)],U.prototype,"exceptionOccurred",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Jt]),g("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeNotifications",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,Jt]),g("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);A([fp(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",ha)],U.prototype,"runtimeNotificationTriggered",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeFreeHostingEnabled",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetFreeHostingEnabled",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeListUsers",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,_r]),g("design:returntype",hn)],U.prototype,"runtimeRequestLoginVerification",null);A([ae(),H(0,Q()),H(1,Q()),H(2,Q()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);A([ae(),H(0,Q()),H(1,Q()),H(2,Q()),g("design:type",Function),g("design:paramtypes",[String,String,_r]),g("design:returntype",on)],U.prototype,"runtimeCreateUser",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],U.prototype,"runtimeLoginUser",null);A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);A([ae(),H(0,Q()),H(1,Q()),H(2,Q()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",wi)],U.prototype,"runtimeHostingUserInfo",null);A([qe(),H(0,Q()),H(1,Q()),H(2,Q()),g("design:type",Function),g("design:paramtypes",[String,Number,String]),g("design:returntype",Array)],U.prototype,"runtimeComputeLog",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeSetHotWalletAddress",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Gt)],U.prototype,"runtimeRequestPayment",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,Number]),g("design:returntype",Boolean)],U.prototype,"runtimeSetUserCredits",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetUserFreeAccess",null);A([ae(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Gt)],U.prototype,"runtimeReinstallUnytDna",null);A([ae(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Gt)],U.prototype,"runtimeSendHot",null);A([ae(),H(0,Q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Gt)],U.prototype,"runtimeSetUnytMembraneProof",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHotWalletBalance",null);A([qe(),H(0,Q()),H(1,Q()),g("design:type",Function),g("design:paramtypes",[Number,Number]),g("design:returntype",String)],U.prototype,"runtimeHotWalletHistory",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHotAgentPubkey",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeUnytAgentKey",null);A([qe(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeUnytVersionInfo",null);U=A([Gb()],U);var B1=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Go(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of B1(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var V1="https://hosting.ad4m.dev";function Q1(r){try{return new URL(r),!0}catch(e){return!1}}function Tp(r){return V(this,null,function*(){let e=r||V1,t=yield fetch(`${e}/hosts`);if(!t.ok)throw new Error(`Failed to fetch hosts: ${t.status}`);let i=yield t.json();for(let n of i)n.profilePicUrl&&!Q1(n.profilePicUrl)&&(n.profilePicUrl=new URL(n.profilePicUrl,e).toString());return i})}function Og(r){return V(this,null,function*(){let e=yield r.agent.hostingUserInfo();return{email:e.email,remainingCredits:e.remainingCredits==="unlimited"?1/0:parseFloat(e.remainingCredits)||0,hotWalletAddress:e.hotWalletAddress||null,freeAccess:e.freeAccess}})}function $g(r,e){return V(this,null,function*(){return r.agent.requestPayment(e.toString())})}var H1=12e3,z1="https://hosting.ad4m.dev",W1=6e4,G1=10,Ko=class extends EventTarget{constructor(t){var n;super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;this.connectedHost=null;this.userInfo=null;this.creditPollInterval=null;Go(this),this.options=t,this.port=t.port||parseInt(Ha("ad4m-port"))||H1,this.url=t.url||Ha("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Ha("ad4m-token")||"",this.embedded=js(),this.hostIndexUrl=t.hostIndexUrl||z1,this.lowCreditThreshold=(n=t.lowCreditThreshold)!=null?n:G1;let i=Ha("ad4m-last-host");if(i)try{let a=JSON.parse(i);a&&a.id&&a.url&&a.name&&(this.connectedHost={id:a.id,name:a.name,profilePicUrl:a.profilePicUrl||"",location:a.location||"",url:a.url,rates:a.rates||[],aiModels:a.aiModels||[]})}catch(a){}this.embedded&&this.initializeEmbeddedMode()}connect(){return V(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,i)=>{let n=setTimeout(()=>{i(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(n),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(n),i(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(n),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(n),i(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield Mi(this.url),dt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return V(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=vu({url:this.url,connectionParams:()=>V(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:t=>V(this,null,function*(){if(!(t.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(i){console.error("[Ad4m Connect] Reconnection failed:",i),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new Uo(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new gu({link:new Gf(t),cache:new Rs({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,i){return V(this,null,function*(){let n=vu({url:t,connectionParams:()=>V(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(n),o=new Uo(a);try{return yield i(o)}finally{n.dispose()}})}checkAuth(){return V(this,null,function*(){try{return console.log("[Ad4m Connect] Checking authentication status..."),(yield this.ad4mClient.agent.isLocked())?(console.log("[Ad4m Connect] Agent wallet is locked"),this.notifyAuthChange("locked")):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){console.error("[Ad4m Connect] Authentication check failed:",t);let i="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===i?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",Wn("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return V(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="",Wn("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.connectedHost=null,this.userInfo=null,this.stopCreditPolling(),Wn("ad4m-last-host"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}startCreditSubscription(){if(!!this.ad4mClient){try{this.ad4mClient.agent.addHostingUserInfoChangedListener(t=>{let i={email:t.email,remainingCredits:t.remainingCredits==="unlimited"?1/0:parseFloat(t.remainingCredits)||0,hotWalletAddress:t.hotWalletAddress||null,freeAccess:t.freeAccess};this.userInfo=i,this.dispatchEvent(new CustomEvent("userinfochange",{detail:i})),i.remainingCredits<=0&&this.dispatchEvent(new CustomEvent("creditdepleted")),i.remainingCredits<=this.lowCreditThreshold&&this.dispatchEvent(new CustomEvent("creditlow"))}),this.ad4mClient.agent.subscribeHostingUserInfoChanged()}catch(t){console.warn("[Ad4m Connect] Subscription not available, falling back to polling:",t)}try{this.ad4mClient.agent.addComputeLogUpdatedListener(t=>{this.dispatchEvent(new CustomEvent("computelogentry",{detail:t}))}),this.ad4mClient.agent.subscribeComputeLogUpdated()}catch(t){console.warn("[Ad4m Connect] Compute log subscription not available:",t)}this.startCreditPolling()}}startCreditPolling(){this.stopCreditPolling();let t=()=>V(this,null,function*(){try{if(!this.ad4mClient)return;let i=yield Og(this.ad4mClient);this.userInfo=i,this.dispatchEvent(new CustomEvent("userinfochange",{detail:i})),i.remainingCredits<=this.lowCreditThreshold&&this.dispatchEvent(new CustomEvent("creditlow")),i.remainingCredits<=0&&this.dispatchEvent(new CustomEvent("creditdepleted"))}catch(i){console.error("[Ad4m Connect] Credit polling error:",i)}});t(),this.creditPollInterval=setInterval(t,W1)}stopCreditPolling(){this.creditPollInterval&&(clearInterval(this.creditPollInterval),this.creditPollInterval=null)}requestTopUp(t){return V(this,null,function*(){if(!this.ad4mClient)throw new Error("Not connected");return $g(this.ad4mClient,t)})}fetchComputeLog(t,i){return V(this,null,function*(){if(!this.ad4mClient)throw new Error("Not connected");return this.ad4mClient.agent.computeLog(t,i)})}setConnectedHost(t){this.connectedHost=t,dt("ad4m-last-host",JSON.stringify({id:t.id,url:t.url,name:t.name,location:t.location}))}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>V(this,null,function*(){var i;if(((i=t.data)==null?void 0:i.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:n,token:a}=t.data;if(n==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(n,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${n} (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`,dt("ad4m-port",o.toString()),s?dt("ad4m-token",s):Wn("ad4m-token"),dt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return V(this,null,function*(){return t&&(this.token="",Wn("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return V(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 i=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=i,dt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Code verification failed:",i),!1}})}isValidAd4mAPI(){return V(this,null,function*(){try{return yield this.withTempClient(this.url,t=>V(this,null,function*(){return yield t.runtime.info()})),!0}catch(t){return console.error("[Ad4m Connect] Failed to verify AD4M API:",t),!1}})}isMultiUser(){return V(this,null,function*(){try{return yield this.withTempClient(this.url,t=>V(this,null,function*(){return yield t.runtime.multiUserEnabled()}))}catch(t){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",t),!1}})}submitEmail(t){return V(this,null,function*(){try{return yield this.withTempClient(this.url,i=>V(this,null,function*(){return yield i.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(i){return{success:!1,message:i.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,i){return V(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>V(this,null,function*(){return yield a.agent.verifyEmailCode(t,i,"login")}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Email code verification failed:",n),!1}})}loginWithPassword(t,i){return V(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>V(this,null,function*(){return yield a.agent.loginUser(t,i)}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Password login failed:",n),!1}})}createAccount(t,i){return V(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>V(this,null,function*(){let o=yield a.agent.createUser(t,i);if(o.success)return yield a.agent.loginUser(t,i);throw new Error(o.error||"Failed to create account")}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Account creation error:",n),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let i=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(i))}}notifyConfigChange(t,i){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:i}}))}};var Kc=window,Jc=Kc.ShadowRoot&&(Kc.ShadyCSS===void 0||Kc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cp=Symbol(),Pg=new WeakMap,Jo=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Cp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Jc&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Pg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Pg.set(t,e))}return e}toString(){return this.cssText}},Rg=r=>new Jo(typeof r=="string"?r:r+"",void 0,Cp),Ge=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new Jo(t,r,Cp)},Op=(r,e)=>{Jc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Kc.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},Zc=Jc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Rg(t)})(r):r;var $p,Yc=window,Lg=Yc.trustedTypes,K1=Lg?Lg.emptyScript:"",Ng=Yc.reactiveElementPolyfillSupport,Rp={toAttribute(r,e){switch(e){case Boolean:r=r?K1:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Dg=(r,e)=>e!==r&&(e==e||r==r),Pp={attribute:!0,type:String,converter:Rp,reflect:!1,hasChanged:Dg},Lp="finalized",jr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=Pp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Pp}static finalize(){if(this.hasOwnProperty(Lp))return!1;this[Lp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(Zc(n))}else e!==void 0&&t.push(Zc(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Op(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=Pp){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Rp).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Rp;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Dg)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};jr[Lp]=!0,jr.elementProperties=new Map,jr.elementStyles=[],jr.shadowRootOptions={mode:"open"},Ng?.({ReactiveElement:jr}),(($p=Yc.reactiveElementVersions)!==null&&$p!==void 0?$p:Yc.reactiveElementVersions=[]).push("1.6.3");var Np,Xc=window,Sa=Xc.trustedTypes,Fg=Sa?Sa.createPolicy("lit-html",{createHTML:r=>r}):void 0,Fp="$lit$",xi=`lit$${(Math.random()+"").slice(9)}$`,Qg="?"+xi,J1=`<${Qg}>`,kn=document,Yo=()=>kn.createComment(""),Xo=r=>r===null||typeof r!="object"&&typeof r!="function",Hg=Array.isArray,Z1=r=>Hg(r)||typeof r?.[Symbol.iterator]=="function",Dp=`[
|
|
1718
|
-
\f\r]`,
|
|
1719
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1778
|
+
`,$=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},v=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},z=function(r,e){return function(t,i){e(t,i,r)}},Ko=new gi;Ko.author="did:ad4m:test";Ko.timestamp=Date.now();Ko.data={source:"root",target:"neighbourhood://Qm12345"};Ko.proof={signature:"",key:"",valid:!0};var ui=new sn;ui.author="did:ad4m:test";ui.timestamp=Date.now().toString();ui.proof=new Fr("","");ui.data=new Sr([Ko]);var jc=class{};$([S(),v("design:type",String)],jc.prototype,"recipient",void 0);$([S(),v("design:type",sn)],jc.prototype,"message",void 0);jc=$([Y()],jc);var ma=class{};$([S(),v("design:type",String)],ma.prototype,"ad4mExecutorVersion",void 0);$([S(),v("design:type",Boolean)],ma.prototype,"isInitialized",void 0);$([S(),v("design:type",Boolean)],ma.prototype,"isUnlocked",void 0);ma=$([Y()],ma);var mn=class{};$([S(),v("design:type",String)],mn.prototype,"title",void 0);$([S(),v("design:type",String)],mn.prototype,"message",void 0);$([S(),v("design:type",String)],mn.prototype,"type",void 0);$([S(),v("design:type",String)],mn.prototype,"addon",void 0);mn=$([Y()],mn);var Zt=class{};$([S(),v("design:type",String)],Zt.prototype,"description",void 0);$([S(),v("design:type",String)],Zt.prototype,"appName",void 0);$([S(),v("design:type",String)],Zt.prototype,"appUrl",void 0);$([S(),v("design:type",String)],Zt.prototype,"appIconPath",void 0);$([S(),v("design:type",String)],Zt.prototype,"trigger",void 0);$([S(),v("design:type",Array)],Zt.prototype,"perspectiveIds",void 0);$([S(),v("design:type",String)],Zt.prototype,"webhookUrl",void 0);$([S(),v("design:type",String)],Zt.prototype,"webhookAuth",void 0);Zt=$([Xe()],Zt);var Mt=class{};$([S(),v("design:type",String)],Mt.prototype,"id",void 0);$([S(),v("design:type",Boolean)],Mt.prototype,"granted",void 0);$([S(),v("design:type",String)],Mt.prototype,"description",void 0);$([S(),v("design:type",String)],Mt.prototype,"appName",void 0);$([S(),v("design:type",String)],Mt.prototype,"appUrl",void 0);$([S(),v("design:type",String)],Mt.prototype,"appIconPath",void 0);$([S(),v("design:type",String)],Mt.prototype,"trigger",void 0);$([S(),v("design:type",Array)],Mt.prototype,"perspectiveIds",void 0);$([S(),v("design:type",String)],Mt.prototype,"webhookUrl",void 0);$([S(),v("design:type",String)],Mt.prototype,"webhookAuth",void 0);Mt=$([Y()],Mt);var ga=class{};$([S(),v("design:type",Mt)],ga.prototype,"notification",void 0);$([S(),v("design:type",String)],ga.prototype,"perspectiveId",void 0);$([S(),v("design:type",String)],ga.prototype,"triggerMatch",void 0);ga=$([Y()],ga);var Ye=class{};$([S(),v("design:type",Number)],Ye.prototype,"total",void 0);$([S(),v("design:type",Number)],Ye.prototype,"imported",void 0);$([S(),v("design:type",Number)],Ye.prototype,"failed",void 0);$([S(),v("design:type",Number)],Ye.prototype,"omitted",void 0);$([S(),v("design:type",Array)],Ye.prototype,"errors",void 0);Ye=$([Y()],Ye);var Ut=class{};$([S(),v("design:type",Ye)],Ut.prototype,"perspectives",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"links",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"expressions",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"perspectiveDiffs",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"notifications",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"models",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"defaultModels",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"tasks",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"friends",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"trustedAgents",void 0);$([S(),v("design:type",Ye)],Ut.prototype,"knownLinkLanguages",void 0);Ut=$([Y()],Ut);var Ur=class{};$([S(),v("design:type",String)],Ur.prototype,"email",void 0);$([S(),v("design:type",String)],Ur.prototype,"did",void 0);$([S(),v("design:type",String)],Ur.prototype,"lastSeen",void 0);$([S(),v("design:type",Number)],Ur.prototype,"perspectiveCount",void 0);$([S(),v("design:type",String)],Ur.prototype,"remainingCredits",void 0);$([S(),v("design:type",Boolean)],Ur.prototype,"freeAccess",void 0);$([S(),v("design:type",String)],Ur.prototype,"hotWalletAddress",void 0);Ur=$([Y()],Ur);var gn=class{};$([S(),v("design:type",Boolean)],gn.prototype,"success",void 0);$([S(),v("design:type",String)],gn.prototype,"message",void 0);$([S(),v("design:type",Boolean)],gn.prototype,"requiresPassword",void 0);$([S(),v("design:type",Boolean)],gn.prototype,"isExistingUser",void 0);gn=$([Y()],gn);var _i=class{constructor(e,t,i,n=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=i,this.freeAccess=n}};$([S(),v("design:type",String)],_i.prototype,"email",void 0);$([S(),v("design:type",String)],_i.prototype,"remainingCredits",void 0);$([S(),v("design:type",String)],_i.prototype,"hotWalletAddress",void 0);$([S(),v("design:type",Boolean)],_i.prototype,"freeAccess",void 0);_i=$([Y(),v("design:paramtypes",[String,String,String,Boolean])],_i);var Kt=class{constructor(e,t){this.success=e,this.message=t}};$([S(),v("design:type",Boolean)],Kt.prototype,"success",void 0);$([S(),v("design:type",String)],Kt.prototype,"message",void 0);Kt=$([Y(),v("design:paramtypes",[Boolean,String])],Kt);var jr=class{constructor(e,t,i,n,a,o,s){this.id=e,this.userEmail=t,this.timestamp=i,this.operation=n,this.cost=a,this.creditsAfter=o,this.summary=s}};$([S(),v("design:type",Number)],jr.prototype,"id",void 0);$([S(),v("design:type",String)],jr.prototype,"userEmail",void 0);$([S(),v("design:type",String)],jr.prototype,"timestamp",void 0);$([S(),v("design:type",String)],jr.prototype,"operation",void 0);$([S(),v("design:type",String)],jr.prototype,"summary",void 0);$([S(),v("design:type",Number)],jr.prototype,"cost",void 0);$([S(),v("design:type",Number)],jr.prototype,"creditsAfter",void 0);jr=$([Y(),v("design:paramtypes",[Number,String,String,String,Number,Number,String])],jr);var j=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return ui}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[ui]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:ui}]}runtimeMessageReceived(){return ui}exceptionOccurred(){return{title:"Test title",message:"Test message",type:fp.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeFreeHostingEnabled(){return!0}runtimeSetFreeHostingEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5,remainingCredits:"0",freeAccess:!1}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new cn("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}runtimeHostingUserInfo(){return new _i("test@example.com","100000000",null,!1)}runtimeComputeLog(e,t,i){return[]}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Kt(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new Kt(!0,"")}runtimeSendHot(e,t){return new Kt(!0,"")}runtimeSetUnytMembraneProof(e){return new Kt(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytAgentKey(){return""}runtimeUnytVersionInfo(){return""}};$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeQuit",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeOpenLink",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ma)],j.prototype,"runtimeInfo",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"addTrustedAgents",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"deleteTrustedAgents",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],j.prototype,"getTrustedAgents",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],j.prototype,"runtimeKnownLinkLanguageTemplates",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"runtimeAddKnownLinkLanguageTemplates",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],j.prototype,"runtimeFriends",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"runtimeAddFriends",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],j.prototype,"runtimeRemoveFriends",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeHcAgentInfos",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeGetNetworkMetrics",null);$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeRestartHolochain",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],j.prototype,"runtimeHcAddAgentInfos",null);$([qe(),z(0,H()),z(1,H()),z(2,H()),z(3,H()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],j.prototype,"runtimeVerifyStringSignedByDid",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Sr]),v("design:returntype",Boolean)],j.prototype,"runtimeSetStatus",null);$([qe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",sn)],j.prototype,"runtimeFriendStatus",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,xc]),v("design:returntype",Boolean)],j.prototype,"runtimeFriendSendMessage",null);$([qe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],j.prototype,"runtimeMessageInbox",null);$([qe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],j.prototype,"runtimeMessageOutbox",null);$([vp(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",sn)],j.prototype,"runtimeMessageReceived",null);$([vp(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",mn)],j.prototype,"exceptionOccurred",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Zt]),v("design:returntype",String)],j.prototype,"runtimeRequestInstallNotification",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],j.prototype,"runtimeNotifications",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,Zt]),v("design:returntype",Boolean)],j.prototype,"runtimeUpdateNotification",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeRemoveNotification",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeGrantNotification",null);$([vp(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ga)],j.prototype,"runtimeNotificationTriggered",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeExportDb",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeImportDb",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],j.prototype,"runtimeExportPerspective",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeImportPerspective",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeMultiUserEnabled",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],j.prototype,"runtimeSetMultiUserEnabled",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeFreeHostingEnabled",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],j.prototype,"runtimeSetFreeHostingEnabled",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],j.prototype,"runtimeListUsers",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,_r]),v("design:returntype",gn)],j.prototype,"runtimeRequestLoginVerification",null);$([oe(),z(0,H()),z(1,H()),z(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],j.prototype,"runtimeVerifyEmailCode",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeTestEmail",null);$([oe(),z(0,H()),z(1,H()),z(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,_r]),v("design:returntype",cn)],j.prototype,"runtimeCreateUser",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],j.prototype,"runtimeLoginUser",null);$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeEmailTestModeEnable",null);$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeEmailTestModeDisable",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],j.prototype,"runtimeEmailTestGetCode",null);$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],j.prototype,"runtimeEmailTestClearCodes",null);$([oe(),z(0,H()),z(1,H()),z(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],j.prototype,"runtimeEmailTestSetExpiry",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",_i)],j.prototype,"runtimeHostingUserInfo",null);$([qe(),z(0,H()),z(1,H()),z(2,H()),v("design:type",Function),v("design:paramtypes",[String,Number,String]),v("design:returntype",Array)],j.prototype,"runtimeComputeLog",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],j.prototype,"runtimeSetHotWalletAddress",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Kt)],j.prototype,"runtimeRequestPayment",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,Number]),v("design:returntype",Boolean)],j.prototype,"runtimeSetUserCredits",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,Boolean]),v("design:returntype",Boolean)],j.prototype,"runtimeSetUserFreeAccess",null);$([oe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Kt)],j.prototype,"runtimeReinstallUnytDna",null);$([oe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Kt)],j.prototype,"runtimeSendHot",null);$([oe(),z(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Kt)],j.prototype,"runtimeSetUnytMembraneProof",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeHotWalletBalance",null);$([qe(),z(0,H()),z(1,H()),v("design:type",Function),v("design:paramtypes",[Number,Number]),v("design:returntype",String)],j.prototype,"runtimeHotWalletHistory",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeHotAgentPubkey",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeUnytAgentKey",null);$([qe(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],j.prototype,"runtimeUnytVersionInfo",null);j=$([e0()],j);var J1=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Jo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of J1(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var Z1="https://hosting.ad4m.dev";function Y1(r){try{return new URL(r),!0}catch(e){return!1}}function Lp(r){return Q(this,null,function*(){let e=r||Z1,t=yield fetch(`${e}/hosts`);if(!t.ok)throw new Error(`Failed to fetch hosts: ${t.status}`);let i=yield t.json();for(let n of i)n.profilePicUrl&&!Y1(n.profilePicUrl)&&(n.profilePicUrl=new URL(n.profilePicUrl,e).toString());return i})}function Dg(r){return Q(this,null,function*(){let e=yield r.agent.hostingUserInfo();return{email:e.email,remainingCredits:e.remainingCredits==="unlimited"?1/0:parseFloat(e.remainingCredits)||0,hotWalletAddress:e.hotWalletAddress||null,freeAccess:e.freeAccess}})}function Fg(r,e){return Q(this,null,function*(){return r.agent.requestPayment(e.toString())})}var X1=12e3,e_="https://hosting.ad4m.dev",t_=6e4,r_=10,Zo=class extends EventTarget{constructor(t){var n;super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;this.connectedHost=null;this.userInfo=null;this.creditPollInterval=null;Jo(this),this.options=t,this.port=t.port||parseInt(Wa("ad4m-port"))||X1,this.url=t.url||Wa("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Wa("ad4m-token")||"",this.embedded=Bs(),this.hostIndexUrl=t.hostIndexUrl||e_,this.lowCreditThreshold=(n=t.lowCreditThreshold)!=null?n:r_;let i=Wa("ad4m-last-host");if(i)try{let a=JSON.parse(i);a&&a.id&&a.url&&a.name&&(this.connectedHost={id:a.id,name:a.name,profilePicUrl:a.profilePicUrl||"",location:a.location||"",url:a.url,rates:a.rates||[],aiModels:a.aiModels||[]})}catch(a){}this.embedded&&this.initializeEmbeddedMode()}connect(){return Q(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,i)=>{let n=setTimeout(()=>{i(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(n),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(n),i(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(n),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(n),i(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield ji(this.url),dt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return Q(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=wu({url:this.url,connectionParams:()=>Q(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:t=>Q(this,null,function*(){if(!(t.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(i){console.error("[Ad4m Connect] Reconnection failed:",i),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new qo(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new vu({link:new eh(t),cache:new Ns({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,i){return Q(this,null,function*(){let n=wu({url:t,connectionParams:()=>Q(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(n),o=new qo(a);try{return yield i(o)}finally{n.dispose()}})}checkAuth(){return Q(this,null,function*(){try{return console.log("[Ad4m Connect] Checking authentication status..."),(yield this.ad4mClient.agent.isLocked())?(console.log("[Ad4m Connect] Agent wallet is locked"),this.notifyAuthChange("locked")):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){console.error("[Ad4m Connect] Authentication check failed:",t);let i="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===i?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",Kn("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return Q(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="",Kn("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.connectedHost=null,this.userInfo=null,this.stopCreditPolling(),Kn("ad4m-last-host"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}startCreditSubscription(){if(!!this.ad4mClient){try{this.ad4mClient.agent.addHostingUserInfoChangedListener(t=>{let i={email:t.email,remainingCredits:t.remainingCredits==="unlimited"?1/0:parseFloat(t.remainingCredits)||0,hotWalletAddress:t.hotWalletAddress||null,freeAccess:t.freeAccess};this.userInfo=i,this.dispatchEvent(new CustomEvent("userinfochange",{detail:i})),i.remainingCredits<=0&&this.dispatchEvent(new CustomEvent("creditdepleted")),i.remainingCredits<=this.lowCreditThreshold&&this.dispatchEvent(new CustomEvent("creditlow"))}),this.ad4mClient.agent.subscribeHostingUserInfoChanged()}catch(t){console.warn("[Ad4m Connect] Subscription not available, falling back to polling:",t)}try{this.ad4mClient.agent.addComputeLogUpdatedListener(t=>{this.dispatchEvent(new CustomEvent("computelogentry",{detail:t}))}),this.ad4mClient.agent.subscribeComputeLogUpdated()}catch(t){console.warn("[Ad4m Connect] Compute log subscription not available:",t)}this.startCreditPolling()}}startCreditPolling(){this.stopCreditPolling();let t=()=>Q(this,null,function*(){try{if(!this.ad4mClient)return;let i=yield Dg(this.ad4mClient);this.userInfo=i,this.dispatchEvent(new CustomEvent("userinfochange",{detail:i})),i.remainingCredits<=this.lowCreditThreshold&&this.dispatchEvent(new CustomEvent("creditlow")),i.remainingCredits<=0&&this.dispatchEvent(new CustomEvent("creditdepleted"))}catch(i){console.error("[Ad4m Connect] Credit polling error:",i)}});t(),this.creditPollInterval=setInterval(t,t_)}stopCreditPolling(){this.creditPollInterval&&(clearInterval(this.creditPollInterval),this.creditPollInterval=null)}requestTopUp(t){return Q(this,null,function*(){if(!this.ad4mClient)throw new Error("Not connected");return Fg(this.ad4mClient,t)})}fetchComputeLog(t,i){return Q(this,null,function*(){if(!this.ad4mClient)throw new Error("Not connected");return this.ad4mClient.agent.computeLog(t,i)})}setConnectedHost(t){this.connectedHost=t,dt("ad4m-last-host",JSON.stringify({id:t.id,url:t.url,name:t.name,location:t.location}))}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>Q(this,null,function*(){var i;if(((i=t.data)==null?void 0:i.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:n,token:a}=t.data;if(n==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(n,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${n} (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`,dt("ad4m-port",o.toString()),s?dt("ad4m-token",s):Kn("ad4m-token"),dt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return Q(this,null,function*(){return t&&(this.token="",Kn("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return Q(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 i=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=i,dt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Code verification failed:",i),!1}})}isValidAd4mAPI(){return Q(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Q(this,null,function*(){return yield t.runtime.info()})),!0}catch(t){return console.error("[Ad4m Connect] Failed to verify AD4M API:",t),!1}})}isMultiUser(){return Q(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Q(this,null,function*(){return yield t.runtime.multiUserEnabled()}))}catch(t){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",t),!1}})}submitEmail(t){return Q(this,null,function*(){try{return yield this.withTempClient(this.url,i=>Q(this,null,function*(){return yield i.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(i){return{success:!1,message:i.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,i){return Q(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>Q(this,null,function*(){return yield a.agent.verifyEmailCode(t,i,"login")}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Email code verification failed:",n),!1}})}loginWithPassword(t,i){return Q(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>Q(this,null,function*(){return yield a.agent.loginUser(t,i)}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Password login failed:",n),!1}})}createAccount(t,i){return Q(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>Q(this,null,function*(){let o=yield a.agent.createUser(t,i);if(o.success)return yield a.agent.loginUser(t,i);throw new Error(o.error||"Failed to create account")}));return this.token=n,dt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Account creation error:",n),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let i=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(i))}}notifyConfigChange(t,i){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:i}}))}};var Zc=window,Yc=Zc.ShadowRoot&&(Zc.ShadyCSS===void 0||Zc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Np=Symbol(),Mg=new WeakMap,Yo=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Np)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Yc&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Mg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Mg.set(t,e))}return e}toString(){return this.cssText}},Ug=r=>new Yo(typeof r=="string"?r:r+"",void 0,Np),Ge=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new Yo(t,r,Np)},Dp=(r,e)=>{Yc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Zc.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},Xc=Yc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Ug(t)})(r):r;var Fp,el=window,jg=el.trustedTypes,i_=jg?jg.emptyScript:"",qg=el.reactiveElementPolyfillSupport,Up={toAttribute(r,e){switch(e){case Boolean:r=r?i_:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Bg=(r,e)=>e!==r&&(e==e||r==r),Mp={attribute:!0,type:String,converter:Up,reflect:!1,hasChanged:Bg},jp="finalized",qr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=Mp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Mp}static finalize(){if(this.hasOwnProperty(jp))return!1;this[jp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(Xc(n))}else e!==void 0&&t.push(Xc(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Dp(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=Mp){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Up).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Up;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Bg)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};qr[jp]=!0,qr.elementProperties=new Map,qr.elementStyles=[],qr.shadowRootOptions={mode:"open"},qg?.({ReactiveElement:qr}),((Fp=el.reactiveElementVersions)!==null&&Fp!==void 0?Fp:el.reactiveElementVersions=[]).push("1.6.3");var qp,tl=window,xa=tl.trustedTypes,Vg=xa?xa.createPolicy("lit-html",{createHTML:r=>r}):void 0,Vp="$lit$",Ai=`lit$${(Math.random()+"").slice(9)}$`,Jg="?"+Ai,n_=`<${Jg}>`,In=document,es=()=>In.createComment(""),ts=r=>r===null||typeof r!="object"&&typeof r!="function",Zg=Array.isArray,a_=r=>Zg(r)||typeof r?.[Symbol.iterator]=="function",Bp=`[
|
|
1779
|
+
\f\r]`,Xo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Qg=/-->/g,Hg=/>/g,An=RegExp(`>|${Bp}(?:([^\\s"'>=/]+)(${Bp}*=${Bp}*(?:[^
|
|
1780
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),zg=/'/g,Wg=/"/g,Yg=/^(?:script|style|textarea|title)$/i,Xg=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),L=Xg(1),UO=Xg(2),Tn=Symbol.for("lit-noChange"),et=Symbol.for("lit-nothing"),Gg=new WeakMap,kn=In.createTreeWalker(In,129,null,!1);function ey(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Vg!==void 0?Vg.createHTML(e):e}var o_=(r,e)=>{let t=r.length-1,i=[],n,a=e===2?"<svg>":"",o=Xo;for(let s=0;s<t;s++){let c=r[s],l,u,f=-1,d=0;for(;d<c.length&&(o.lastIndex=d,u=o.exec(c),u!==null);)d=o.lastIndex,o===Xo?u[1]==="!--"?o=Qg:u[1]!==void 0?o=Hg:u[2]!==void 0?(Yg.test(u[2])&&(n=RegExp("</"+u[2],"g")),o=An):u[3]!==void 0&&(o=An):o===An?u[0]===">"?(o=n??Xo,f=-1):u[1]===void 0?f=-2:(f=o.lastIndex-u[2].length,l=u[1],o=u[3]===void 0?An:u[3]==='"'?Wg:zg):o===Wg||o===zg?o=An:o===Qg||o===Hg?o=Xo:(o=An,n=void 0);let p=o===An&&r[s+1].startsWith("/>")?" ":"";a+=o===Xo?c+n_:f>=0?(i.push(l),c.slice(0,f)+Vp+c.slice(f)+Ai+p):c+Ai+(f===-2?(i.push(void 0),s):p)}return[ey(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),i]},Cn=class{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[l,u]=o_(e,t);if(this.el=Cn.createElement(l,i),kn.currentNode=this.el.content,t===2){let f=this.el.content,d=f.firstChild;d.remove(),f.append(...d.childNodes)}for(;(n=kn.nextNode())!==null&&c.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let f=[];for(let d of n.getAttributeNames())if(d.endsWith(Vp)||d.startsWith(Ai)){let p=u[o++];if(f.push(d),p!==void 0){let h=n.getAttribute(p.toLowerCase()+Vp).split(Ai),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Hp:m[1]==="?"?zp:m[1]==="@"?Wp:Aa})}else c.push({type:6,index:a})}for(let d of f)n.removeAttribute(d)}if(Yg.test(n.tagName)){let f=n.textContent.split(Ai),d=f.length-1;if(d>0){n.textContent=xa?xa.emptyScript:"";for(let p=0;p<d;p++)n.append(f[p],es()),kn.nextNode(),c.push({type:2,index:++a});n.append(f[d],es())}}}else if(n.nodeType===8)if(n.data===Jg)c.push({type:2,index:a});else{let f=-1;for(;(f=n.data.indexOf(Ai,f+1))!==-1;)c.push({type:7,index:a}),f+=Ai.length-1}a++}}static createElement(e,t){let i=In.createElement("template");return i.innerHTML=e,i}};function Ea(r,e,t=r,i){var n,a,o,s;if(e===Tn)return e;let c=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl,l=ts(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(r),c._$AT(r,t,i)),i!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=c:t._$Cl=c),c!==void 0&&(e=Ea(r,c._$AS(r,e.values),c,i)),e}var Qp=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:i},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:In).importNode(i,!0);kn.currentNode=a;let o=kn.nextNode(),s=0,c=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new $n(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new Gp(o,this,e)),this._$AV.push(u),l=n[++c]}s!==l?.index&&(o=kn.nextNode(),s++)}return kn.currentNode=In,a}v(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},$n=class{constructor(e,t,i,n){var a;this.type=2,this._$AH=et,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ea(this,e,t),ts(e)?e===et||e==null||e===""?(this._$AH!==et&&this._$AR(),this._$AH=et):e!==this._$AH&&e!==Tn&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):a_(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==et&&ts(this._$AH)?this._$AA.nextSibling.data=e:this.$(In.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=Cn.createElement(ey(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(i);else{let o=new Qp(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let t=Gg.get(e.strings);return t===void 0&&Gg.set(e.strings,t=new Cn(e)),t}T(e){Zg(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let a of e)n===t.length?t.push(i=new $n(this.k(es()),this.k(es()),this,this.options)):i=t[n],i._$AI(a),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Aa=class{constructor(e,t,i,n,a){this.type=1,this._$AH=et,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=et}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=Ea(this,e,t,0),o=!ts(e)||e!==this._$AH&&e!==Tn,o&&(this._$AH=e);else{let s=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Ea(this,s[i+c],t,c),l===Tn&&(l=this._$AH[c]),o||(o=!ts(l)||l!==this._$AH[c]),l===et?e=et:e!==et&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}o&&!n&&this.j(e)}j(e){e===et?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Hp=class extends Aa{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===et?void 0:e}},s_=xa?xa.emptyScript:"",zp=class extends Aa{constructor(){super(...arguments),this.type=4}j(e){e&&e!==et?this.element.setAttribute(this.name,s_):this.element.removeAttribute(this.name)}},Wp=class extends Aa{constructor(e,t,i,n,a){super(e,t,i,n,a),this.type=5}_$AI(e,t=this){var i;if((e=(i=Ea(this,e,t,0))!==null&&i!==void 0?i:et)===Tn)return;let n=this._$AH,a=e===et&&n!==et||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==et&&(n===et||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},Gp=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ea(this,e)}};var Kg=tl.litHtmlPolyfillSupport;Kg?.(Cn,$n),((qp=tl.litHtmlVersions)!==null&&qp!==void 0?qp:tl.litHtmlVersions=[]).push("2.8.0");var ty=(r,e,t)=>{var i,n;let a=(i=t?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new $n(e.insertBefore(es(),s),s,void 0,t??{})}return o._$AI(r),o};var Kp,Jp;var Me=class extends qr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ty(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return Tn}};Me.finalized=!0,Me._$litElement$=!0,(Kp=globalThis.litElementHydrateSupport)===null||Kp===void 0||Kp.call(globalThis,{LitElement:Me});var ry=globalThis.litElementPolyfillSupport;ry?.({LitElement:Me});((Jp=globalThis.litElementVersions)!==null&&Jp!==void 0?Jp:globalThis.litElementVersions=[]).push("3.3.3");var ut=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var c_=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},l_=(r,e,t)=>{e.constructor.createProperty(t,r)};function fe(r){return(e,t)=>t!==void 0?l_(r,e,t):c_(r,e)}function ie(r){return fe({...r,state:!0})}var Zp,d2=((Zp=window.HTMLSlotElement)===null||Zp===void 0?void 0:Zp.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);function On(){return L`
|
|
1720
1781
|
<svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1721
1782
|
<path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
|
|
1722
1783
|
</svg>
|
|
1723
|
-
`}function
|
|
1784
|
+
`}function ka(){return L`
|
|
1724
1785
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
1725
1786
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1726
1787
|
<circle cx="12" cy="12" r="3" fill="currentColor"></circle>
|
|
1727
1788
|
</svg>
|
|
1728
|
-
`}function
|
|
1789
|
+
`}function rl(){return L`
|
|
1729
1790
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
1730
1791
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1731
1792
|
<path d="M2 12h20"></path>
|
|
1732
1793
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
|
1733
1794
|
</svg>
|
|
1734
|
-
`}function
|
|
1795
|
+
`}function il(){return L`
|
|
1735
1796
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1736
1797
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
1737
1798
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
1738
1799
|
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
1739
1800
|
</svg>
|
|
1740
|
-
`}function Ot(){return
|
|
1801
|
+
`}function Ot(){return L`
|
|
1741
1802
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
|
1742
1803
|
<rect width="256" height="256" fill="none"/>
|
|
1743
1804
|
<polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
1744
1805
|
</svg>
|
|
1745
|
-
`}function wt(){return
|
|
1806
|
+
`}function wt(){return L`
|
|
1746
1807
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
|
|
1747
1808
|
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
1748
1809
|
</svg>
|
|
1749
|
-
`}function
|
|
1810
|
+
`}function nl(){return L`
|
|
1750
1811
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
|
|
1751
1812
|
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
|
|
1752
1813
|
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
|
|
1753
1814
|
</svg>
|
|
1754
|
-
`}function
|
|
1815
|
+
`}function al(){return L`
|
|
1755
1816
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
|
|
1756
1817
|
<path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5m14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5"/>
|
|
1757
1818
|
</svg>
|
|
1758
|
-
`}function
|
|
1819
|
+
`}function ol(){return L`
|
|
1759
1820
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
|
|
1760
1821
|
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
|
|
1761
1822
|
</svg>
|
|
1762
|
-
`}function
|
|
1823
|
+
`}function sl(){return L`
|
|
1763
1824
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1764
1825
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1765
1826
|
<path d="M2 12h20"></path>
|
|
1766
1827
|
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
|
|
1767
1828
|
</svg>
|
|
1768
|
-
`}function
|
|
1829
|
+
`}function ki(){return L`
|
|
1769
1830
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1770
1831
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1771
1832
|
<path d="M12 6v12"></path>
|
|
1772
1833
|
<path d="M15.5 9.5a3 3 0 0 0-3-2.5H11a3 3 0 0 0 0 6h2a3 3 0 0 1 0 6h-1.5a3 3 0 0 1-3-2.5"></path>
|
|
1773
1834
|
</svg>
|
|
1774
|
-
`}function
|
|
1835
|
+
`}function cl(){return L`
|
|
1775
1836
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
1776
1837
|
<rect x="2" y="6" width="20" height="14" rx="2"></rect>
|
|
1777
1838
|
<path d="M2 10h20"></path>
|
|
1778
1839
|
<circle cx="16" cy="14" r="1" fill="currentColor"></circle>
|
|
1779
1840
|
</svg>
|
|
1780
|
-
`}function
|
|
1841
|
+
`}function Ii(){return L`
|
|
1781
1842
|
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
|
|
1782
1843
|
<path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/>
|
|
1783
1844
|
</svg>
|
|
1784
|
-
`}var
|
|
1845
|
+
`}var Rt=Ge`
|
|
1785
1846
|
* {
|
|
1786
1847
|
box-sizing: border-box;
|
|
1787
1848
|
}
|
|
@@ -2084,7 +2145,7 @@ input VoiceActivityParamsInput {
|
|
|
2084
2145
|
@keyframes spin {
|
|
2085
2146
|
to { transform: rotate(360deg); }
|
|
2086
2147
|
}
|
|
2087
|
-
`;var
|
|
2148
|
+
`;var qt=class extends Me{constructor(){super(...arguments);this.showHosting=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return Q(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return Q(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}browseHosts(){this.dispatchEvent(new CustomEvent("browse-hosts",{bubbles:!0,composed:!0}))}detectLocalNode(){return Q(this,null,function*(){try{yield ji(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return Q(this,null,function*(){nd(qt.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port)}render(){return this.loading?null:L`
|
|
2088
2149
|
<div class="container">
|
|
2089
2150
|
<div class="header">
|
|
2090
2151
|
<h1>Connect AD4M</h1>
|
|
@@ -2092,14 +2153,14 @@ input VoiceActivityParamsInput {
|
|
|
2092
2153
|
</div>
|
|
2093
2154
|
|
|
2094
2155
|
<div class="options">
|
|
2095
|
-
${!this.isMobile||!this.showHosting?
|
|
2156
|
+
${!this.isMobile||!this.showHosting?L`
|
|
2096
2157
|
<div class="box">
|
|
2097
2158
|
<div class="box-header">
|
|
2098
|
-
${
|
|
2159
|
+
${ka()}
|
|
2099
2160
|
<h3>Local Node</h3>
|
|
2100
2161
|
</div>
|
|
2101
2162
|
|
|
2102
|
-
${this.localNodeDetected?
|
|
2163
|
+
${this.localNodeDetected?L`
|
|
2103
2164
|
<div class="state success">
|
|
2104
2165
|
${Ot()}
|
|
2105
2166
|
<p>Local node detected on port ${this.port}</p>
|
|
@@ -2108,7 +2169,7 @@ input VoiceActivityParamsInput {
|
|
|
2108
2169
|
<button class="primary" @click=${this.connectLocalNode}>
|
|
2109
2170
|
Connect to Local Node
|
|
2110
2171
|
</button>
|
|
2111
|
-
`:
|
|
2172
|
+
`:L`
|
|
2112
2173
|
<div class="state danger">
|
|
2113
2174
|
${wt()}
|
|
2114
2175
|
<p>No local node detected on port ${this.port}</p>
|
|
@@ -2116,7 +2177,7 @@ input VoiceActivityParamsInput {
|
|
|
2116
2177
|
|
|
2117
2178
|
<p style="margin-bottom: -12px">Download and install AD4M</p>
|
|
2118
2179
|
<button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
|
|
2119
|
-
${
|
|
2180
|
+
${il()} Download AD4M
|
|
2120
2181
|
</button>
|
|
2121
2182
|
`}
|
|
2122
2183
|
|
|
@@ -2130,16 +2191,16 @@ input VoiceActivityParamsInput {
|
|
|
2130
2191
|
@keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
|
|
2131
2192
|
/>
|
|
2132
2193
|
<button class="primary" @click=${this.refreshPort}>
|
|
2133
|
-
${
|
|
2194
|
+
${nl()}
|
|
2134
2195
|
</button>
|
|
2135
2196
|
</div>
|
|
2136
2197
|
</div>
|
|
2137
2198
|
`:""}
|
|
2138
2199
|
|
|
2139
|
-
${this.showHosting?
|
|
2200
|
+
${this.showHosting?L`
|
|
2140
2201
|
<div class="box">
|
|
2141
2202
|
<div class="box-header">
|
|
2142
|
-
${
|
|
2203
|
+
${sl()}
|
|
2143
2204
|
<h3>Remote Node</h3>
|
|
2144
2205
|
</div>
|
|
2145
2206
|
|
|
@@ -2152,7 +2213,7 @@ input VoiceActivityParamsInput {
|
|
|
2152
2213
|
`:""}
|
|
2153
2214
|
</div>
|
|
2154
2215
|
</div>
|
|
2155
|
-
`}};
|
|
2216
|
+
`}};qt.styles=[Rt,Ge`
|
|
2156
2217
|
.options {
|
|
2157
2218
|
display: flex;
|
|
2158
2219
|
flex-direction: column;
|
|
@@ -2181,7 +2242,7 @@ input VoiceActivityParamsInput {
|
|
|
2181
2242
|
button {
|
|
2182
2243
|
width: 100%;
|
|
2183
2244
|
}
|
|
2184
|
-
`],
|
|
2245
|
+
`],M([fe({type:Number})],qt.prototype,"port",2),M([fe({type:Boolean})],qt.prototype,"showHosting",2),M([ie()],qt.prototype,"loading",2),M([ie()],qt.prototype,"localNodeDetected",2),M([ie()],qt.prototype,"newPort",2),M([ie()],qt.prototype,"isMobile",2),qt=M([ut("connection-options")],qt);var Yt=class extends Me{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode="";this.verifying=!1}willUpdate(t){t.has("verificationError")&&this.verificationError&&(this.verifying=!1)}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.verifying=!0,this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let i=t.target,n=i.value.replace(/\D/g,"").slice(0,6);i.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return L`
|
|
2185
2246
|
<div class="container">
|
|
2186
2247
|
<div class="header">
|
|
2187
2248
|
<h1>${this.appname}</h1>
|
|
@@ -2189,12 +2250,12 @@ input VoiceActivityParamsInput {
|
|
|
2189
2250
|
</div>
|
|
2190
2251
|
|
|
2191
2252
|
<div class="connection-icons">
|
|
2192
|
-
${this.appiconpath?
|
|
2193
|
-
<div class="arrow-icon">${
|
|
2194
|
-
<div class="ad4m-logo">${
|
|
2253
|
+
${this.appiconpath?L`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:L`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
|
|
2254
|
+
<div class="arrow-icon">${al()}</div>
|
|
2255
|
+
<div class="ad4m-logo">${On()}</div>
|
|
2195
2256
|
</div>
|
|
2196
2257
|
|
|
2197
|
-
${this.requestSent?
|
|
2258
|
+
${this.requestSent?L`
|
|
2198
2259
|
<div class="state success" style="margin-bottom: -12px">
|
|
2199
2260
|
${Ot()}
|
|
2200
2261
|
<p>Auth request sent to local AD4M node</p>
|
|
@@ -2212,20 +2273,20 @@ input VoiceActivityParamsInput {
|
|
|
2212
2273
|
.value=${this.securityCode||""}
|
|
2213
2274
|
@input=${this.onInputChange}
|
|
2214
2275
|
/>
|
|
2215
|
-
${this.verifying?
|
|
2276
|
+
${this.verifying?L`<div class="spinner"></div>`:""}
|
|
2216
2277
|
</div>
|
|
2217
2278
|
|
|
2218
|
-
${this.verificationError?
|
|
2279
|
+
${this.verificationError?L`
|
|
2219
2280
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2220
2281
|
${wt()}
|
|
2221
2282
|
<p>Verification failed. Please try again.</p>
|
|
2222
2283
|
</div>
|
|
2223
2284
|
`:""}
|
|
2224
|
-
`:
|
|
2285
|
+
`:L`
|
|
2225
2286
|
<p>This will allow ${this.appname} to</p>
|
|
2226
2287
|
|
|
2227
2288
|
<ul class="box">
|
|
2228
|
-
${this.capabilities.map(t=>
|
|
2289
|
+
${this.capabilities.map(t=>L`<li>${Ot()}<p>${Bm(t)}</p></li>`)}
|
|
2229
2290
|
</ul>
|
|
2230
2291
|
|
|
2231
2292
|
<div class="row center">
|
|
@@ -2235,7 +2296,7 @@ input VoiceActivityParamsInput {
|
|
|
2235
2296
|
</div>
|
|
2236
2297
|
`}
|
|
2237
2298
|
</div>
|
|
2238
|
-
`}};
|
|
2299
|
+
`}};Yt.styles=[Rt,Ge`
|
|
2239
2300
|
h1 {
|
|
2240
2301
|
font-size: 34px;
|
|
2241
2302
|
}
|
|
@@ -2319,15 +2380,15 @@ input VoiceActivityParamsInput {
|
|
|
2319
2380
|
.state {
|
|
2320
2381
|
justify-content: center;
|
|
2321
2382
|
}
|
|
2322
|
-
`],
|
|
2383
|
+
`],M([fe({type:Array})],Yt.prototype,"capabilities",2),M([fe({type:String})],Yt.prototype,"appname",2),M([fe({type:String})],Yt.prototype,"appiconpath",2),M([fe({type:Boolean})],Yt.prototype,"verificationError",2),M([ie()],Yt.prototype,"requestSent",2),M([ie()],Yt.prototype,"securityCode",2),M([ie()],Yt.prototype,"verifying",2),Yt=M([ut("local-authentication")],Yt);var St=class extends Me{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.host=null;this.email="";this.password="";this.emailSecurityCode="";this.confirmPassword=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}disconnectedCallback(){super.disconnectedCallback(),this.clearSensitiveState()}clearSensitiveState(){this.password="",this.confirmPassword="",this.emailSecurityCode="",this.email=""}tryAgain(){this.clearSensitiveState(),this.dispatchEvent(new CustomEvent("reset-auth-state",{bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let i=t.target,n=i.value.replace(/\D/g,"").slice(0,6);i.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}get passwordsMatch(){return this.password.length>0&&this.password===this.confirmPassword}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,i=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,o=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return L`
|
|
2323
2384
|
<div class="container">
|
|
2324
2385
|
<div class="header">
|
|
2325
2386
|
<h1 style="font-size: 28px;">${n?"Login":a?"Register":"Login or Register"}</h1>
|
|
2326
|
-
${this.host?
|
|
2387
|
+
${this.host?L`<p style="font-size: 15px; color: rgba(255,255,255,0.4); margin-top: 10px;">${this.host.url}</p>`:""}
|
|
2327
2388
|
</div>
|
|
2328
2389
|
|
|
2329
|
-
${t?
|
|
2330
|
-
<h3>Enter your email to login to ${this.host?
|
|
2390
|
+
${t?L`
|
|
2391
|
+
<h3>Enter your email to login to ${this.host?L`<strong>${this.host.name}</strong>`:"the remote node"}</h3>
|
|
2331
2392
|
|
|
2332
2393
|
<div class="input-row">
|
|
2333
2394
|
<input
|
|
@@ -2346,7 +2407,7 @@ input VoiceActivityParamsInput {
|
|
|
2346
2407
|
</div>
|
|
2347
2408
|
`:""}
|
|
2348
2409
|
|
|
2349
|
-
${o?
|
|
2410
|
+
${o?L`
|
|
2350
2411
|
<div class="state danger">
|
|
2351
2412
|
${wt()}
|
|
2352
2413
|
<p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
|
|
@@ -2356,7 +2417,7 @@ input VoiceActivityParamsInput {
|
|
|
2356
2417
|
</div>
|
|
2357
2418
|
`:""}
|
|
2358
2419
|
|
|
2359
|
-
${i?
|
|
2420
|
+
${i?L`
|
|
2360
2421
|
<div class="state success" style="margin-bottom: -12px">
|
|
2361
2422
|
${Ot()}
|
|
2362
2423
|
<p>Email verification code sent</p>
|
|
@@ -2374,10 +2435,10 @@ input VoiceActivityParamsInput {
|
|
|
2374
2435
|
.value=${this.emailSecurityCode||""}
|
|
2375
2436
|
@input=${this.onEmailSecurityCodeChange}
|
|
2376
2437
|
/>
|
|
2377
|
-
${this.remoteAuthLoading?
|
|
2438
|
+
${this.remoteAuthLoading?L`<div class="spinner"></div>`:""}
|
|
2378
2439
|
</div>
|
|
2379
2440
|
|
|
2380
|
-
${this.emailCodeError?
|
|
2441
|
+
${this.emailCodeError?L`
|
|
2381
2442
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2382
2443
|
${wt()}
|
|
2383
2444
|
<p>Verification failed. Please try again.</p>
|
|
@@ -2385,7 +2446,7 @@ input VoiceActivityParamsInput {
|
|
|
2385
2446
|
`:""}
|
|
2386
2447
|
`:""}
|
|
2387
2448
|
|
|
2388
|
-
${n?
|
|
2449
|
+
${n?L`
|
|
2389
2450
|
<div class="state success" style="margin-bottom: -12px">
|
|
2390
2451
|
${Ot()}
|
|
2391
2452
|
<p>Account found</p>
|
|
@@ -2409,7 +2470,7 @@ input VoiceActivityParamsInput {
|
|
|
2409
2470
|
</button>
|
|
2410
2471
|
</div>
|
|
2411
2472
|
|
|
2412
|
-
${this.passwordError?
|
|
2473
|
+
${this.passwordError?L`
|
|
2413
2474
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2414
2475
|
${wt()}
|
|
2415
2476
|
<p>Incorrect password. Please try again.</p>
|
|
@@ -2417,7 +2478,7 @@ input VoiceActivityParamsInput {
|
|
|
2417
2478
|
`:""}
|
|
2418
2479
|
`:""}
|
|
2419
2480
|
|
|
2420
|
-
${a?
|
|
2481
|
+
${a?L`
|
|
2421
2482
|
<div class="state success">
|
|
2422
2483
|
${Ot()}
|
|
2423
2484
|
<p>Creating a new account for <strong>${this.email}</strong></p>
|
|
@@ -2444,7 +2505,7 @@ input VoiceActivityParamsInput {
|
|
|
2444
2505
|
/>
|
|
2445
2506
|
</div>
|
|
2446
2507
|
|
|
2447
|
-
${this.confirmPassword.length>0&&!this.passwordsMatch?
|
|
2508
|
+
${this.confirmPassword.length>0&&!this.passwordsMatch?L`<p style="font-size: 13px; color: var(--ac-danger-color); text-align: center;">Passwords do not match</p>`:""}
|
|
2448
2509
|
|
|
2449
2510
|
<div class="login-button">
|
|
2450
2511
|
<button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.passwordsMatch}>
|
|
@@ -2452,7 +2513,7 @@ input VoiceActivityParamsInput {
|
|
|
2452
2513
|
</button>
|
|
2453
2514
|
</div>
|
|
2454
2515
|
|
|
2455
|
-
${this.accountCreationError?
|
|
2516
|
+
${this.accountCreationError?L`
|
|
2456
2517
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2457
2518
|
${wt()}
|
|
2458
2519
|
<p>Failed to create account. Please try again.</p>
|
|
@@ -2461,7 +2522,7 @@ input VoiceActivityParamsInput {
|
|
|
2461
2522
|
`:""}
|
|
2462
2523
|
|
|
2463
2524
|
</div>
|
|
2464
|
-
`}};St.styles=[
|
|
2525
|
+
`}};St.styles=[Rt,Ge`
|
|
2465
2526
|
.header h1 {
|
|
2466
2527
|
font-size: 32px;
|
|
2467
2528
|
margin-bottom: 0;
|
|
@@ -2509,7 +2570,7 @@ input VoiceActivityParamsInput {
|
|
|
2509
2570
|
.state {
|
|
2510
2571
|
justify-content: center;
|
|
2511
2572
|
}
|
|
2512
|
-
`],
|
|
2573
|
+
`],M([fe({type:Object})],St.prototype,"remoteAuthState",2),M([fe({type:Boolean})],St.prototype,"remoteAuthLoading",2),M([fe({type:Boolean})],St.prototype,"emailCodeError",2),M([fe({type:Boolean})],St.prototype,"passwordError",2),M([fe({type:Boolean})],St.prototype,"accountCreationError",2),M([fe({type:Object})],St.prototype,"host",2),M([ie()],St.prototype,"email",2),M([ie()],St.prototype,"password",2),M([ie()],St.prototype,"emailSecurityCode",2),M([ie()],St.prototype,"confirmPassword",2),St=M([ut("remote-authentication")],St);var Ti=class extends Me{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return L`
|
|
2513
2574
|
<div class="container">
|
|
2514
2575
|
<div class="close-button" @click=${this.close}>
|
|
2515
2576
|
${wt()}
|
|
@@ -2522,11 +2583,11 @@ input VoiceActivityParamsInput {
|
|
|
2522
2583
|
|
|
2523
2584
|
<div class="box">
|
|
2524
2585
|
<div class="box-header">
|
|
2525
|
-
${t?
|
|
2586
|
+
${t?ka():rl()}
|
|
2526
2587
|
<h3>${t?"Local Node":"Remote Node"}</h3>
|
|
2527
2588
|
</div>
|
|
2528
2589
|
|
|
2529
|
-
${t?
|
|
2590
|
+
${t?L`
|
|
2530
2591
|
<div class="row">
|
|
2531
2592
|
<span>Port:</span>
|
|
2532
2593
|
<span class="detail-value">${this.port}</span>
|
|
@@ -2535,7 +2596,7 @@ input VoiceActivityParamsInput {
|
|
|
2535
2596
|
<span>URL:</span>
|
|
2536
2597
|
<span class="detail-value">${this.url}</span>
|
|
2537
2598
|
</div>
|
|
2538
|
-
`:
|
|
2599
|
+
`:L`
|
|
2539
2600
|
<div class="row">
|
|
2540
2601
|
<span>URL:</span>
|
|
2541
2602
|
<span class="detail-value">${this.url}</span>
|
|
@@ -2554,7 +2615,7 @@ input VoiceActivityParamsInput {
|
|
|
2554
2615
|
</button>
|
|
2555
2616
|
</div>
|
|
2556
2617
|
</div>
|
|
2557
|
-
`}};
|
|
2618
|
+
`}};Ti.styles=[Rt,Ge`
|
|
2558
2619
|
.box {
|
|
2559
2620
|
gap: 15px;
|
|
2560
2621
|
}
|
|
@@ -2589,7 +2650,7 @@ input VoiceActivityParamsInput {
|
|
|
2589
2650
|
background: rgba(244, 54, 127, 0.2);
|
|
2590
2651
|
color: var(--ac-danger-color);
|
|
2591
2652
|
}
|
|
2592
|
-
`],
|
|
2653
|
+
`],M([fe({type:String})],Ti.prototype,"url",2),M([fe({type:Number})],Ti.prototype,"port",2),M([fe({type:String})],Ti.prototype,"authState",2),Ti=M([ut("current-state")],Ti);function ll(r,e){let t=rh(r.id||r.name),i=th(r.name);if(r.profilePicUrl){let n=a=>{let o=a.target,s=document.createElement("div");s.className=`${e} fallback`,s.style.background=`hsl(${t},60%,35%)`,s.textContent=i,o.replaceWith(s)};return L`<img class=${e} src=${r.profilePicUrl} alt="" @error=${n} />`}return L`<div class="${e} fallback" style="background:hsl(${t},60%,35%)">${i}</div>`}var Xt=class extends Me{constructor(){super(...arguments);this.hosts=[];this.loading=!1;this.error=null;this.lastHostId=null;this.defaultUrl="";this.manualUrl="";this.manualUrlError=null;this.defaultApplied=!1}willUpdate(t){t.has("defaultUrl")&&this.defaultUrl&&!this.defaultApplied&&(this.manualUrl=this.defaultUrl,this.defaultApplied=!0)}selectHost(t){this.dispatchEvent(new CustomEvent("select-host",{detail:{host:t},bubbles:!0,composed:!0}))}connectManualUrl(){let t=this.manualUrl.trim();if(!t)return;let i;try{i=new URL(t)}catch(a){this.manualUrlError="Invalid URL format";return}if(i.protocol!=="ws:"&&i.protocol!=="wss:"){this.manualUrlError="URL must use ws:// or wss:// protocol";return}this.manualUrlError=null;let n={id:`manual-${Date.now()}`,name:i.hostname,profilePicUrl:"",location:"Custom URL",url:t,rates:[],aiModels:[]};this.selectHost(n)}renderAvatar(t){return ll(t,"host-avatar")}retry(){this.dispatchEvent(new CustomEvent("retry",{bubbles:!0,composed:!0}))}formatPrice(t){return t===0?"0.00":t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}getLinkPrice(t){let i=t.find(n=>n.description.trim().toLowerCase()==="link write");return i?i.priceInHOT:null}getAvgTokenPrice(t){let i=t.filter(n=>n.description.trim().toLowerCase()!=="link write");return i.length===0?null:i.reduce((n,a)=>n+a.priceInHOT,0)/i.length}getSortedHosts(){if(!this.lastHostId)return this.hosts;let t=this.hosts.filter(n=>n.id===this.lastHostId),i=this.hosts.filter(n=>n.id!==this.lastHostId);return[...t,...i]}render(){return L`
|
|
2593
2654
|
<div class="container">
|
|
2594
2655
|
<div class="header">
|
|
2595
2656
|
<h1>Remote Node</h1>
|
|
@@ -2605,16 +2666,16 @@ input VoiceActivityParamsInput {
|
|
|
2605
2666
|
<span>By connecting to a remote host, you are trusting them to run AD4M on your behalf. Your data will be stored on their machine and they will have access to your agent's operations. Only connect to hosts you trust.</span>
|
|
2606
2667
|
</div>
|
|
2607
2668
|
|
|
2608
|
-
${this.loading?
|
|
2669
|
+
${this.loading?L`
|
|
2609
2670
|
<div class="spinner-container"><div class="spinner"></div></div>
|
|
2610
|
-
`:this.error?
|
|
2671
|
+
`:this.error?L`
|
|
2611
2672
|
<div class="box">
|
|
2612
2673
|
<p style="color: var(--ac-danger-color)">${this.error}</p>
|
|
2613
2674
|
<button class="primary" @click=${this.retry}>Retry</button>
|
|
2614
2675
|
</div>
|
|
2615
|
-
`:
|
|
2676
|
+
`:L`
|
|
2616
2677
|
<div class="host-list">
|
|
2617
|
-
${this.getSortedHosts().map(t=>
|
|
2678
|
+
${this.getSortedHosts().map(t=>L`
|
|
2618
2679
|
<div
|
|
2619
2680
|
class="host-card ${t.id===this.lastHostId?"pinned":""}"
|
|
2620
2681
|
tabindex="0"
|
|
@@ -2627,15 +2688,15 @@ input VoiceActivityParamsInput {
|
|
|
2627
2688
|
<div class="host-info">
|
|
2628
2689
|
<div style="display:flex;align-items:center;gap:8px;">
|
|
2629
2690
|
<p class="host-name">${t.name}</p>
|
|
2630
|
-
${t.id===this.lastHostId?
|
|
2691
|
+
${t.id===this.lastHostId?L`<span class="pinned-label">Last used</span>`:""}
|
|
2631
2692
|
</div>
|
|
2632
|
-
<p class="host-location">${
|
|
2693
|
+
<p class="host-location">${Ii()}${t.location}</p>
|
|
2633
2694
|
<div class="host-meta">
|
|
2634
|
-
${t.aiModels.map(i=>
|
|
2695
|
+
${t.aiModels.map(i=>L`<span class="model-chip">${i}</span>`)}
|
|
2635
2696
|
</div>
|
|
2636
|
-
${t.rates.length>0?(()=>{let i=this.getLinkPrice(t.rates),n=this.getAvgTokenPrice(t.rates);return
|
|
2697
|
+
${t.rates.length>0?(()=>{let i=this.getLinkPrice(t.rates),n=this.getAvgTokenPrice(t.rates);return L`
|
|
2637
2698
|
<p class="rates-preview">
|
|
2638
|
-
${i!=null?
|
|
2699
|
+
${i!=null?L`Link: ${this.formatPrice(i)} wHOT`:""}${i!=null&&n!=null?" \xB7 ":""}${n!=null?L`Token: ~${this.formatPrice(n)} wHOT`:""}
|
|
2639
2700
|
</p>
|
|
2640
2701
|
`})():""}
|
|
2641
2702
|
</div>
|
|
@@ -2663,9 +2724,9 @@ input VoiceActivityParamsInput {
|
|
|
2663
2724
|
Connect
|
|
2664
2725
|
</button>
|
|
2665
2726
|
</div>
|
|
2666
|
-
${this.manualUrlError?
|
|
2727
|
+
${this.manualUrlError?L`<p class="state danger" style="margin-top: 6px; font-size: 13px;">${this.manualUrlError}</p>`:""}
|
|
2667
2728
|
</div>
|
|
2668
|
-
`}};
|
|
2729
|
+
`}};Xt.styles=[Rt,Ge`
|
|
2669
2730
|
:host {
|
|
2670
2731
|
display: flex;
|
|
2671
2732
|
flex-direction: column;
|
|
@@ -2853,35 +2914,35 @@ input VoiceActivityParamsInput {
|
|
|
2853
2914
|
letter-spacing: 0.5px;
|
|
2854
2915
|
font-weight: 600;
|
|
2855
2916
|
}
|
|
2856
|
-
`],
|
|
2917
|
+
`],M([fe({type:Array})],Xt.prototype,"hosts",2),M([fe({type:Boolean})],Xt.prototype,"loading",2),M([fe({type:String})],Xt.prototype,"error",2),M([fe({type:String})],Xt.prototype,"lastHostId",2),M([fe({type:String})],Xt.prototype,"defaultUrl",2),M([ie()],Xt.prototype,"manualUrl",2),M([ie()],Xt.prototype,"manualUrlError",2),Xt=M([ut("host-browser")],Xt);var Br=class extends Me{proceedToAuth(){this.dispatchEvent(new CustomEvent("proceed-to-auth",{detail:{host:this.host},bubbles:!0,composed:!0}))}renderAvatar(){return ll(this.host,"profile-pic")}isOperationRate(t){return Br.OPERATION_RATES.has(t.description)}rateLabel(t){return t==="link write"?"Link write":t}formatPrice(t){return t===0?"0.00":t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}render(){return this.host?L`
|
|
2857
2918
|
<div class="container">
|
|
2858
2919
|
<div class="profile">
|
|
2859
2920
|
${this.renderAvatar()}
|
|
2860
2921
|
<p class="profile-name">${this.host.name}</p>
|
|
2861
|
-
<p class="profile-location">${
|
|
2862
|
-
${this.host.description?
|
|
2922
|
+
<p class="profile-location">${Ii()}${this.host.location}</p>
|
|
2923
|
+
${this.host.description?L`<p class="profile-description">${this.host.description}</p>`:""}
|
|
2863
2924
|
|
|
2864
|
-
${this.host.aiModels.length>0?
|
|
2925
|
+
${this.host.aiModels.length>0?L`
|
|
2865
2926
|
<div class="models">
|
|
2866
|
-
${this.host.aiModels.map(t=>
|
|
2927
|
+
${this.host.aiModels.map(t=>L`<span class="model-chip">${t}</span>`)}
|
|
2867
2928
|
</div>
|
|
2868
2929
|
`:""}
|
|
2869
2930
|
</div>
|
|
2870
2931
|
|
|
2871
|
-
${this.host.rates.length>0?
|
|
2932
|
+
${this.host.rates.length>0?L`
|
|
2872
2933
|
<div class="box">
|
|
2873
2934
|
<div class="rates-section">
|
|
2874
2935
|
<h3>Pricing</h3>
|
|
2875
2936
|
<table class="rates-table">
|
|
2876
|
-
${this.host.rates.filter(t=>this.isOperationRate(t)).map(t=>
|
|
2937
|
+
${this.host.rates.filter(t=>this.isOperationRate(t)).map(t=>L`
|
|
2877
2938
|
<tr>
|
|
2878
2939
|
<td>${this.rateLabel(t.description)}</td>
|
|
2879
2940
|
<td>${this.formatPrice(t.priceInHOT)} wHOT</td>
|
|
2880
2941
|
</tr>
|
|
2881
2942
|
`)}
|
|
2882
|
-
${this.host.rates.filter(t=>!this.isOperationRate(t)).length>0?
|
|
2943
|
+
${this.host.rates.filter(t=>!this.isOperationRate(t)).length>0?L`
|
|
2883
2944
|
<tr><td colspan="2" style="text-align:left;padding-top:12px;color:rgba(255,255,255,0.5);font-size:12px;text-transform:uppercase;letter-spacing:0.5px;">AI Models (cost per token)</td></tr>
|
|
2884
|
-
${this.host.rates.filter(t=>!this.isOperationRate(t)).map(t=>
|
|
2945
|
+
${this.host.rates.filter(t=>!this.isOperationRate(t)).map(t=>L`
|
|
2885
2946
|
<tr>
|
|
2886
2947
|
<td>${t.description}</td>
|
|
2887
2948
|
<td>${this.formatPrice(t.priceInHOT)} wHOT</td>
|
|
@@ -2893,7 +2954,7 @@ input VoiceActivityParamsInput {
|
|
|
2893
2954
|
</div>
|
|
2894
2955
|
`:""}
|
|
2895
2956
|
|
|
2896
|
-
${this.host.computeSpecs?
|
|
2957
|
+
${this.host.computeSpecs?L`
|
|
2897
2958
|
<div class="box">
|
|
2898
2959
|
<div class="rates-section">
|
|
2899
2960
|
<h3>Compute</h3>
|
|
@@ -2906,7 +2967,7 @@ input VoiceActivityParamsInput {
|
|
|
2906
2967
|
Connect to ${this.host.name}
|
|
2907
2968
|
</button>
|
|
2908
2969
|
</div>
|
|
2909
|
-
`:null}};
|
|
2970
|
+
`:null}};Br.styles=[Rt,Ge`
|
|
2910
2971
|
.profile {
|
|
2911
2972
|
display: flex;
|
|
2912
2973
|
flex-direction: column;
|
|
@@ -3026,43 +3087,43 @@ input VoiceActivityParamsInput {
|
|
|
3026
3087
|
button.connect-button {
|
|
3027
3088
|
width: 100%;
|
|
3028
3089
|
}
|
|
3029
|
-
`],
|
|
3090
|
+
`],Br.OPERATION_RATES=new Set(["link write"]),M([fe({type:Object})],Br.prototype,"host",2),Br=M([ut("host-detail")],Br);var Ke=class extends Me{constructor(){super(...arguments);this.connectedHost=null;this.userInfo=null;this.requestingPayment=!1;this.paymentError=null;this.forceOpen=!1;this.walletInput="";this.editingWallet=!1;this.walletSaveSuccess=!1;this.topUpAmount="";this.awaitingApproval=!1;this.creditsUpdated=!1;this.activityLogOpen=!1;this.activityLog=[];this.activityLogLoading=!1;this.previousCredits=null}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}_useApp(){this.dispatchEvent(new CustomEvent("use-app",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}setWalletAddress(){let t=this.walletInput.trim();!t||(this.editingWallet=!1,this.walletSaveSuccess=!0,setTimeout(()=>{this.walletSaveSuccess=!1},3e3),this.dispatchEvent(new CustomEvent("set-wallet-address",{detail:{address:t},bubbles:!0,composed:!0})))}requestTopUp(t){this.creditsUpdated=!1,this.dispatchEvent(new CustomEvent("request-top-up",{detail:{amountHOT:t},bubbles:!0,composed:!0}))}truncateMiddle(t,i=8,n=6){return t.length<=i+n+3?t:`${t.slice(0,i)}\u2026${t.slice(-n)}`}toggleActivityLog(){return Q(this,null,function*(){this.activityLogOpen=!this.activityLogOpen,this.activityLogOpen&&this.activityLog.length===0&&(yield this.loadActivityLog())})}loadActivityLog(){return Q(this,null,function*(){this.activityLogLoading=!0;try{this.dispatchEvent(new CustomEvent("fetch-compute-log",{bubbles:!0,composed:!0,detail:{callback:t=>{this.activityLog=t,this.activityLogLoading=!1}}}))}catch(t){this.activityLogLoading=!1}})}pushLogEntry(t){this.activityLog=[t,...this.activityLog].slice(0,100)}formatTimeAgo(t){let i=Date.now()-new Date(t).getTime(),n=Math.floor(i/1e3);if(n<60)return`${n}s ago`;let a=Math.floor(n/60);if(a<60)return`${a}m ago`;let o=Math.floor(a/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}formatOperation(t){switch(t){case"ai_prompt":return"AI Prompt";case"ai_embed":return"AI Embed";case"ai_transcription":return"AI Transcription";case"link_write":return"Link Write";default:return t}}get hasWallet(){var t;return!!((t=this.userInfo)!=null&&t.hotWalletAddress)}get isFreeAccess(){var t;return!!((t=this.userInfo)!=null&&t.freeAccess)}get isDepleted(){return this.userInfo!=null&&!this.userInfo.freeAccess&&this.userInfo.remainingCredits<=0}get topUpDisabled(){return!this.hasWallet||this.requestingPayment||this.awaitingApproval}updated(t){var i,n,a,o,s;t.has("requestingPayment")&&!this.requestingPayment&&!this.paymentError&&t.get("requestingPayment")&&(this.awaitingApproval=!0,this.previousCredits=(n=(i=this.userInfo)==null?void 0:i.remainingCredits)!=null?n:null),t.has("userInfo")&&this.awaitingApproval&&this.previousCredits!==null&&((o=(a=this.userInfo)==null?void 0:a.remainingCredits)!=null?o:0)!==this.previousCredits&&(this.awaitingApproval=!1,this.creditsUpdated=!0,this.previousCredits=null,setTimeout(()=>{this.creditsUpdated=!1},4e3)),t.has("paymentError")&&this.paymentError&&(this.awaitingApproval=!1,this.previousCredits=null),t.has("userInfo")&&((s=this.userInfo)==null?void 0:s.hotWalletAddress)&&!this.walletInput&&(this.walletInput=this.userInfo.hotWalletAddress)}render(){var i,n,a;let t=(n=(i=this.userInfo)==null?void 0:i.remainingCredits)!=null?n:0;return L`
|
|
3030
3091
|
<div class="container">
|
|
3031
|
-
${this.forceOpen?"":
|
|
3092
|
+
${this.forceOpen?"":L`<div class="close-button" @click=${this.close}>${wt()}</div>`}
|
|
3032
3093
|
|
|
3033
3094
|
<div class="dashboard-header">
|
|
3034
3095
|
<h1>Dashboard</h1>
|
|
3035
|
-
${this.connectedHost?
|
|
3096
|
+
${this.connectedHost?L`
|
|
3036
3097
|
<div class="host-badge">
|
|
3037
3098
|
Connected to <strong>${this.connectedHost.name}</strong>
|
|
3038
3099
|
</div>
|
|
3039
3100
|
<div class="host-badge">
|
|
3040
|
-
${
|
|
3101
|
+
${Ii()} ${this.connectedHost.location}
|
|
3041
3102
|
</div>
|
|
3042
3103
|
`:""}
|
|
3043
|
-
${(a=this.userInfo)!=null&&a.email?
|
|
3104
|
+
${(a=this.userInfo)!=null&&a.email?L`
|
|
3044
3105
|
<p class="email-display">${this.userInfo.email}</p>
|
|
3045
3106
|
`:""}
|
|
3046
3107
|
</div>
|
|
3047
3108
|
|
|
3048
3109
|
<!-- Credit balance -->
|
|
3049
|
-
${this.isFreeAccess?
|
|
3110
|
+
${this.isFreeAccess?L`
|
|
3050
3111
|
<div class="credit-display free-access">
|
|
3051
|
-
${
|
|
3112
|
+
${ki()}
|
|
3052
3113
|
<span class="credit-amount">Free Access</span>
|
|
3053
3114
|
</div>
|
|
3054
|
-
`:
|
|
3115
|
+
`:L`
|
|
3055
3116
|
<div class="credit-display">
|
|
3056
|
-
${
|
|
3117
|
+
${ki()}
|
|
3057
3118
|
<span class="credit-amount">${t.toFixed(2)}</span>
|
|
3058
3119
|
<span class="credit-label">wHOT</span>
|
|
3059
3120
|
</div>
|
|
3060
3121
|
|
|
3061
|
-
${this.isDepleted?
|
|
3122
|
+
${this.isDepleted?L`
|
|
3062
3123
|
<div class="depleted-banner">Credits depleted — top up to continue using this host</div>
|
|
3063
3124
|
`:""}
|
|
3064
3125
|
|
|
3065
|
-
${this.hasWallet?"":
|
|
3126
|
+
${this.hasWallet?"":L`
|
|
3066
3127
|
<p style="font-size:15px;color:rgba(255,255,255,0.5);text-align:center;">
|
|
3067
3128
|
Set your wallet address to enable top-ups
|
|
3068
3129
|
</p>
|
|
@@ -3070,20 +3131,20 @@ input VoiceActivityParamsInput {
|
|
|
3070
3131
|
|
|
3071
3132
|
<!-- Wallet address -->
|
|
3072
3133
|
<div class="wallet-section">
|
|
3073
|
-
<label>${
|
|
3074
|
-
${this.hasWallet&&!this.editingWallet?
|
|
3134
|
+
<label>${cl()} wHOT Wallet Address</label>
|
|
3135
|
+
${this.hasWallet&&!this.editingWallet?L`
|
|
3075
3136
|
<div class="wallet-row">
|
|
3076
3137
|
<div class="wallet-display" title=${this.userInfo.hotWalletAddress}>${this.truncateMiddle(this.userInfo.hotWalletAddress||"")}</div>
|
|
3077
3138
|
<button class="secondary" @click=${()=>{this.editingWallet=!0,this.walletInput=this.userInfo.hotWalletAddress||""}}>
|
|
3078
3139
|
Change
|
|
3079
3140
|
</button>
|
|
3080
3141
|
</div>
|
|
3081
|
-
${this.walletSaveSuccess?
|
|
3142
|
+
${this.walletSaveSuccess?L`
|
|
3082
3143
|
<div class="success-message" style="display:flex;align-items:center;justify-content:center;gap:6px;">
|
|
3083
3144
|
${Ot()} Wallet saved
|
|
3084
3145
|
</div>
|
|
3085
3146
|
`:""}
|
|
3086
|
-
`:
|
|
3147
|
+
`:L`
|
|
3087
3148
|
<div class="wallet-row">
|
|
3088
3149
|
<input
|
|
3089
3150
|
type="text"
|
|
@@ -3106,7 +3167,7 @@ input VoiceActivityParamsInput {
|
|
|
3106
3167
|
|
|
3107
3168
|
<!-- Top-up -->
|
|
3108
3169
|
<div class="topup-section">
|
|
3109
|
-
<label>${
|
|
3170
|
+
<label>${ki()} Top Up Credits</label>
|
|
3110
3171
|
<div class="wallet-row">
|
|
3111
3172
|
<input
|
|
3112
3173
|
type="number"
|
|
@@ -3126,7 +3187,7 @@ input VoiceActivityParamsInput {
|
|
|
3126
3187
|
</button>
|
|
3127
3188
|
</div>
|
|
3128
3189
|
<div class="topup-buttons">
|
|
3129
|
-
${[100,500,1e3].map(o=>
|
|
3190
|
+
${[100,500,1e3].map(o=>L`
|
|
3130
3191
|
<button
|
|
3131
3192
|
class="secondary"
|
|
3132
3193
|
?disabled=${this.topUpDisabled}
|
|
@@ -3138,20 +3199,20 @@ input VoiceActivityParamsInput {
|
|
|
3138
3199
|
</div>
|
|
3139
3200
|
</div>
|
|
3140
3201
|
|
|
3141
|
-
${this.awaitingApproval?
|
|
3202
|
+
${this.awaitingApproval?L`
|
|
3142
3203
|
<div class="pending-message">
|
|
3143
3204
|
<div class="spinner"></div>
|
|
3144
3205
|
Open Unyt app and approve the transaction
|
|
3145
3206
|
</div>
|
|
3146
3207
|
`:""}
|
|
3147
3208
|
|
|
3148
|
-
${this.creditsUpdated?
|
|
3209
|
+
${this.creditsUpdated?L`
|
|
3149
3210
|
<div class="success-message" style="display:flex;align-items:center;justify-content:center;gap:6px;">
|
|
3150
3211
|
${Ot()} Credits updated!
|
|
3151
3212
|
</div>
|
|
3152
3213
|
`:""}
|
|
3153
3214
|
|
|
3154
|
-
${this.paymentError?
|
|
3215
|
+
${this.paymentError?L`
|
|
3155
3216
|
<div class="error-message">${this.paymentError}</div>
|
|
3156
3217
|
`:""}
|
|
3157
3218
|
`}
|
|
@@ -3161,14 +3222,14 @@ input VoiceActivityParamsInput {
|
|
|
3161
3222
|
<span>Activity Log</span>
|
|
3162
3223
|
<span class="chevron ${this.activityLogOpen?"open":""}">▶</span>
|
|
3163
3224
|
</div>
|
|
3164
|
-
${this.activityLogOpen?
|
|
3165
|
-
${this.activityLogLoading?
|
|
3225
|
+
${this.activityLogOpen?L`
|
|
3226
|
+
${this.activityLogLoading?L`
|
|
3166
3227
|
<div class="activity-log-empty">Loading...</div>
|
|
3167
|
-
`:this.activityLog.length===0?
|
|
3228
|
+
`:this.activityLog.length===0?L`
|
|
3168
3229
|
<div class="activity-log-empty">No activity yet</div>
|
|
3169
|
-
`:
|
|
3230
|
+
`:L`
|
|
3170
3231
|
<div class="activity-log-list">
|
|
3171
|
-
${this.activityLog.map(o=>
|
|
3232
|
+
${this.activityLog.map(o=>L`
|
|
3172
3233
|
<div class="activity-log-entry">
|
|
3173
3234
|
<span class="op-badge ${o.operation}">${this.formatOperation(o.operation)}</span>
|
|
3174
3235
|
<span class="summary" title=${o.summary||""}>${o.summary||""}</span>
|
|
@@ -3189,7 +3250,7 @@ input VoiceActivityParamsInput {
|
|
|
3189
3250
|
</button>
|
|
3190
3251
|
</div>
|
|
3191
3252
|
</div>
|
|
3192
|
-
`}};Ke.styles=[
|
|
3253
|
+
`}};Ke.styles=[Rt,Ge`
|
|
3193
3254
|
.dashboard-header {
|
|
3194
3255
|
text-align: center;
|
|
3195
3256
|
}
|
|
@@ -3521,7 +3582,7 @@ input VoiceActivityParamsInput {
|
|
|
3521
3582
|
color: rgba(255, 255, 255, 0.4);
|
|
3522
3583
|
font-size: 13px;
|
|
3523
3584
|
}
|
|
3524
|
-
`],
|
|
3585
|
+
`],M([fe({type:Object})],Ke.prototype,"connectedHost",2),M([fe({type:Object})],Ke.prototype,"userInfo",2),M([fe({type:Boolean})],Ke.prototype,"requestingPayment",2),M([fe({type:String})],Ke.prototype,"paymentError",2),M([fe({type:Boolean})],Ke.prototype,"forceOpen",2),M([ie()],Ke.prototype,"walletInput",2),M([ie()],Ke.prototype,"editingWallet",2),M([ie()],Ke.prototype,"walletSaveSuccess",2),M([ie()],Ke.prototype,"topUpAmount",2),M([ie()],Ke.prototype,"awaitingApproval",2),M([ie()],Ke.prototype,"creditsUpdated",2),M([ie()],Ke.prototype,"activityLogOpen",2),M([ie()],Ke.prototype,"activityLog",2),M([ie()],Ke.prototype,"activityLogLoading",2),Ke=M([ut("logged-in-dashboard")],Ke);var u_=Ge`
|
|
3525
3586
|
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
|
|
3526
3587
|
|
|
3527
3588
|
:host {
|
|
@@ -3677,7 +3738,7 @@ input VoiceActivityParamsInput {
|
|
|
3677
3738
|
0%, 100% { opacity: 1; }
|
|
3678
3739
|
50% { opacity: 0.4; }
|
|
3679
3740
|
}
|
|
3680
|
-
`,Ue=class extends Me{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.hosts=[];this.hostsLoading=!1;this.hostsError=null;this.selectedHost=null;this.userInfo=null;this.lowCredit=!1;this.requestingPayment=!1;this.paymentError=null;this.openedDueToCreditDepletion=!1}connectedCallback(){super.connectedCallback(),
|
|
3741
|
+
`,Ue=class extends Me{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.hosts=[];this.hostsLoading=!1;this.hostsError=null;this.selectedHost=null;this.userInfo=null;this.lowCredit=!1;this.requestingPayment=!1;this.paymentError=null;this.openedDueToCreditDepletion=!1}connectedCallback(){super.connectedCallback(),Jo(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.addEventListener("userinfochange",t=>{var n;let i=t.detail;((n=this.userInfo)==null?void 0:n.hotWalletAddress)&&!i.hotWalletAddress&&(i.hotWalletAddress=this.userInfo.hotWalletAddress),this.userInfo=i,this.lowCredit=this.userInfo.remainingCredits<=this.core.lowCreditThreshold,this.requestUpdate()}),this.core.addEventListener("creditdepleted",()=>{var t,i;if(this.lowCredit=!0,this.core.connectedHost){this.openedDueToCreditDepletion=!0;try{(i=(t=this.core.options).onCreditsDepleted)==null||i.call(t)}catch(n){console.error("[Ad4m Connect] onCreditsDepleted callback error:",n)}this.modalOpen||(this.currentView="logged-in-dashboard",this.modalOpen=!0)}this.requestUpdate()}),this.core.token?this.core.connect().then(()=>{this.core.connectedHost&&(this.selectedHost=this.core.connectedHost,this.core.startCreditSubscription())}).catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return Q(this,null,function*(){this.core.port=t.detail.port,dt("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return Q(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,dt("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return Q(this,null,function*(){let i=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!i,i&&(this.modalOpen=!1)})}browseHosts(){return Q(this,null,function*(){this.hostsLoading=!0,this.hostsError=null,this.currentView="host-browser";try{this.hosts=yield Lp(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}retryFetchHosts(){return Q(this,null,function*(){this.hostsLoading=!0,this.hostsError=null;try{this.hosts=yield Lp(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}selectHost(t){this.selectedHost=t.detail.host,this.currentView="host-detail"}proceedToAuth(t){return Q(this,null,function*(){let i=t.detail.host;this.selectedHost=i;let n=i.url;try{yield ji(n),console.log("[Ad4m Connect UI] Host connection successful:",i.name);let a=this.core.url;if(this.core.url=n,!(yield this.core.isValidAd4mAPI()))throw this.core.url=a,new Error("Server is reachable but doesn't appear to be an AD4M executor");dt("ad4m-url",n),this.currentView="remote-authentication"}catch(a){console.error("[Ad4m Connect UI] Host connection failed:",a),this.hostsError=a instanceof Error?a.message:"Connection failed",this.currentView="host-browser"}})}handleAuthSuccess(){return Q(this,null,function*(){this.selectedHost?(this.core.setConnectedHost(this.selectedHost),this.core.startCreditSubscription(),this.currentView="logged-in-dashboard"):this.modalOpen=!1})}handleRequestTopUp(t){return Q(this,null,function*(){this.requestingPayment=!0,this.paymentError=null;try{let i=yield this.core.requestTopUp(t.detail.amountHOT);i.success||(this.paymentError=i.message)}catch(i){this.paymentError=i instanceof Error?i.message:"Payment request failed"}finally{this.requestingPayment=!1}})}handleSetWalletAddress(t){return Q(this,null,function*(){try{yield this.core.ad4mClient.agent.setHotWalletAddress(t.detail.address),this.userInfo&&(this.userInfo=id(rd({},this.userInfo),{hotWalletAddress:t.detail.address}))}catch(i){console.error("[Ad4m Connect] Failed to set wallet address:",i)}})}connectRemoteNode(t){return Q(this,null,function*(){this.core.url=t.detail.remoteUrl,dt("ad4m-url",this.core.url);try{if(yield ji(t.detail.remoteUrl),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");this.currentView="remote-authentication"}catch(i){console.error("[Ad4m Connect UI] Remote connection failed:",i)}})}emailLogin(t){return Q(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return Q(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!i,i&&(yield this.handleAuthSuccess())}catch(i){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return Q(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!i,i&&(yield this.handleAuthSuccess())}catch(i){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return Q(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!i,i&&(yield this.handleAuthSuccess())}catch(i){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return Q(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}get backTarget(){switch(this.currentView){case"local-authentication":return"connection-options";case"host-browser":return"connection-options";case"host-detail":return"host-browser";case"remote-authentication":return this.selectedHost?"host-detail":"connection-options";default:return null}}handleBack(){let t=this.backTarget;t&&(this.currentView==="remote-authentication"&&this.resetRemoteAuthState(),this.currentView=t)}resetRemoteAuthState(){this.remoteAuthState=null,this.remoteAuthLoading=!1,this.emailCodeError=!1,this.passwordError=!1,this.accountCreationError=!1}renderViews(){var t,i,n;if(this.currentView==="connection-options")return L`
|
|
3681
3742
|
<connection-options
|
|
3682
3743
|
.port=${this.core.port}
|
|
3683
3744
|
.showHosting=${!!this.core.options.hosting}
|
|
@@ -3685,7 +3746,7 @@ input VoiceActivityParamsInput {
|
|
|
3685
3746
|
@connect-local-node=${this.connectLocalNode}
|
|
3686
3747
|
@browse-hosts=${this.browseHosts}
|
|
3687
3748
|
></connection-options>
|
|
3688
|
-
`;if(this.currentView==="local-authentication")return
|
|
3749
|
+
`;if(this.currentView==="local-authentication")return L`
|
|
3689
3750
|
<local-authentication
|
|
3690
3751
|
.capabilities=${this.core.options.capabilities}
|
|
3691
3752
|
.appname=${this.core.options.appInfo.name}
|
|
@@ -3696,7 +3757,7 @@ input VoiceActivityParamsInput {
|
|
|
3696
3757
|
@verify-code=${this.verifyLocalAd4mCode}
|
|
3697
3758
|
@clear-verification-error=${()=>{this.verificationError=!1}}
|
|
3698
3759
|
></local-authentication>
|
|
3699
|
-
`;if(this.currentView==="host-browser")return
|
|
3760
|
+
`;if(this.currentView==="host-browser")return L`
|
|
3700
3761
|
<host-browser
|
|
3701
3762
|
.hosts=${this.hosts}
|
|
3702
3763
|
.loading=${this.hostsLoading}
|
|
@@ -3707,13 +3768,13 @@ input VoiceActivityParamsInput {
|
|
|
3707
3768
|
@back=${()=>{this.currentView="connection-options"}}
|
|
3708
3769
|
@retry=${this.retryFetchHosts}
|
|
3709
3770
|
></host-browser>
|
|
3710
|
-
`;if(this.currentView==="host-detail")return
|
|
3771
|
+
`;if(this.currentView==="host-detail")return L`
|
|
3711
3772
|
<host-detail
|
|
3712
3773
|
.host=${this.selectedHost}
|
|
3713
3774
|
@proceed-to-auth=${this.proceedToAuth}
|
|
3714
3775
|
@back=${()=>{this.currentView="host-browser"}}
|
|
3715
3776
|
></host-detail>
|
|
3716
|
-
`;if(this.currentView==="remote-authentication")return
|
|
3777
|
+
`;if(this.currentView==="remote-authentication")return L`
|
|
3717
3778
|
<remote-authentication
|
|
3718
3779
|
.host=${this.selectedHost}
|
|
3719
3780
|
.remoteAuthLoading=${this.remoteAuthLoading}
|
|
@@ -3729,7 +3790,7 @@ input VoiceActivityParamsInput {
|
|
|
3729
3790
|
@clear-email-code-error=${()=>{this.emailCodeError=!1}}
|
|
3730
3791
|
@reset-auth-state=${()=>{this.resetRemoteAuthState()}}
|
|
3731
3792
|
></remote-authentication>
|
|
3732
|
-
`;if(this.currentView==="logged-in-dashboard")return
|
|
3793
|
+
`;if(this.currentView==="logged-in-dashboard")return L`
|
|
3733
3794
|
<logged-in-dashboard
|
|
3734
3795
|
.connectedHost=${this.core.connectedHost}
|
|
3735
3796
|
.userInfo=${this.userInfo}
|
|
@@ -3743,7 +3804,7 @@ input VoiceActivityParamsInput {
|
|
|
3743
3804
|
@set-wallet-address=${this.handleSetWalletAddress}
|
|
3744
3805
|
@fetch-compute-log=${a=>{var s;let o=(s=a==null?void 0:a.detail)==null?void 0:s.callback;typeof o=="function"&&this.core.fetchComputeLog().then(o).catch(c=>{console.error("[Ad4m Connect] Failed to fetch compute log:",c),o([])})}}
|
|
3745
3806
|
></logged-in-dashboard>
|
|
3746
|
-
`;if(this.currentView==="current-state")return
|
|
3807
|
+
`;if(this.currentView==="current-state")return L`
|
|
3747
3808
|
<current-state
|
|
3748
3809
|
.url=${this.core.url}
|
|
3749
3810
|
.port=${this.core.port}
|
|
@@ -3751,16 +3812,16 @@ input VoiceActivityParamsInput {
|
|
|
3751
3812
|
@close=${()=>{this.modalOpen=!1}}
|
|
3752
3813
|
@disconnect=${this.disconnect}
|
|
3753
3814
|
></current-state>
|
|
3754
|
-
`}render(){var t;if(this.modalOpen)return
|
|
3815
|
+
`}render(){var t;if(this.modalOpen)return L`
|
|
3755
3816
|
<div class="wrapper">
|
|
3756
3817
|
<div class="modal">
|
|
3757
3818
|
<header class="modal-header">
|
|
3758
|
-
${this.backTarget?
|
|
3819
|
+
${this.backTarget?L`
|
|
3759
3820
|
<button class="back-button" aria-label="Go back" @click=${this.handleBack}>
|
|
3760
|
-
${
|
|
3821
|
+
${ol()} Back
|
|
3761
3822
|
</button>
|
|
3762
3823
|
`:""}
|
|
3763
|
-
${
|
|
3824
|
+
${On()}
|
|
3764
3825
|
</header>
|
|
3765
3826
|
<main class="modal-content">
|
|
3766
3827
|
${this.renderViews()}
|
|
@@ -3768,11 +3829,11 @@ input VoiceActivityParamsInput {
|
|
|
3768
3829
|
</div>
|
|
3769
3830
|
<div class="backdrop" />
|
|
3770
3831
|
</div>
|
|
3771
|
-
`;if(this.core.authState==="authenticated"){let i=(t=this.userInfo)==null?void 0:t.remainingCredits;return
|
|
3832
|
+
`;if(this.core.authState==="authenticated"){let i=(t=this.userInfo)==null?void 0:t.remainingCredits;return L`
|
|
3772
3833
|
<div class="settings-bar">
|
|
3773
|
-
${i!=null?
|
|
3834
|
+
${i!=null?L`
|
|
3774
3835
|
<span class="credit-badge ${this.lowCredit?"low-credit":""}">
|
|
3775
|
-
${
|
|
3836
|
+
${ki()} ${i.toFixed(2)} wHOT
|
|
3776
3837
|
</span>
|
|
3777
3838
|
`:""}
|
|
3778
3839
|
<button
|
|
@@ -3781,10 +3842,10 @@ input VoiceActivityParamsInput {
|
|
|
3781
3842
|
aria-label="Open settings"
|
|
3782
3843
|
@click=${()=>{this.currentView=this.core.connectedHost?"logged-in-dashboard":"current-state",this.modalOpen=!0}}
|
|
3783
3844
|
>
|
|
3784
|
-
${
|
|
3845
|
+
${On()}
|
|
3785
3846
|
</button>
|
|
3786
3847
|
</div>
|
|
3787
|
-
`}return null}};Ue.styles=[
|
|
3848
|
+
`}return null}};Ue.styles=[u_],M([ie()],Ue.prototype,"modalOpen",2),M([ie()],Ue.prototype,"currentView",2),M([ie()],Ue.prototype,"verificationError",2),M([ie()],Ue.prototype,"remoteAuthLoading",2),M([ie()],Ue.prototype,"remoteAuthState",2),M([ie()],Ue.prototype,"emailCodeError",2),M([ie()],Ue.prototype,"passwordError",2),M([ie()],Ue.prototype,"accountCreationError",2),M([ie()],Ue.prototype,"hosts",2),M([ie()],Ue.prototype,"hostsLoading",2),M([ie()],Ue.prototype,"hostsError",2),M([ie()],Ue.prototype,"selectedHost",2),M([ie()],Ue.prototype,"userInfo",2),M([ie()],Ue.prototype,"lowCredit",2),M([ie()],Ue.prototype,"requestingPayment",2),M([ie()],Ue.prototype,"paymentError",2),Ue=M([ut("ad4m-connect")],Ue);function Yp(r){let e=new Ue;return e.core=r,r.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}function p_(r){let e=new Zo(r);if(Bs()){let t=e.connect();return{core:e,client:t}}else{Yp(e);let t=new Promise(i=>{e.addEventListener("authstatechange",n=>{n.detail==="authenticated"&&e.ad4mClient&&i(e.ad4mClient)})});return{core:e,client:t}}}function FP(r){return Q(this,null,function*(){let{client:e}=p_(r);return e})}export{FP as getAd4mClient,p_ as getAd4mConnect,Bs as isEmbedded};
|
|
3788
3849
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
3789
3850
|
/**
|
|
3790
3851
|
* @license
|