@coasys/ad4m-connect 0.9.1-prerelease → 0.9.1-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +807 -0
- package/dist/src/components/AgentLocked.d.ts +4 -0
- package/dist/src/components/CapNotMatching.d.ts +1 -0
- package/dist/src/components/CouldNotMakeRequest.d.ts +1 -0
- package/dist/src/components/Disconnected.d.ts +3 -0
- package/dist/src/components/Header.d.ts +1 -0
- package/dist/src/components/InvalidToken.d.ts +3 -0
- package/dist/src/components/Loading.d.ts +1 -0
- package/dist/src/components/Logo.d.ts +1 -0
- package/dist/src/components/RemoteUrl.d.ts +6 -0
- package/dist/src/components/RequestCapability.d.ts +7 -0
- package/dist/src/components/Start.d.ts +8 -0
- package/dist/src/components/VerifyCode.d.ts +6 -0
- package/dist/src/core.d.ts +57 -0
- package/dist/src/electron.d.ts +2 -0
- package/dist/src/utils.d.ts +6 -0
- package/dist/src/web.d.ts +40 -0
- package/package.json +2 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,807 @@
|
|
|
1
|
+
var ju=Object.create;var Qi=Object.defineProperty,qu=Object.defineProperties,$u=Object.getOwnPropertyDescriptor,Vu=Object.getOwnPropertyDescriptors,Uu=Object.getOwnPropertyNames,ko=Object.getOwnPropertySymbols,Qu=Object.getPrototypeOf,Io=Object.prototype.hasOwnProperty,Bu=Object.prototype.propertyIsEnumerable;var Do=(t,e,r)=>e in t?Qi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Po=(t,e)=>{for(var r in e||={})Io.call(e,r)&&Do(t,r,e[r]);if(ko)for(var r of ko(e))Bu.call(e,r)&&Do(t,r,e[r]);return t},Ao=(t,e)=>qu(t,Vu(e));var Gu=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ku=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Uu(e))!Io.call(t,i)&&i!==r&&Qi(t,i,{get:()=>e[i],enumerable:!(n=$u(e,i))||n.enumerable});return t};var Wu=(t,e,r)=>(r=t!=null?ju(Qu(t)):{},Ku(e||!t||!t.__esModule?Qi(r,"default",{value:t,enumerable:!0}):r,t));var Ye=(t,e,r)=>new Promise((n,i)=>{var a=u=>{try{s(r.next(u))}catch(l){i(l)}},o=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});var Zo=Gu((Up,Dn)=>{var No,Ro,Co,Lo,Fo,Mo,jo,qo,$o,Tn,Bi,Vo,Uo,Qo,ir,Bo,Go,Ko,Wo,zo,Jo,Ho,Yo,Xo,kn;(function(t){var e=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(n){t(r(e,r(n)))}):typeof Dn=="object"&&typeof Dn.exports=="object"?t(r(e,r(Dn.exports))):t(r(e));function r(n,i){return n!==e&&(typeof Object.create=="function"?Object.defineProperty(n,"__esModule",{value:!0}):n.__esModule=!0),function(a,o){return n[a]=i?i(a,o):o}}})(function(t){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var a in i)Object.prototype.hasOwnProperty.call(i,a)&&(n[a]=i[a])};No=function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");e(n,i);function a(){this.constructor=n}n.prototype=i===null?Object.create(i):(a.prototype=i.prototype,new a)},Ro=Object.assign||function(n){for(var i,a=1,o=arguments.length;a<o;a++){i=arguments[a];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])}return n},Co=function(n,i){var a={};for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&i.indexOf(o)<0&&(a[o]=n[o]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,o=Object.getOwnPropertySymbols(n);s<o.length;s++)i.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(n,o[s])&&(a[o[s]]=n[o[s]]);return a},Lo=function(n,i,a,o){var s=arguments.length,u=s<3?i:o===null?o=Object.getOwnPropertyDescriptor(i,a):o,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,i,a,o);else for(var f=n.length-1;f>=0;f--)(l=n[f])&&(u=(s<3?l(u):s>3?l(i,a,u):l(i,a))||u);return s>3&&u&&Object.defineProperty(i,a,u),u},Fo=function(n,i){return function(a,o){i(a,o,n)}},Mo=function(n,i){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,i)},jo=function(n,i,a,o){function s(u){return u instanceof a?u:new a(function(l){l(u)})}return new(a||(a=Promise))(function(u,l){function f(d){try{p(o.next(d))}catch(v){l(v)}}function h(d){try{p(o.throw(d))}catch(v){l(v)}}function p(d){d.done?u(d.value):s(d.value).then(f,h)}p((o=o.apply(n,i||[])).next())})},qo=function(n,i){var a={label:0,sent:function(){if(u[0]&1)throw u[1];return u[1]},trys:[],ops:[]},o,s,u,l;return l={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function f(p){return function(d){return h([p,d])}}function h(p){if(o)throw new TypeError("Generator is already executing.");for(;l&&(l=0,p[0]&&(a=0)),a;)try{if(o=1,s&&(u=p[0]&2?s.return:p[0]?s.throw||((u=s.return)&&u.call(s),0):s.next)&&!(u=u.call(s,p[1])).done)return u;switch(s=0,u&&(p=[p[0]&2,u.value]),p[0]){case 0:case 1:u=p;break;case 4:return a.label++,{value:p[1],done:!1};case 5:a.label++,s=p[1],p=[0];continue;case 7:p=a.ops.pop(),a.trys.pop();continue;default:if(u=a.trys,!(u=u.length>0&&u[u.length-1])&&(p[0]===6||p[0]===2)){a=0;continue}if(p[0]===3&&(!u||p[1]>u[0]&&p[1]<u[3])){a.label=p[1];break}if(p[0]===6&&a.label<u[1]){a.label=u[1],u=p;break}if(u&&a.label<u[2]){a.label=u[2],a.ops.push(p);break}u[2]&&a.ops.pop(),a.trys.pop();continue}p=i.call(n,a)}catch(d){p=[6,d],s=0}finally{o=u=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$o=function(n,i){for(var a in n)a!=="default"&&!Object.prototype.hasOwnProperty.call(i,a)&&kn(i,n,a)},kn=Object.create?function(n,i,a,o){o===void 0&&(o=a);var s=Object.getOwnPropertyDescriptor(i,a);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[a]}}),Object.defineProperty(n,o,s)}:function(n,i,a,o){o===void 0&&(o=a),n[o]=i[a]},Tn=function(n){var i=typeof Symbol=="function"&&Symbol.iterator,a=i&&n[i],o=0;if(a)return a.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&o>=n.length&&(n=void 0),{value:n&&n[o++],done:!n}}};throw new TypeError(i?"Object is not iterable.":"Symbol.iterator is not defined.")},Bi=function(n,i){var a=typeof Symbol=="function"&&n[Symbol.iterator];if(!a)return n;var o=a.call(n),s,u=[],l;try{for(;(i===void 0||i-- >0)&&!(s=o.next()).done;)u.push(s.value)}catch(f){l={error:f}}finally{try{s&&!s.done&&(a=o.return)&&a.call(o)}finally{if(l)throw l.error}}return u},Vo=function(){for(var n=[],i=0;i<arguments.length;i++)n=n.concat(Bi(arguments[i]));return n},Uo=function(){for(var n=0,i=0,a=arguments.length;i<a;i++)n+=arguments[i].length;for(var o=Array(n),s=0,i=0;i<a;i++)for(var u=arguments[i],l=0,f=u.length;l<f;l++,s++)o[s]=u[l];return o},Qo=function(n,i,a){if(a||arguments.length===2)for(var o=0,s=i.length,u;o<s;o++)(u||!(o in i))&&(u||(u=Array.prototype.slice.call(i,0,o)),u[o]=i[o]);return n.concat(u||Array.prototype.slice.call(i))},ir=function(n){return this instanceof ir?(this.v=n,this):new ir(n)},Bo=function(n,i,a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=a.apply(n,i||[]),s,u=[];return s={},l("next"),l("throw"),l("return"),s[Symbol.asyncIterator]=function(){return this},s;function l(m){o[m]&&(s[m]=function(b){return new Promise(function(E,I){u.push([m,b,E,I])>1||f(m,b)})})}function f(m,b){try{h(o[m](b))}catch(E){v(u[0][3],E)}}function h(m){m.value instanceof ir?Promise.resolve(m.value.v).then(p,d):v(u[0][2],m)}function p(m){f("next",m)}function d(m){f("throw",m)}function v(m,b){m(b),u.shift(),u.length&&f(u[0][0],u[0][1])}},Go=function(n){var i,a;return i={},o("next"),o("throw",function(s){throw s}),o("return"),i[Symbol.iterator]=function(){return this},i;function o(s,u){i[s]=n[s]?function(l){return(a=!a)?{value:ir(n[s](l)),done:s==="return"}:u?u(l):l}:u}},Ko=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=n[Symbol.asyncIterator],a;return i?i.call(n):(n=typeof Tn=="function"?Tn(n):n[Symbol.iterator](),a={},o("next"),o("throw"),o("return"),a[Symbol.asyncIterator]=function(){return this},a);function o(u){a[u]=n[u]&&function(l){return new Promise(function(f,h){l=n[u](l),s(f,h,l.done,l.value)})}}function s(u,l,f,h){Promise.resolve(h).then(function(p){u({value:p,done:f})},l)}},Wo=function(n,i){return Object.defineProperty?Object.defineProperty(n,"raw",{value:i}):n.raw=i,n};var r=Object.create?function(n,i){Object.defineProperty(n,"default",{enumerable:!0,value:i})}:function(n,i){n.default=i};zo=function(n){if(n&&n.__esModule)return n;var i={};if(n!=null)for(var a in n)a!=="default"&&Object.prototype.hasOwnProperty.call(n,a)&&kn(i,n,a);return r(i,n),i},Jo=function(n){return n&&n.__esModule?n:{default:n}},Ho=function(n,i,a,o){if(a==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?n!==i||!o:!i.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return a==="m"?o:a==="a"?o.call(n):o?o.value:i.get(n)},Yo=function(n,i,a,o,s){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?n!==i||!s:!i.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?s.call(n,a):s?s.value=a:i.set(n,a),a},Xo=function(n,i){if(i===null||typeof i!="object"&&typeof i!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?i===n:n.has(i)},t("__extends",No),t("__assign",Ro),t("__rest",Co),t("__decorate",Lo),t("__param",Fo),t("__metadata",Mo),t("__awaiter",jo),t("__generator",qo),t("__exportStar",$o),t("__createBinding",kn),t("__values",Tn),t("__read",Bi),t("__spread",Vo),t("__spreadArrays",Uo),t("__spreadArray",Qo),t("__await",ir),t("__asyncGenerator",Bo),t("__asyncDelegator",Go),t("__asyncValues",Ko),t("__makeTemplateObject",Wo),t("__importStar",zo),t("__importDefault",Jo),t("__classPrivateFieldGet",Ho),t("__classPrivateFieldSet",Yo),t("__classPrivateFieldIn",Xo)})});var es=Wu(Zo(),1),{__extends:de,__assign:y,__rest:Xe,__decorate:Qp,__param:Bp,__metadata:Gp,__awaiter:st,__generator:ct,__exportStar:Kp,__createBinding:Wp,__values:zp,__read:Jp,__spread:Hp,__spreadArrays:Yp,__spreadArray:vt,__await:Xp,__asyncGenerator:Zp,__asyncDelegator:ed,__asyncValues:td,__makeTemplateObject:rd,__importStar:nd,__importDefault:id,__classPrivateFieldGet:ad,__classPrivateFieldSet:od,__classPrivateFieldIn:sd}=es.default;var Gi="Invariant Violation",ts=Object.setPrototypeOf,zu=ts===void 0?function(t,e){return t.__proto__=e,t}:ts,F=function(t){de(e,t);function e(r){r===void 0&&(r=Gi);var n=t.call(this,typeof r=="number"?Gi+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Gi,zu(n,e.prototype),n}return e}(Error);function _(t,e){if(!t)throw new F(e)}var Pn=["debug","log","warn","error","silent"],Ki=Pn.indexOf("log");function In(t){return function(){if(Pn.indexOf(t)>=Ki){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=In("debug"),t.log=In("log"),t.warn=In("warn"),t.error=In("error")})(_||(_={}));function rs(t){var e=Pn[Ki];return Ki=Math.max(0,Pn.indexOf(t)),e}function ye(t){try{return t()}catch{}}var An=ye(function(){return globalThis})||ye(function(){return window})||ye(function(){return self})||ye(function(){return global})||ye(function(){return ye.constructor("return this")()});var ns="__",is=[ns,ns].join("DEV");function Ju(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(An,is,{value:ye(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),An[is]}}var Mt=Ju();function gt(t){try{return t()}catch{}}var Wi=gt(function(){return globalThis})||gt(function(){return window})||gt(function(){return self})||gt(function(){return global})||gt(function(){return gt.constructor("return this")()}),zi=!1;function Hu(){Wi&&!gt(function(){return"production"})&&!gt(function(){return process})&&(Object.defineProperty(Wi,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),zi=!0)}Hu();function Ji(){zi&&(delete Wi.process,zi=!1)}var gd=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",bd=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",as=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Hi(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Yu=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ar=Yu;function Nn(t){var e=t.prototype.toJSON;typeof e=="function"||Hi(0),t.prototype.inspect=e,Ar&&(t.prototype[Ar]=e)}var os=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Nn(os);var ss=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=u,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Nn(ss);function Yi(t){return t!=null&&typeof t.kind=="string"}function Rn(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Rn=function(r){return typeof r}:Rn=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Rn(t)}var Xu=10,cs=2;function Nr(t){return Cn(t,[])}function Cn(t,e){switch(Rn(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Zu(t,e);default:return String(t)}}function Zu(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=rl(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Cn(i,r)}else if(Array.isArray(t))return tl(t,r);return el(t,r)}function el(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>cs)return"["+nl(t)+"]";var n=r.map(function(i){var a=Cn(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function tl(t,e){if(t.length===0)return"[]";if(e.length>cs)return"[Array]";for(var r=Math.min(Xu,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Cn(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function rl(t){var e=t[String(Ar)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function nl(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function Rr(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function us(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function il(t,e,r){return e&&us(t.prototype,e),r&&us(t,r),t}var Ln=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Rr(0,"Body must be a string. Received: ".concat(Nr(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Rr(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Rr(0,"column in locationOffset is 1-indexed and must be positive.")}return il(t,[{key:as,get:function(){return"Source"}}]),t}();function ls(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
|
|
2
|
+
`)===-1,i=t[0]===" "||t[0]===" ",a=t[t.length-1]==='"',o=t[t.length-1]==="\\",s=!n||a||o||r,u="";return s&&!(n&&i)&&(u+=`
|
|
3
|
+
`+e),u+=e?t.replace(/\n/g,`
|
|
4
|
+
`+e):t,s&&(u+=`
|
|
5
|
+
`),'"""'+u.replace(/"""/g,'\\"""')+'"""'}var al={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"]},Cr=Object.freeze({});function be(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:al,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],u=void 0,l=void 0,f=void 0,h=[],p=[],d=t;do{o++;var v=o===a.length,m=v&&s.length!==0;if(v){if(l=p.length===0?void 0:h[h.length-1],u=f,f=p.pop(),m){if(i)u=u.slice();else{for(var b={},E=0,I=Object.keys(u);E<I.length;E++){var w=I[E];b[w]=u[w]}u=b}for(var T=0,A=0;A<s.length;A++){var P=s[A][0],N=s[A][1];i&&(P-=T),i&&N===null?(u.splice(P,1),T++):u[P]=N}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(l=f?i?o:a[o]:void 0,u=f?f[l]:d,u==null)continue;f&&h.push(l)}var L=void 0;if(!Array.isArray(u)){if(!Yi(u))throw new Error("Invalid AST Node: ".concat(Nr(u),"."));var pe=Xi(e,u.kind,v);if(pe){if(L=pe.call(e,u,l,f,h,p),L===Cr)break;if(L===!1){if(!v){h.pop();continue}}else if(L!==void 0&&(s.push([l,L]),!v))if(Yi(L))u=L;else{h.pop();continue}}}if(L===void 0&&m&&s.push([l,u]),v)h.pop();else{var B;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(u),a=i?u:(B=r[u.kind])!==null&&B!==void 0?B:[],o=-1,s=[],f&&p.push(f),f=u}}while(n!==void 0);return s.length!==0&&(d=s[s.length-1][1]),d}function Xi(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var a=r?t.leave:t.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function ar(t){return be(t,{leave:sl})}var ol=80,sl={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return D(e.definitions,`
|
|
6
|
+
|
|
7
|
+
`)+`
|
|
8
|
+
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=se("(",D(e.variableDefinitions,", "),")"),a=D(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:D([r,D([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+se(" = ",i)+se(" ",D(a," "))},SelectionSet:function(e){var r=e.selections;return Qe(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=se("",r,": ")+n,u=s+se("(",D(i,", "),")");return u.length>ol&&(u=s+se(`(
|
|
9
|
+
`,Fn(D(i,`
|
|
10
|
+
`)),`
|
|
11
|
+
)`)),D([u,D(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+se(" ",D(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return D(["...",se("on ",r),D(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(se("(",D(i,", "),")")," ")+"on ".concat(n," ").concat(se("",D(a," ")," "))+o},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?ls(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+D(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+D(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+se("(",D(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:Ue(function(t){var e=t.directives,r=t.operationTypes;return D(["schema",D(e," "),Qe(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:Ue(function(t){var e=t.name,r=t.directives;return D(["scalar",e,D(r," ")]," ")}),ObjectTypeDefinition:Ue(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return D(["type",e,se("implements ",D(r," & ")),D(n," "),Qe(i)]," ")}),FieldDefinition:Ue(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(fs(r)?se(`(
|
|
12
|
+
`,Fn(D(r,`
|
|
13
|
+
`)),`
|
|
14
|
+
)`):se("(",D(r,", "),")"))+": "+n+se(" ",D(i," "))}),InputValueDefinition:Ue(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return D([e+": "+r,se("= ",n),D(i," ")]," ")}),InterfaceTypeDefinition:Ue(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return D(["interface",e,se("implements ",D(r," & ")),D(n," "),Qe(i)]," ")}),UnionTypeDefinition:Ue(function(t){var e=t.name,r=t.directives,n=t.types;return D(["union",e,D(r," "),n&&n.length!==0?"= "+D(n," | "):""]," ")}),EnumTypeDefinition:Ue(function(t){var e=t.name,r=t.directives,n=t.values;return D(["enum",e,D(r," "),Qe(n)]," ")}),EnumValueDefinition:Ue(function(t){var e=t.name,r=t.directives;return D([e,D(r," ")]," ")}),InputObjectTypeDefinition:Ue(function(t){var e=t.name,r=t.directives,n=t.fields;return D(["input",e,D(r," "),Qe(n)]," ")}),DirectiveDefinition:Ue(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(fs(r)?se(`(
|
|
15
|
+
`,Fn(D(r,`
|
|
16
|
+
`)),`
|
|
17
|
+
)`):se("(",D(r,", "),")"))+(n?" repeatable":"")+" on "+D(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return D(["extend schema",D(r," "),Qe(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return D(["extend scalar",r,D(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return D(["extend type",r,se("implements ",D(n," & ")),D(i," "),Qe(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return D(["extend interface",r,se("implements ",D(n," & ")),D(i," "),Qe(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return D(["extend union",r,D(n," "),i&&i.length!==0?"= "+D(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return D(["extend enum",r,D(n," "),Qe(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return D(["extend input",r,D(n," "),Qe(i)]," ")}};function Ue(t){return function(e){return D([e.description,t(e)],`
|
|
18
|
+
`)}}function D(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function Qe(t){return se(`{
|
|
19
|
+
`,Fn(D(t,`
|
|
20
|
+
`)),`
|
|
21
|
+
}`)}function se(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Fn(t){return se(" ",t.replace(/\n/g,`
|
|
22
|
+
`))}function cl(t){return t.indexOf(`
|
|
23
|
+
`)!==-1}function fs(t){return t!=null&&t.some(cl)}function ps(){return typeof Ln=="function"?Ji():Ji()}function ll(){__DEV__?_(typeof Mt=="boolean",Mt):_(typeof Mt=="boolean",36)}ps();ll();function ut(t,e){var r=t.directives;return!r||!r.length?!0:hs(r).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?_(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):_(o!==void 0,37)):o=a.value.value,i.name.value==="skip"?!o:o})}function ds(t){var e=[];return be(t,{Directive:function(r){e.push(r.name.value)}}),e}function Lr(t,e){return ds(e).some(function(r){return t.indexOf(r)>-1})}function Zi(t){return t&&Lr(["client"],t)&&Lr(["export"],t)}function fl(t){var e=t.name.value;return e==="skip"||e==="include"}function hs(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!fl(r)){var n=r.arguments,i=r.name.value;__DEV__?_(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):_(n&&n.length===1,38);var a=n[0];__DEV__?_(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):_(a.name&&a.name.value==="if",39);var o=a.value;__DEV__?_(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):_(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),40),e.push({directive:r,ifArgument:a})}}),e}function ea(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new F("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 F(41);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?_(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):_(n.length===1,42),r=n[0].name.value);var i=y(y({},t),{definitions:vt([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function lt(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function jt(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=e&&e[t.name.value];return __DEV__?_(r,"No fragment named ".concat(t.name.value,".")):_(r,43),r}default:return null}}function Q(t){return t!==null&&typeof t=="object"}function Ze(t){return{__ref:String(t)}}function $(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function ta(t){return Q(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function pl(t){return t.kind==="StringValue"}function dl(t){return t.kind==="BooleanValue"}function hl(t){return t.kind==="IntValue"}function ml(t){return t.kind==="FloatValue"}function yl(t){return t.kind==="Variable"}function vl(t){return t.kind==="ObjectValue"}function gl(t){return t.kind==="ListValue"}function bl(t){return t.kind==="EnumValue"}function Sl(t){return t.kind==="NullValue"}function bt(t,e,r,n){if(hl(r)||ml(r))t[e.value]=Number(r.value);else if(dl(r)||pl(r))t[e.value]=r.value;else if(vl(r)){var i={};r.fields.map(function(o){return bt(i,o.name,o.value,n)}),t[e.value]=i}else if(yl(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(gl(r))t[e.value]=r.values.map(function(o){var s={};return bt(s,e,o,n),s[e.value]});else if(bl(r))t[e.value]=r.value;else if(Sl(r))t[e.value]=null;else throw __DEV__?new F('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new F(52)}function ra(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return bt(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return bt(n,a,o,e)})),Mr(t.name.value,n,r)}var wl=["connection","include","skip","client","rest","export"],Mr=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(Fr(i),")")}else return r.connection.key;var a=t;if(e){var o=Fr(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){wl.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Fr(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Fr;return Fr=t,e}}),Fr=function(e){return JSON.stringify(e,_l)};function _l(t,e){return Q(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function ft(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return bt(r,i,a,e)}),r}return null}function Me(t){return t.alias?t.alias.value:t.name.value}function jr(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(xe(a)){if(a.name.value==="__typename")return t[Me(a)]}else{var o=jr(t,jt(a,r).selectionSet,r);if(typeof o=="string")return o}}}function xe(t){return t.kind==="Field"}function qr(t){return t.kind==="InlineFragment"}function or(t){__DEV__?_(t&&t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):_(t&&t.kind==="Document",44);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new F('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new F(45);return r});return __DEV__?_(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):_(e.length<=1,46),t}function et(t){return or(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function sr(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&e.name}).map(function(e){return e.name.value})[0]||null}function pt(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function $r(t){var e=et(t);return __DEV__?_(e&&e.operation==="query","Must contain a query definition."):_(e&&e.operation==="query",47),e}function na(t){__DEV__?_(t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):_(t.kind==="Document",48),__DEV__?_(t.definitions.length<=1,"Fragment must have exactly one definition."):_(t.definitions.length<=1,49);var e=t.definitions[0];return __DEV__?_(e.kind==="FragmentDefinition","Must be a fragment definition."):_(e.kind==="FragmentDefinition",50),e}function qt(t){or(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new F("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new F(51)}function $t(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&bt(e,n.variable.name,n.defaultValue)}),e}function ia(t,e,r){var n=0;return t.forEach(function(i,a){e.call(this,i,a,t)&&(t[n++]=i)},r),t.length=n,t}var ms={kind:"Field",name:{kind:"Name",value:"__typename"}};function vs(t,e){return t.selectionSet.selections.every(function(r){return r.kind==="FragmentSpread"&&vs(e[r.name.value],e)})}function aa(t){return vs(et(t)||na(t),lt(pt(t)))?null:t}function ys(t){return function(r){return t.some(function(n){return n.name&&n.name===r.name.value||n.test&&n.test(r)})}}function oa(t,e){var r=Object.create(null),n=[],i=Object.create(null),a=[],o=aa(be(e,{Variable:{enter:function(s,u,l){l.kind!=="VariableDefinition"&&(r[s.name.value]=!0)}},Field:{enter:function(s){if(t&&s.directives){var u=t.some(function(l){return l.remove});if(u&&s.directives&&s.directives.some(ys(t)))return s.arguments&&s.arguments.forEach(function(l){l.value.kind==="Variable"&&n.push({name:l.value.name.value})}),s.selectionSet&&Ss(s.selectionSet).forEach(function(l){a.push({name:l.name.value})}),null}}},FragmentSpread:{enter:function(s){i[s.name.value]=!0}},Directive:{enter:function(s){if(ys(t)(s))return null}}}));return o&&ia(n,function(s){return!!s.name&&!r[s.name]}).length&&(o=gs(n,o)),o&&ia(a,function(s){return!!s.name&&!i[s.name]}).length&&(o=bs(a,o)),o}var Vt=Object.assign(function(t){return be(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind==="OperationDefinition")){var i=e.selections;if(!!i){var a=i.some(function(s){return xe(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(xe(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return y(y({},e),{selections:vt(vt([],i,!0),[ms],!1)})}}}}}})},{added:function(t){return t===ms}}),El={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&_.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 sa(t){return oa([El],or(t))}function Ol(t){return function(r){return t.some(function(n){return r.value&&r.value.kind==="Variable"&&r.value.name&&(n.name===r.value.name.value||n.test&&n.test(r))})}}function gs(t,e){var r=Ol(t);return aa(be(e,{OperationDefinition:{enter:function(n){return y(y({},n),{variableDefinitions:n.variableDefinitions?n.variableDefinitions.filter(function(i){return!t.some(function(a){return a.name===i.variable.name.value})}):[]})}},Field:{enter:function(n){var i=t.some(function(o){return o.remove});if(i){var a=0;if(n.arguments&&n.arguments.forEach(function(o){r(o)&&(a+=1)}),a===1)return null}}},Argument:{enter:function(n){if(r(n))return null}}}))}function bs(t,e){function r(n){if(t.some(function(i){return i.name===n.name.value}))return null}return aa(be(e,{FragmentSpread:{enter:r},FragmentDefinition:{enter:r}}))}function Ss(t){var e=[];return t.selections.forEach(function(r){(xe(r)||qr(r))&&r.selectionSet?Ss(r.selectionSet).forEach(function(n){return e.push(n)}):r.kind==="FragmentSpread"&&e.push(r)}),e}function ca(t){var e=qt(t),r=e.operation;if(r==="query")return t;var n=be(t,{OperationDefinition:{enter:function(i){return y(y({},i),{operation:"query"})}}});return n}function ua(t){or(t);var e=oa([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e&&(e=be(e,{FragmentDefinition:{enter:function(r){if(r.selectionSet){var n=r.selectionSet.selections.every(function(i){return xe(i)&&i.name.value==="__typename"});if(n)return null}}}})),e}var xl=Object.prototype.hasOwnProperty;function la(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Vr(t)}function Vr(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new tt,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var Tl=function(t,e,r){return this.merge(t[r],e[r])},tt=function(){function t(e){e===void 0&&(e=Tl),this.reconciler=e,this.isObject=Q,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return Q(r)&&Q(e)?(Object.keys(r).forEach(function(o){if(xl.call(e,o)){var s=e[o];if(r[o]!==s){var u=n.reconciler.apply(n,vt([e,r,o],i,!1));u!==s&&(e=n.shallowCopyForMerge(e),e[o]=u)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return Q(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=y({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function kl(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=Dl(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dl(t,e){if(!!t){if(typeof t=="string")return ws(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ws(t,e)}}function ws(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ha(t,e,r){return e&&_s(t.prototype,e),r&&_s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var ma=function(){return typeof Symbol=="function"},ya=function(t){return ma()&&Boolean(Symbol[t])},va=function(t){return ya(t)?Symbol[t]:"@@"+t};ma()&&!ya("observable")&&(Symbol.observable=Symbol("observable"));var Il=va("iterator"),pa=va("observable"),Es=va("species");function jn(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ur(t){var e=t.constructor;return e!==void 0&&(e=e[Es],e===null&&(e=void 0)),e!==void 0?e:q}function Pl(t){return t instanceof q}function cr(t){cr.log?cr.log(t):setTimeout(function(){throw t})}function Mn(t){Promise.resolve().then(function(){try{t()}catch(e){cr(e)}})}function Os(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=jn(e,"unsubscribe");r&&r.call(e)}}catch(n){cr(n)}}function da(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Al(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(xs(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function xs(t,e,r){t._state="running";var n=t._observer;try{var i=jn(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(da(t),i)i.call(n,r);else throw r;break;case"complete":da(t),i&&i.call(n);break}}catch(a){cr(a)}t._state==="closed"?Os(t):t._state==="running"&&(t._state="ready")}function fa(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Mn(function(){return Al(t)});return}xs(t,e,r)}}var Nl=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new Rl(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(da(this),Os(this))},ha(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),Rl=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){fa(this._subscription,"next",n)},e.error=function(n){fa(this._subscription,"error",n)},e.complete=function(){fa(this._subscription,"complete")},ha(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),q=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Nl(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){u.unsubscribe(),a()}var u=i.subscribe({next:function(l){try{n(l,s)}catch(f){o(f),u.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Ur(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Ur(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Ur(this),o=arguments.length>1,s=!1,u=arguments[1],l=u;return new a(function(f){return i.subscribe({next:function(h){var p=!s;if(s=!0,!p||o)try{l=n(l,h)}catch(d){return f.error(d)}else l=h},error:function(h){f.error(h)},complete:function(){if(!s&&!o)return f.error(new TypeError("Cannot reduce an empty sequence"));f.next(l),f.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=Ur(this);return new s(function(u){var l,f=0;function h(p){l=p.subscribe({next:function(d){u.next(d)},error:function(d){u.error(d)},complete:function(){f===a.length?(l=void 0,u.complete()):h(s.from(a[f++]))}})}return h(n),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Ur(this);return new a(function(o){var s=[],u=i.subscribe({next:function(f){if(n)try{f=n(f)}catch(p){return o.error(p)}var h=a.from(f).subscribe({next:function(p){o.next(p)},error:function(p){o.error(p)},complete:function(){var p=s.indexOf(h);p>=0&&s.splice(p,1),l()}});s.push(h)},error:function(f){o.error(f)},complete:function(){l()}});function l(){u.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(f){return f.unsubscribe()}),u.unsubscribe()}})},e[pa]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=jn(n,pa);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Pl(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(ya("iterator")&&(a=jn(n,Il),a))return new i(function(s){Mn(function(){if(!s.closed){for(var u=kl(a.call(n)),l;!(l=u()).done;){var f=l.value;if(s.next(f),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){Mn(function(){if(!s.closed){for(var u=0;u<n.length;++u)if(s.next(n[u]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:t;return new o(function(s){Mn(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},ha(t,null,[{key:Es,get:function(){return this}}]),t}();ma()&&Object.defineProperty(q,Symbol("extensions"),{value:{symbol:pa,hostReportError:cr},configurable:!0});function ga(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var ur;typeof self<"u"?ur=self:typeof window<"u"?ur=window:typeof global<"u"?ur=global:typeof module<"u"?ur=module:ur=Function("return this")();var Yh=ga(ur);var Ts=q.prototype,ks="@@observable";Ts[ks]||(Ts[ks]=function(){return this});var Cl=Object.prototype.toString;function qn(t){return ba(t)}function ba(t,e){switch(Cl.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(i,a){r[a]=ba(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=ba(t[i],e)}),n}default:return t}}function Ll(t){var e=new Set([t]);return e.forEach(function(r){Q(r)&&Fl(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){Q(r[n])&&e.add(r[n])})}),t}function Fl(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Qr(t){return __DEV__&&Ll(t),t}function Ut(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function $n(t,e,r){return new q(function(n){var i=n.next,a=n.error,o=n.complete,s=0,u=!1,l={then:function(d){return new Promise(function(v){return v(d())})}};function f(d,v){return d?function(m){++s;var b=function(){return d(m)};l=l.then(b,b).then(function(E){--s,i&&i.call(n,E),u&&h.complete()},function(E){throw--s,E}).catch(function(E){a&&a.call(n,E)})}:function(m){return v&&v.call(n,m)}}var h={next:f(e,i),error:f(r,a),complete:function(){u=!0,s||o&&o.call(n)}},p=t.subscribe(h);return function(){return p.unsubscribe()}})}var je=typeof WeakMap=="function"&&ye(function(){return navigator.product})!=="ReactNative",Ds=typeof WeakSet=="function",Is=typeof Symbol=="function"&&typeof Symbol.for=="function",lm=typeof ye(function(){return window.document.createElement})=="function",fm=ye(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Vn(t){function e(r){Object.defineProperty(t,r,{value:q})}return Is&&Symbol.species&&e(Symbol.species),e("@@species"),t}function Ps(t){return t&&typeof t.then=="function"}var lr=function(t){de(e,t);function e(r){var n=t.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.addCount=0,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],Ut(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),Ut(n.observers,"error",i))},complete:function(){var i=n.sub;if(i!==null){var a=n.sources.shift();a?Ps(a)?a.then(function(o){return n.sub=o.subscribe(n.handlers)}):n.sub=a.subscribe(n.handlers):(i&&setTimeout(function(){return i.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),Ut(n.observers,"complete"))}}},n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof r=="function"&&(r=[new q(r)]),Ps(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r),++this.addCount)},e.prototype.removeObserver=function(r,n){this.observers.delete(r)&&--this.addCount<1&&!n&&this.handlers.complete()},e.prototype.cleanup=function(r){var n=this,i=!1,a=function(){i||(i=!0,n.observers.delete(o),r())},o={next:a,error:a,complete:a},s=this.addCount;this.addObserver(o),this.addCount=s},e}(q);Vn(lr);function Ne(t){return Array.isArray(t)&&t.length>0}function fr(t){return t.errors&&t.errors.length>0||!1}function St(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var As=new Map;function Br(t){var e=As.get(t)||1;return As.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ns(t){var e=Br("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Gr(t,e){return St(t,e,e.variables&&{variables:y(y({},t&&t.variables),e.variables)})}function Un(t){return new q(function(e){e.error(t)})}var Qn=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function Sa(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new F("illegal argument: ".concat(i)):new F(24)}return t}function wa(t,e){var r=y({},t),n=function(a){typeof a=="function"?r=y(y({},r),a(r)):r=y(y({},r),a)},i=function(){return y({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function _a(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?sr(e.query)||void 0:""),e}function Rs(t,e){return e?e(t):q.of()}function Kr(t){return typeof t=="function"?new qe(t):t}function Bn(t){return t.request.length<=1}var Ml=function(t){de(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),qe=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return q.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Kr).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=Kr(r),a=Kr(n||new t(Rs));return Bn(i)&&Bn(a)?new t(function(o){return e(o)?i.request(o)||q.of():a.request(o)||q.of()}):new t(function(o,s){return e(o)?i.request(o,s)||q.of():a.request(o,s)||q.of()})},t.execute=function(e,r){return e.request(wa(r.context,_a(Sa(r))))||q.of()},t.concat=function(e,r){var n=Kr(e);if(Bn(n))return __DEV__&&_.warn(new Ml("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Kr(r);return Bn(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||q.of()})||q.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||q.of()})||q.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(Rs)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new F("request is not implemented"):new F(19)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var pr=qe.execute;var Cs="3.6.9";var Ls=Object.prototype.hasOwnProperty;function Fs(t){return function(e){return e.text().then(function(r){try{return JSON.parse(r)}catch(i){var n=i;throw n.name="ServerParseError",n.response=e,n.statusCode=e.status,n.bodyText=r,n}}).then(function(r){return e.status>=300&&Qn(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Ls.call(r,"data")&&!Ls.call(r,"errors")&&Qn(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var Wr=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new F("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new F(21);throw n.parseError=i,n}return r};var jl={includeQuery:!0,includeExtensions:!1},ql={accept:"*/*","content-type":"application/json"},$l={method:"POST"},Ms={http:jl,headers:ql,options:$l},js=function(t,e){return e(t)};function qs(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(h){i=y(y(y({},i),h.options),{headers:y(y({},i.headers),Vl(h.headers))}),h.credentials&&(i.credentials=h.credentials),a=y(y({},a),h.http)});var o=t.operationName,s=t.extensions,u=t.variables,l=t.query,f={operationName:o,variables:u};return a.includeExtensions&&(f.extensions=s),a.includeQuery&&(f.query=e(l,ar)),{options:i,body:f}}function Vl(t){if(t){var e=Object.create(null);return Object.keys(Object(t)).forEach(function(r){e[r.toLowerCase()]=t[r]}),e}return t}var $s=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new F(`
|
|
25
|
+
"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:
|
|
26
|
+
|
|
27
|
+
import fetch from 'cross-fetch';
|
|
28
|
+
import { ApolloClient, HttpLink } from '@apollo/client';
|
|
29
|
+
const client = new ApolloClient({
|
|
30
|
+
link: new HttpLink({ uri: '/graphql', fetch })
|
|
31
|
+
});
|
|
32
|
+
`):new F(20)};var Vs=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var Us=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function Qs(t,e){var r=[],n=function(h,p){r.push("".concat(h,"=").concat(encodeURIComponent(p)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Wr(e.variables,"Variables map")}catch(h){return{parseError:h}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Wr(e.extensions,"Extensions map")}catch(h){return{parseError:h}}n("extensions",a)}var o="",s=t,u=t.indexOf("#");u!==-1&&(o=t.substr(u),s=t.substr(0,u));var l=s.indexOf("?")===-1?"?":"&",f=s+l+r.join("&")+o;return{newURI:f}}var Bs=ye(function(){return fetch}),Gs=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,i=t.print,a=i===void 0?js:i,o=t.includeExtensions,s=t.useGETForQueries,u=t.includeUnusedVariables,l=u===void 0?!1:u,f=Xe(t,["uri","fetch","print","includeExtensions","useGETForQueries","includeUnusedVariables"]);__DEV__&&$s(n||Bs);var h={http:{includeExtensions:o},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new qe(function(p){var d=Us(p,r),v=p.getContext(),m={};if(v.clientAwareness){var b=v.clientAwareness,E=b.name,I=b.version;E&&(m["apollographql-client-name"]=E),I&&(m["apollographql-client-version"]=I)}var w=y(y({},m),v.headers),T={http:v.http,options:v.fetchOptions,credentials:v.credentials,headers:w},A=qs(p,a,Ms,h,T),P=A.options,N=A.body;if(N.variables&&!l){var L=new Set(Object.keys(N.variables));be(p.query,{Variable:function(C,re,oe){oe&&oe.kind!=="VariableDefinition"&&L.delete(C.name.value)}}),L.size&&(N.variables=y({},N.variables),L.forEach(function(C){delete N.variables[C]}))}var pe;if(!P.signal){var B=Vs(),Fe=B.controller,Ft=B.signal;pe=Fe,pe&&(P.signal=Ft)}var On=function(C){return C.kind==="OperationDefinition"&&C.operation==="mutation"};if(s&&!p.query.definitions.some(On)&&(P.method="GET"),P.method==="GET"){var j=Qs(d,N),fe=j.newURI,J=j.parseError;if(J)return Un(J);d=fe}else try{P.body=Wr(N,"Payload")}catch(C){return Un(C)}return new q(function(C){var re=n||ye(function(){return fetch})||Bs;return re(d,P).then(function(oe){return p.setContext({response:oe}),oe}).then(Fs(p)).then(function(oe){return C.next(oe),C.complete(),oe}).catch(function(oe){oe.name!=="AbortError"&&(oe.result&&oe.result.errors&&oe.result.data&&C.next(oe.result),C.error(oe))}),function(){pe&&pe.abort()}})})};var Ea=function(t){de(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,Gs(r).request)||this;return n.options=r,n}return e}(qe);var Hs=Object.prototype,Ks=Hs.toString,Ul=Hs.hasOwnProperty,Ws=Function.prototype.toString,Oa=new Map;function ne(t,e){try{return xa(t,e)}finally{Oa.clear()}}function xa(t,e){if(t===e)return!0;var r=Ks.call(t),n=Ks.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(Js(t,e))return!0;var i=zs(t),a=zs(e),o=i.length;if(o!==a.length)return!1;for(var s=0;s<o;++s)if(!Ul.call(e,i[s]))return!1;for(var s=0;s<o;++s){var u=i[s];if(!xa(t[u],e[u]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t=="".concat(e);case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(Js(t,e))return!0;for(var l=t.entries(),f=r==="[object Map]";;){var h=l.next();if(h.done)break;var p=h.value,d=p[0],v=p[1];if(!e.has(d)||f&&!xa(v,e.get(d)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{var m=t.byteLength;if(m===e.byteLength)for(;m--&&t[m]===e[m];);return m===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{var b=Ws.call(t);return b!==Ws.call(e)?!1:!Gl(b,Bl)}}return!1}function zs(t){return Object.keys(t).filter(Ql,t)}function Ql(t){return this[t]!==void 0}var Bl="{ [native code] }";function Gl(t,e){var r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function Js(t,e){var r=Oa.get(t);if(r){if(r.has(e))return!0}else Oa.set(t,r=new Set);return r.add(e),!1}var Kl=function(){return Object.create(null)},Ys=Array.prototype,Wl=Ys.forEach,zl=Ys.slice,rt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Kl),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return Wl.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(zl.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Jl(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},t}();function Jl(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Se=null,Xs={},Hl=1,Yl=function(){return function(){function t(){this.id=["slot",Hl++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return t.prototype.hasValue=function(){for(var e=Se;e;e=e.parent)if(this.id in e.slots){var r=e.slots[this.id];if(r===Xs)break;return e!==Se&&(Se.slots[this.id]=r),!0}return Se&&(Se.slots[this.id]=Xs),!1},t.prototype.getValue=function(){if(this.hasValue())return Se.slots[this.id]},t.prototype.withValue=function(e,r,n,i){var a,o=(a={__proto__:null},a[this.id]=e,a),s=Se;Se={parent:s,slots:o};try{return r.apply(i,n)}finally{Se=s}},t.bind=function(e){var r=Se;return function(){var n=Se;try{return Se=r,e.apply(this,arguments)}finally{Se=n}}},t.noContext=function(e,r,n){if(Se){var i=Se;try{return Se=null,e.apply(n,r)}finally{Se=i}}else return e.apply(n,r)},t}()};function Zs(t){try{return t()}catch{}}var Ta="@wry/context:Slot",Xl=Zs(function(){return globalThis})||Zs(function(){return global})||Object.create(null),ec=Xl,Gn=ec[Ta]||Array[Ta]||function(t){try{Object.defineProperty(ec,Ta,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(Yl()),Zl=Gn.bind,ef=Gn.noContext;function tf(){}var rf=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=tf),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),Wn=new Gn,ka,nf=Object.prototype.hasOwnProperty,Ia=(ka=Array.from,ka===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:ka);function Kn(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var zr=[],af=100;function dr(t,e){if(!t)throw new Error(e||"assertion failure")}function of(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function rc(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function sf(t){return t.slice(0)}var cf=function(){function t(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!wt(this))return tc(this),this.value[0]},t.prototype.recompute=function(e){return dr(!this.recomputing,"already recomputing"),tc(this),wt(this)?uf(this,e):rc(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,nc(this),Kn(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),cc(this),Pa(this,function(r,n){r.setDirty(),uc(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=zr.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Ia(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),zr.push(this.deps),this.deps=null)},t.count=0,t}();function tc(t){var e=Wn.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),wt(t)?ac(e,t):oc(e,t),e}function uf(t,e){return cc(t),Wn.withValue(t,lf,[t,e]),pf(t,e)&&ff(t),rc(t.value)}function lf(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function wt(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function ff(t){t.dirty=!1,!wt(t)&&ic(t)}function nc(t){Pa(t,ac)}function ic(t){Pa(t,oc)}function Pa(t,e){var r=t.parents.size;if(r)for(var n=Ia(t.parents),i=0;i<r;++i)e(n[i],t)}function ac(t,e){dr(t.childValues.has(e)),dr(wt(e));var r=!wt(t);if(!t.dirtyChildren)t.dirtyChildren=zr.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&nc(t)}function oc(t,e){dr(t.childValues.has(e)),dr(!wt(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,sf(e.value)):of(r,e.value)||t.setDirty(),sc(t,e),!wt(t)&&ic(t)}function sc(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(zr.length<af&&zr.push(r),t.dirtyChildren=null))}function cc(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){uc(t,r)}),t.forgetDeps(),dr(t.dirtyChildren===null)}function uc(t,e){e.parents.delete(t),t.childValues.delete(e),sc(t,e)}function pf(t,e){if(typeof t.subscribe=="function")try{Kn(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var df={setDirty:!0,dispose:!0,forget:!0};function zn(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=Wn.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(Kn(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&nf.call(df,o)?o:"setDirty";Ia(s).forEach(function(l){return l[u]()}),e.delete(a),Kn(s)}},n}function lc(){var t=new rt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var vv=lc(),Da=new Set;function Qt(t,e){e===void 0&&(e=Object.create(null));var r=new rf(e.max||Math.pow(2,16),function(l){return l.dispose()}),n=e.keyArgs,i=e.makeCacheKey||lc(),a=function(){var l=i.apply(null,n?n.apply(null,arguments):arguments);if(l===void 0)return t.apply(null,arguments);var f=r.get(l);f||(r.set(l,f=new cf(t)),f.subscribe=e.subscribe,f.forget=function(){return r.delete(l)});var h=f.recompute(Array.prototype.slice.call(arguments));return r.set(l,f),Da.add(r),Wn.hasValue()||(Da.forEach(function(p){return p.clean()}),Da.clear()),h};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(l){var f=r.get(l);f&&f.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(l){var f=r.get(l);if(f)return f.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function u(l){return r.delete(l)}return a.forgetKey=u,a.forget=function(){return u(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Aa=function(){function t(){this.getFragmentDoc=Qt(ea)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.transformForLink=function(e){return e},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(y(y({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(y(y({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,i=Xe(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Xe(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(y(y({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(y(y({},e),{data:a})),a)}})},t}();var Jr=function(){function t(e,r,n,i){this.message=e,this.path=r,this.query=n,this.variables=i}return t}();var ce=Object.prototype.hasOwnProperty;function Hn(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=n!==void 0?{id:n}:i!==void 0?{_id:i}:void 0),n===void 0&&(n=i),n!==void 0))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var fc={dataIdFromObject:Hn,addTypename:!0,resultCaching:!0,canonizeResults:!1};function pc(t){return St(fc,t)}function Yn(t){var e=t.canonizeResults;return e===void 0?fc.canonizeResults:e}function dc(t,e){return $(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Na=/^[_a-z][_0-9a-z]*/i;function Be(t){var e=t.match(Na);return e?e[0]:t}function Jn(t,e,r){return Q(e)?X(e)?e.every(function(n){return Jn(t,n,r)}):t.selections.every(function(n){if(xe(n)&&ut(n,r)){var i=Me(n);return ce.call(e,i)&&(!n.selectionSet||Jn(n.selectionSet,e[i],r))}return!0}):!1}function _t(t){return Q(t)&&!$(t)&&!X(t)}function hc(){return new tt}var X=function(t){return Array.isArray(t)};var Xn=Object.create(null),Ra=function(){return Xn},mc=Object.create(null),hr=function(){function t(e,r){var n=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Qr($(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return $(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Ze(i);if($(i))return i;var o=n.policies.identify(i)[0];if(o){var s=Ze(o);return a&&n.merge(o,i),s}}}return t.prototype.toObject=function(){return y({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),ce.call(this.data,e)){var n=this.data[e];if(n&&ce.call(n,r))return n[r]}if(r==="__typename"&&ce.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Et)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),ce.call(this.data,e))return this.data[e];if(this instanceof Et)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;$(e)&&(e=e.__ref),$(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?_(typeof i=="string","store.merge expects a string ID"):_(typeof i=="string",1);var s=new tt(mf).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],this.group.caching)){var u=Object.create(null);a||(u.__exists=1),Object.keys(o).forEach(function(l){if(!a||a[l]!==s[l]){u[l]=1;var f=Be(l);f!==l&&!n.policies.hasKeyArgs(s.__typename,f)&&(u[f]=1),s[l]===void 0&&!(n instanceof Et)&&delete s[l]}}),u.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete u.__typename,Object.keys(u).forEach(function(l){return n.group.dirty(i,l)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,u={DELETE:Xn,INVALIDATE:mc,isReference:$,toReference:this.toReference,canRead:this.canRead,readField:function(l,f){return n.policies.readField(typeof l=="string"?{fieldName:l,from:f||Ze(e)}:l,{store:n})}};if(Object.keys(i).forEach(function(l){var f=Be(l),h=i[l];if(h!==void 0){var p=typeof r=="function"?r:r[l]||r[f];if(p){var d=p===Ra?Xn:p(Qr(h),y(y({},u),{fieldName:f,storeFieldName:l,storage:n.getStorage(e,l)}));d===mc?n.group.dirty(e,l):(d===Xn&&(d=void 0),d!==h&&(a[l]=d,o=!0,h=d))}h!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Et?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=Ra,i):Ra)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(ce.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Et&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){ce.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&ce.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Xe(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Et?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){ce.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Et;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!ce.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){$(a)&&(r[a.__ref]=!0),Q(a)&&Object.keys(a).forEach(function(o){var s=a[o];Q(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var yc=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?zn():null,this.keyMaker=new rt(je)},t.prototype.depend=function(e,r){if(this.d){this.d(Ca(e,r));var n=Be(r);n!==r&&this.d(Ca(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Ca(e,r),r==="__exists"?"forget":"setDirty")},t}();function Ca(t,e){return e+"#"+t}function La(t,e){Bt(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){de(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,u=i.seed,l=r.call(this,a,new yc(s))||this;return l.stump=new hf(l),l.storageTrie=new rt(je),u&&l.replace(u),l}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(t);t.Root=e})(hr||(hr={}));var Et=function(t){de(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(u){ne(o[u],s[u])||n.group.dirty(a,u)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(u){n.group.dirty(a,u)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return y(y({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return ce.call(this.data,r)?y(y({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(hr),hf=function(t){de(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new yc(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Et);function mf(t,e,r){var n=t[r],i=e[r];return ne(n,i)?n:i}function Bt(t){return!!(t instanceof hr&&t.group.caching)}function yf(t){return Q(t)?X(t)?t.slice(0):y({__proto__:Object.getPrototypeOf(t)},t):t}var Zn=function(){function t(){this.known=new(Ds?WeakSet:Set),this.pool=new rt(je),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return Q(e)&&this.known.has(e)},t.prototype.pass=function(e){if(Q(e)){var r=yf(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(Q(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),u=[s],l=this.sortedKeys(e);u.push(l.json);var f=u.length;l.sorted.forEach(function(d){u.push(r.admit(e[d]))});var o=this.pool.lookupArray(u);if(!o.object){var h=o.object=Object.create(s);this.known.add(h),l.sorted.forEach(function(d,v){h[d]=u[f+v]}),__DEV__&&Object.freeze(h)}return o.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var Re=Object.assign(function(t){if(Q(t)){Fa===void 0&&vc();var e=Fa.admit(t),r=Ma.get(e);return r===void 0&&Ma.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:vc}),Fa,Ma;function vc(){Fa=new Zn,Ma=new(je?WeakMap:Map)}function gc(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var bc=function(){function t(e){var r=this;this.knownResults=new(je?WeakMap:Map),this.config=St(e,{addTypename:e.addTypename!==!1,canonizeResults:Yn(e)}),this.canon=e.canon||new Zn,this.executeSelectionSet=Qt(function(n){var i,a=n.context.canonizeResults,o=gc(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?y(y({},s),{result:r.canon.admit(s.result)}):s:(La(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:gc,makeCacheKey:function(n,i,a,o){if(Bt(a.store))return a.store.makeCacheKey(n,$(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=Qt(function(n){return La(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(Bt(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new Zn},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,u=s===void 0?!0:s,l=e.canonizeResults,f=l===void 0?this.config.canonizeResults:l,h=this.config.cache.policies;o=y(y({},$t($r(n))),o);var p=Ze(a),d=this.executeSelectionSet({selectionSet:qt(n).selectionSet,objectOrReference:p,enclosingRef:p,context:{store:r,query:n,policies:h,variables:o,varString:Re(o),canonizeResults:f,fragmentMap:lt(pt(n))}}),v;if(d.missing&&(v=[new Jr(vf(d.missing),d.missing,n,o)],!u))throw v[0];return{result:d.result,complete:!v,missing:v}},t.prototype.isFresh=function(e,r,n,i){if(Bt(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if($(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,u=o.policies,l=o.store,f=l.getFieldValue(i,"__typename"),h=[],p,d=new tt;this.config.addTypename&&typeof f=="string"&&!u.rootIdsByTypename[f]&&h.push({__typename:f});function v(w,T){var A;return w.missing&&(p=d.merge(p,(A={},A[T]=w.missing,A))),w.result}var m=new Set(n.selections);m.forEach(function(w){var T,A;if(!!ut(w,s))if(xe(w)){var P=u.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),N=Me(w);P===void 0?Vt.added(w)||(p=d.merge(p,(T={},T[N]="Can't find field '".concat(w.name.value,"' on ").concat($(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),T))):X(P)?P=v(r.executeSubSelectedArray({field:w,array:P,enclosingRef:a,context:o}),N):w.selectionSet?P!=null&&(P=v(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:P,enclosingRef:$(P)?P:a,context:o}),N)):o.canonizeResults&&(P=r.canon.pass(P)),P!==void 0&&h.push((A={},A[N]=P,A))}else{var L=jt(w,o.fragmentMap);L&&u.fragmentMatches(L,f)&&L.selectionSet.selections.forEach(m.add,m)}});var b=Vr(h),E={result:b,missing:p},I=o.canonizeResults?this.canon.admit(E):Qr(E);return I.result&&this.knownResults.set(I.result,n),I},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,u=new tt;function l(f,h){var p;return f.missing&&(s=u.merge(s,(p={},p[h]=f.missing,p))),f.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(f,h){return f===null?null:X(f)?l(r.executeSubSelectedArray({field:n,array:f,enclosingRef:a,context:o}),h):n.selectionSet?l(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:f,enclosingRef:$(f)?f:a,context:o}),h):(__DEV__&&gf(o.store,n,f),f)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function vf(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function gf(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){Q(i)&&(__DEV__?_(!$(i),"Missing selection set for object of type ".concat(dc(t,i)," returned for query field ").concat(e.name.value)):_(!$(i),5),Object.values(i).forEach(n.add,n))})}}var we=null,Sc={},bf=1,Sf=function(){return function(){function t(){this.id=["slot",bf++,Date.now(),Math.random().toString(36).slice(2)].join(":")}return t.prototype.hasValue=function(){for(var e=we;e;e=e.parent)if(this.id in e.slots){var r=e.slots[this.id];if(r===Sc)break;return e!==we&&(we.slots[this.id]=r),!0}return we&&(we.slots[this.id]=Sc),!1},t.prototype.getValue=function(){if(this.hasValue())return we.slots[this.id]},t.prototype.withValue=function(e,r,n,i){var a,o=(a={__proto__:null},a[this.id]=e,a),s=we;we={parent:s,slots:o};try{return r.apply(i,n)}finally{we=s}},t.bind=function(e){var r=we;return function(){var n=we;try{return we=r,e.apply(this,arguments)}finally{we=n}}},t.noContext=function(e,r,n){if(we){var i=we;try{return we=null,e.apply(n,r)}finally{we=i}}else return e.apply(n,r)},t}()},ja="@wry/context:Slot",qa=Array,ei=qa[ja]||function(){var t=Sf();try{Object.defineProperty(qa,ja,{value:qa[ja]=t,enumerable:!1,writable:!1,configurable:!1})}finally{return t}}(),Yv=ei.bind,Xv=ei.noContext;var mr=new ei,wc=new WeakMap;function Hr(t){var e=wc.get(t);return e||wc.set(t,e={vars:new Set,dep:zn()}),e}function $a(t){Hr(t).vars.forEach(function(e){return e.forgetCache(t)})}function _c(t){Hr(t).vars.forEach(function(e){return e.attachCache(t)})}function ti(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){Hr(u).dep.dirty(n),wf(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=mr.getValue();s&&(i(s),Hr(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.delete(a)}};var i=n.attachCache=function(a){return e.add(a),Hr(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function wf(t){t.broadcastWatches&&t.broadcastWatches()}var Ec=Object.create(null);function Va(t){var e=JSON.stringify(t);return Ec[e]||(Ec[e]=Object.create(null))}function Ua(t){var e=Va(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Ba(t,function(o){var s=yr(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&ce.call(r,o[0])&&(s=yr(r,o,xc)),__DEV__?_(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):_(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Qa(t){var e=Va(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=Ba(t,function(l){var f=l[0],h=f.charAt(0);if(h==="@"){if(i&&Ne(i.directives)){var p=f.slice(1),d=i.directives.find(function(E){return E.name.value===p}),v=d&&ft(d,a);return v&&yr(v,l.slice(1))}return}if(h==="$"){var m=f.slice(1);if(a&&ce.call(a,m)){var b=l.slice(0);return b[0]=m,yr(a,b)}return}if(r)return yr(r,l)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function Ba(t,e){var r=new tt;return Oc(t).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=r.merge(n,o)}return n},Object.create(null))}function Oc(t){var e=Va(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){X(i)?(Oc(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),X(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function xc(t,e){return t[e]}function yr(t,e,r){return r=r||xc,Tc(e.reduce(function n(i,a){return X(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Tc(t){return Q(t)?X(t)?t.map(Tc):Ba(Object.keys(t).sort(),function(e){return yr(t,e)}):t}Mr.setStringify(Re);function Ga(t){return t.args!==void 0?t.args:t.field?ft(t.field,t.variables):null}var _f=function(){},kc=function(t,e){return e.fieldName},Dc=function(t,e,r){var n=r.mergeObjects;return n(t,e)},Ic=function(t,e){return e},Ac=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=y({dataIdFromObject:Hn},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,r){var n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=y(y({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var p=ri(arguments,o);return i.readField(p,{store:i.cache.data,variables:p.variables})}}),u,l=a&&this.getTypePolicy(a),f=l&&l.keyFn||this.config.dataIdFromObject;f;){var h=f(e,s);if(X(h))f=Ua(h);else{u=h;break}}return u=u?String(u):void 0,s.keyObject?[u,s.keyObject]:[u]},t.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,u=Xe(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),ce.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(u,l){u.merge=typeof l=="function"?l:l===!0?Dc:l===!1?Ic:u.merge}s(i,r.merge),i.keyFn=a===!1?_f:X(a)?Ua(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(u){var l=n.getFieldPolicy(e,u,!0),f=o[u];if(typeof f=="function")l.read=f;else{var h=f.keyArgs,p=f.read,d=f.merge;l.keyFn=h===!1?kc:X(h)?Qa(h):typeof h=="function"?h:l.keyFn,typeof p=="function"&&(l.read=p),s(l,d)}l.read&&l.merge&&(l.keyFn=l.keyFn||kc)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?_(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):_(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match(Na);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!ce.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=r.getTypePolicy(o),u=s.fields,l=Xe(s,["fields"]);Object.assign(n,l),Object.assign(n.fields,u)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),u=[s],l=function(v){var m=a.getSupertypeSet(v,!1);m&&m.size&&u.indexOf(m)<0&&u.push(m)},f=!!(n&&this.fuzzySubtypes.size),h=!1,p=0;p<u.length;++p){var d=u[p];if(d.has(o))return s.has(o)||(h&&__DEV__&&_.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;d.forEach(l),f&&p===u.length-1&&Jn(e.selectionSet,n,i)&&(f=!1,h=!0,this.fuzzySubtypes.forEach(function(v,m){var b=r.match(v);b&&b[0]===r&&l(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},u=Ga(e);o;){var l=o(u,s);if(X(l))o=Qa(l);else{a=l||n;break}}return a===void 0&&(a=e.field?ra(e.field,e.variables):Mr(n,Ga(e))),a===!1?n:n===Be(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Be(o),u=r.store.getFieldValue(n,o),l=this.getFieldPolicy(e.typename,s,!1),f=l&&l.read;if(f){var h=Pc(this,n,e,r,r.store.getStorage($(n)?n.__ref:n,o));return mr.withValue(this.cache,f,[u,h])}return u}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,u=n.merge;return u===Dc?Nc(i.store)(e,r):u===Ic?r:(i.overwrite&&(e=void 0),u(e,r,Pc(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Pc(t,e,r,n,i){var a=t.getStoreFieldName(r),o=Be(a),s=r.variables||n.variables,u=n.store,l=u.toReference,f=u.canRead;return{args:Ga(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:$,toReference:l,storage:i,cache:t.cache,canRead:f,readField:function(){return t.readField(ri(arguments,e,s),n)},mergeObjects:Nc(n.store)}}function ri(t,e,r){var n=t[0],i=t[1],a=t.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=y({},n),ce.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&_.warn("Undefined 'from' passed to readField with arguments ".concat(Ns(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Nc(t){return function(r,n){if(X(r)||X(n))throw __DEV__?new F("Cannot automatically merge arrays"):new F(4);if(Q(r)&&Q(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if($(r)&&_t(n))return t.merge(r.__ref,n),r;if(_t(r)&&$(n))return t.merge(r,n.__ref),n;if(_t(r)&&_t(n))return y(y({},r),n)}return n}}function Ka(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:y(y({},t),{clientOnly:e,deferred:r})),i}var Fc=function(){function t(e,r){this.cache=e,this.reader=r}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,u=r.overwrite,l=et(i),f=hc();s=y(y({},$t(l)),s);var h={store:e,written:Object.create(null),merge:function(d,v){return f.merge(d,v)},variables:s,varString:Re(s),fragmentMap:lt(pt(i)),overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map},p=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:h});if(!$(p))throw __DEV__?new F("Could not identify object ".concat(JSON.stringify(a))):new F(6);return h.incomingById.forEach(function(d,v){var m=d.storeObject,b=d.mergeTree,E=d.fieldNodeSet,I=Ze(v);if(b&&b.map.size){var w=n.applyMerges(b,I,m,h);if($(w))return;m=w}if(__DEV__&&!h.overwrite){var T=Object.create(null);E.forEach(function(N){N.selectionSet&&(T[N.name.value]=!0)});var A=function(N){return T[Be(N)]===!0},P=function(N){var L=b&&b.map.get(N);return Boolean(L&&L.info&&L.info.merge)};Object.keys(m).forEach(function(N){A(N)&&!P(N)&&Ef(I,m,N,h.store)})}e.merge(v,m)}),e.retain(p.__ref),p},t.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,u=this.cache.policies,l=Object.create(null),f=n&&u.rootTypenamesById[n]||jr(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof f=="string"&&(l.__typename=f);var h=function(){var w=ri(arguments,l,o.variables);if($(w.from)){var T=o.incomingById.get(w.from.__ref);if(T){var A=u.readField(y(y({},w),{from:T.storeObject}),o);if(A!==void 0)return A}}return u.readField(w,o)},p=new Set;this.flattenFields(a,i,o,f).forEach(function(w,T){var A,P=Me(T),N=i[P];if(p.add(T),N!==void 0){var L=u.getStoreFieldName({typename:f,fieldName:T.name.value,field:T,variables:w.variables}),pe=Rc(s,L),B=r.processFieldValue(N,T,T.selectionSet?Ka(w,!1,!1):w,pe),Fe=void 0;T.selectionSet&&($(B)||_t(B))&&(Fe=h("__typename",B));var Ft=u.getMergeFunction(f,T.name.value,Fe);Ft?pe.info={field:T,typename:f,merge:Ft}:Cc(s,L),l=w.merge(l,(A={},A[L]=B,A))}else __DEV__&&!w.clientOnly&&!w.deferred&&!Vt.added(T)&&!u.getReadFunction(f,T.name.value)&&__DEV__&&_.error("Missing field '".concat(Me(T),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var d=u.identify(i,{typename:f,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:l,readField:h}),v=d[0],m=d[1];n=n||v,m&&(l=o.merge(l,m))}catch(w){if(!n)throw w}if(typeof n=="string"){var b=Ze(n),E=o.written[n]||(o.written[n]=[]);if(E.indexOf(a)>=0||(E.push(a),this.reader&&this.reader.isFresh(i,b,a,o)))return b;var I=o.incomingById.get(n);return I?(I.storeObject=o.merge(I.storeObject,l),I.mergeTree=Wa(I.mergeTree,s),p.forEach(function(w){return I.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:l,mergeTree:ni(s)?void 0:s,fieldNodeSet:p}),b}return l},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?qn(e):e:X(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,n,Rc(i,s));return Cc(i,s),u}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=jr(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new rt(!1);return function u(l,f){var h=s.lookup(l,f.clientOnly,f.deferred);h.visited||(h.visited=!0,l.selections.forEach(function(p){if(!!ut(p,n.variables)){var d=f.clientOnly,v=f.deferred;if(!(d&&v)&&Ne(p.directives)&&p.directives.forEach(function(E){var I=E.name.value;if(I==="client"&&(d=!0),I==="defer"){var w=ft(E,n.variables);(!w||w.if!==!1)&&(v=!0)}}),xe(p)){var m=a.get(p);m&&(d=d&&m.clientOnly,v=v&&m.deferred),a.set(p,Ka(n,d,v))}else{var b=jt(p,n.fragmentMap);b&&o.fragmentMatches(b,i,r,n.variables)&&u(b.selectionSet,Ka(n,d,v))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!$(n)){var u=!X(n)&&($(r)||_t(r))?r:void 0,l=n;u&&!a&&(a=[$(u)?u.__ref:u]);var f,h=function(p,d){return X(p)?typeof d=="number"?p[d]:void 0:i.store.getFieldValue(p,String(d))};e.map.forEach(function(p,d){var v=h(u,d),m=h(l,d);if(m!==void 0){a&&a.push(d);var b=s.applyMerges(p,v,m,i,a);b!==m&&(f=f||new Map,f.set(d,b)),a&&_(a.pop()===d)}}),f&&(n=X(l)?l.slice(0):y({},l),f.forEach(function(p,d){n[d]=p}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Mc=[];function Rc(t,e){var r=t.map;return r.has(e)||r.set(e,Mc.pop()||{map:new Map}),r.get(e)}function Wa(t,e){if(t===e||!e||ni(e))return t;if(!t||ni(t))return e;var r=t.info&&e.info?y(y({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){var o=new Set(e.map.keys());t.map.forEach(function(s,u){a.map.set(u,Wa(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Wa(e.map.get(s),t.map.get(s)))})}return a}function ni(t){return!t||!(t.info||t.map.size)}function Cc(t,e){var r=t.map,n=r.get(e);n&&ni(n)&&(Mc.push(n),r.delete(e))}var Lc=new Set;function Ef(t,e,r,n){var i=function(h){var p=n.getFieldValue(h,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!$(a)&&!ne(a,o)&&!Object.keys(a).every(function(h){return n.getFieldValue(o,h)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),u=Be(r),l="".concat(s,".").concat(u);if(!Lc.has(l)){Lc.add(l);var f=[];!X(a)&&!X(o)&&[a,o].forEach(function(h){var p=n.getFieldValue(h,"__typename");typeof p=="string"&&!f.includes(p)&&f.push(p)}),__DEV__&&_.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
|
|
33
|
+
|
|
34
|
+
To address this problem (which is not a bug in Apollo Client), `).concat(f.length?"either ensure all objects of type "+f.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:
|
|
35
|
+
|
|
36
|
+
existing: `).concat(JSON.stringify(a).slice(0,1e3),`
|
|
37
|
+
incoming: `).concat(JSON.stringify(o).slice(0,1e3),`
|
|
38
|
+
|
|
39
|
+
For more information about these options, please refer to the documentation:
|
|
40
|
+
|
|
41
|
+
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
42
|
+
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
43
|
+
`))}}}}var ii=function(t){de(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=ti,n.txCount=0,n.config=pc(r),n.addTypename=!!n.config.addTypename,n.policies=new Ac({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new hr.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=this.storeReader;this.storeWriter=new Fc(this,this.storeReader=new bc({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Yn(this.config),canon:r?void 0:i&&i.canon})),this.maybeBroadcastWatch=Qt(function(a,o){return n.broadcastWatch(a,o)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(a){var o=a.optimistic?n.optimisticData:n.data;if(Bt(o)){var s=a.optimistic,u=a.rootId,l=a.variables;return o.makeCacheKey(a.query,a.callback,Re({optimistic:s,rootId:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(a){return a.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(y(y({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Jr)return null;throw a}},e.prototype.write=function(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(ce.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(y(y({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||_c(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&$a(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){Re.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if($(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&_.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(ce.call(r,"id"))return!1;r=y(y({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var n=this;return this.init(),Re.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),$a(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,u=r.onWatchUpdated,l,f=function(p){var d=n,v=d.data,m=d.optimisticData;++n.txCount,p&&(n.data=n.optimisticData=p);try{return l=i(n)}finally{--n.txCount,n.data=v,n.optimisticData=m}},h=new Set;return u&&!this.txCount&&this.broadcastWatches(y(y({},r),{onWatchUpdated:function(p){return h.add(p),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,f):o===!1?f(this.data):f(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),u&&h.size?(this.broadcastWatches(y(y({},r),{onWatchUpdated:function(p,d){var v=u.call(this,p,d);return v!==!1&&h.delete(p),v}})),h.size&&h.forEach(function(p){return n.maybeBroadcastWatch.dirty(p)})):this.broadcastWatches(r),l},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=Vt(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!ne(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Aa);function jc(t){return t.hasOwnProperty("graphQLErrors")}var Of=function(t){var e="";if(Ne(t.graphQLErrors)||Ne(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
|
|
44
|
+
`)})}return t.networkError&&(e+="".concat(t.networkError.message,`
|
|
45
|
+
`)),e=e.replace(/\n$/,""),e},dt=function(t){de(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,u=t.call(this,o)||this;return u.graphQLErrors=n||[],u.clientErrors=i||[],u.networkError=a||null,u.message=o||Of(u),u.extraInfo=s,u.__proto__=e.prototype,u}return e}(Error);var K;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(K||(K={}));function Ot(t){return t?t<7:!1}var xf=Object.assign,Tf=Object.hasOwnProperty,ai=function(t){de(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(b){try{var E=b._subscription._observer;E&&!E.error&&(E.error=kf)}catch{}var I=!o.observers.size;o.observers.add(b);var w=o.last;return w&&w.error?b.error&&b.error(w.error):w&&w.result&&b.next&&b.next(w.result),I&&o.reobserve().catch(function(){}),function(){o.observers.delete(b)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,u=s===void 0?{}:s,l=u.fetchPolicy,f=l===void 0?"cache-first":l,h=a.fetchPolicy,p=h===void 0?f:h,d=a.initialFetchPolicy,v=d===void 0?p==="standby"?f:p:d;o.options=y(y({},a),{initialFetchPolicy:v,fetchPolicy:p}),o.queryId=i.queryId||n.generateQueryId();var m=et(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var r=this;return new Promise(function(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||K.ready,a=y(y({},n),{loading:Ot(i),networkStatus:i}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(a.data=u.result),ne(a.data,{})&&(a.data=void 0),u.complete?(delete a.partial,u.complete&&a.networkStatus===K.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=K.ready,a.loading=!1)):a.partial=!0,__DEV__&&!u.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Ja(u.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r){return!this.last||!ne(this.last.result,r)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||ne(i.variables,this.variables)))return i[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&r&&Tf.call(r,"variables")){var o=$r(this.query),s=o.variableDefinitions;(!s||!s.some(function(u){return u.variable.name.value==="variables"}))&&__DEV__&&_.warn("Called refetch(".concat(JSON.stringify(r),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.value)||JSON.stringify(o),`, which does not declare a $variables variable.
|
|
46
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return r&&!ne(this.options.variables,r)&&(i.variables=this.options.variables=y(y({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,K.refetch)},e.prototype.fetchMore=function(r){var n=this,i=y(y({},r.query?r:y(y(y(y({},this.options),{query:this.query}),r),{variables:y(y({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=K.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,i,K.fetchMore).then(function(l){return n.queryManager.removeQuery(a),o.networkStatus===K.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(f){var h=r.updateQuery;h?f.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(p){return h(p,{fetchMoreResult:l.data,variables:i.variables})}):f.writeQuery({query:i.query,variables:i.variables,data:l.data})},onWatchUpdated:function(f){u.add(f.query)}}),l}).finally(function(){u.has(n.query)||za(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.updateQuery(function(s,u){var l=u.variables;return o(s,{subscriptionData:a,variables:l})})},error:function(a){if(r.onError){r.onError(a);return}__DEV__&&_.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return ne(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},K.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?_(a,"Attempted to start a polling query without a polling interval."):_(a,10);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Ot(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:"network-only"},K.poll).then(u,u))},u=function(){var l=r.pollingInfo;l&&(clearTimeout(l.timeout),l.timeout=setTimeout(s,l.interval))};u()}}},e.prototype.updateLastResult=function(r,n){return n===void 0&&(n=this.variables),this.last=y(y({},this.last),{result:this.queryManager.assumeImmutableResults?r:qn(r),variables:n}),Ne(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===K.refetch||n===K.fetchMore||n===K.poll,o=this.options.variables,s=this.options.fetchPolicy,u=St(this.options,r||{}),l=a?u:xf(this.options,u);a||(this.updatePolling(),r&&r.variables&&!ne(r.variables,o)&&l.fetchPolicy!=="standby"&&l.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",l),n===void 0&&(n=K.setVariables)));var f=l.variables&&y({},l.variables),h=this.fetch(l,n),p={next:function(d){i.reportResult(d,f)},error:function(d){i.reportError(d,f)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=h,this.observer=p),h.addObserver(p),h.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(r,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),Ut(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=y(y({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:K.error,loading:!1});this.updateLastResult(i,n),Ut(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(q);Vn(ai);function za(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):r}}):t.reobserve()}function kf(t){__DEV__&&_.error("Unhandled error",t.message,t.stack)}function Ja(t){__DEV__&&t&&__DEV__&&_.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var oi=function(){function t(e){var r=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=la(r.resolvers,n)}):this.resolvers=la(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return st(this,void 0,void 0,function(){return ct(this,function(u){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(l){return y(y({},n),{data:l.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return Lr(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return ua(e)},t.prototype.prepareContext=function(e){var r=this.cache;return y(y({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),st(this,void 0,void 0,function(){return ct(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return y(y({},r),a.exportedVariables)})]:[2,y({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return be(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return Cr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:ca(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),st(this,void 0,void 0,function(){var s,u,l,f,h,p,d,v,m;return ct(this,function(b){return s=qt(e),u=pt(e),l=lt(u),f=s.operation,h=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,d=p.cache,v=p.client,m={fragmentMap:l,context:y(y({},n),{cache:d,client:v}),variables:i,fragmentMatcher:a,defaultOperationType:h,exportedVariables:{},onlyRunForcedResolvers:o},[2,this.resolveSelectionSet(s.selectionSet,r,m).then(function(E){return{result:E,exportedVariables:m.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n){return st(this,void 0,void 0,function(){var i,a,o,s,u,l=this;return ct(this,function(f){return i=n.fragmentMap,a=n.context,o=n.variables,s=[r],u=function(h){return st(l,void 0,void 0,function(){var p,d;return ct(this,function(v){return ut(h,o)?xe(h)?[2,this.resolveField(h,r,n).then(function(m){var b;typeof m<"u"&&s.push((b={},b[Me(h)]=m,b))})]:(qr(h)?p=h:(p=i[h.name.value],__DEV__?_(p,"No fragment named ".concat(h.name.value)):_(p,9)),p&&p.typeCondition&&(d=p.typeCondition.name.value,n.fragmentMatcher(r,d,a))?[2,this.resolveSelectionSet(p.selectionSet,r,n).then(function(m){s.push(m)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Vr(s)})]})})},t.prototype.resolveField=function(e,r,n){return st(this,void 0,void 0,function(){var i,a,o,s,u,l,f,h,p,d=this;return ct(this,function(v){return i=n.variables,a=e.name.value,o=Me(e),s=a!==o,u=r[o]||r[a],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(f=r.__typename||n.defaultOperationType,h=this.resolvers&&this.resolvers[f],h&&(p=h[s?a:o],p&&(l=Promise.resolve(mr.withValue(this.cache,p,[r,ft(e,i),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(m){if(m===void 0&&(m=u),e.directives&&e.directives.forEach(function(b){b.name.value==="export"&&b.arguments&&b.arguments.forEach(function(E){E.name.value==="as"&&E.value.kind==="StringValue"&&(n.exportedVariables[E.value.value]=m)})}),!e.selectionSet||m==null)return m;if(Array.isArray(m))return d.resolveSubSelectedArray(e,m,n);if(e.selectionSet)return d.resolveSelectionSet(e.selectionSet,m,n)})]})})},t.prototype.resolveSubSelectedArray=function(e,r,n){var i=this;return Promise.all(r.map(function(a){if(a===null)return null;if(Array.isArray(a))return i.resolveSubSelectedArray(e,a,n);if(e.selectionSet)return i.resolveSelectionSet(e.selectionSet,a,n)}))},t}();var vr=new(je?WeakMap:Map);function Ha(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return vr.set(t,(vr.get(t)+1)%1e15),r.apply(this,arguments)})}function qc(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var si=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;vr.has(n)||(vr.set(n,0),Ha(n,"evict"),Ha(n,"modify"),Ha(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||K.loading;return this.variables&&this.networkStatus!==K.loading&&!ne(this.variables,e.variables)&&(r=K.setVariables),ne(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){qc(this),this.lastDiff=void 0,this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&ne(r,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(r);return this.updateLastDiff(i,r),i},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!ne(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=r.getDiff();n.fromOptimisticTransaction?e.observe():za(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;qc(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Ot(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=y(y({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!ne(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===vr.get(this.cache)&&ne(r,n.variables)&&ne(e.data,n.result.data))},t.prototype.markResult=function(e,r,n){var i=this;this.graphQLErrors=Ne(e.errors)?e.errors:[],this.reset(),r.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(r.variables)):n!==0&&(ci(e,r.errorPolicy)?this.cache.performTransaction(function(a){if(i.shouldWrite(e,r.variables))a.writeQuery({query:i.document,data:e.data,variables:r.variables,overwrite:n===1}),i.lastWrite={result:e,variables:r.variables,dmCount:vr.get(i.cache)};else if(i.lastDiff&&i.lastDiff.diff.complete){e.data=i.lastDiff.diff.result;return}var o=i.getDiffOptions(r.variables),s=a.diff(o);i.stopped||i.updateWatch(r.variables),i.updateLastDiff(s,o),s.complete&&(e.data=s.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=K.ready},t.prototype.markError=function(e){return this.networkStatus=K.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function ci(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!fr(t);return!n&&r&&t.data&&(n=!0),n}var Df=Object.prototype.hasOwnProperty,$c=function(){function t(e){var r=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,u=e.ssrMode,l=u===void 0?!1:u,f=e.clientAwareness,h=f===void 0?{}:f,p=e.localState,d=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(je?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=h,this.localState=p||new oi({cache:r}),this.ssrMode=l,this.assumeImmutableResults=!!d,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new F("QueryManager stopped while query was in flight"):new F(11))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,l=u===void 0?[]:u,f=e.awaitRefetchQueries,h=f===void 0?!1:f,p=e.update,d=e.onQueryUpdated,v=e.fetchPolicy,m=v===void 0?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":v,b=e.errorPolicy,E=b===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":b,I=e.keepRootFields,w=e.context;return st(this,void 0,void 0,function(){var T,A,P;return ct(this,function(N){switch(N.label){case 0:return __DEV__?_(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):_(i,12),__DEV__?_(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."):_(m==="network-only"||m==="no-cache",13),T=this.generateMutationId(),i=this.transform(i).document,a=this.getVariables(i,a),this.transform(i).hasClientExports?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=N.sent(),N.label=2;case 2:return A=this.mutationStore&&(this.mutationStore[T]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:T,document:i,variables:a,fetchPolicy:m,errorPolicy:E,context:w,updateQueries:s,update:p,keepRootFields:I}),this.broadcastQueries(),P=this,[2,new Promise(function(L,pe){return $n(P.getObservableFromLink(i,y(y({},w),{optimisticResponse:o}),a,!1),function(B){if(fr(B)&&E==="none")throw new dt({graphQLErrors:B.errors});A&&(A.loading=!1,A.error=null);var Fe=y({},B);return typeof l=="function"&&(l=l(Fe)),E==="ignore"&&fr(Fe)&&delete Fe.errors,P.markMutationResult({mutationId:T,result:Fe,document:i,variables:a,fetchPolicy:m,errorPolicy:E,context:w,update:p,updateQueries:s,awaitRefetchQueries:h,refetchQueries:l,removeOptimistic:o?T:void 0,onQueryUpdated:d,keepRootFields:I})}).subscribe({next:function(B){P.broadcastQueries(),L(B)},error:function(B){A&&(A.loading=!1,A.error=B),o&&P.cache.removeOptimistic(T),P.broadcastQueries(),pe(B instanceof dt?B:new dt({networkError:B}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&ci(i,e.errorPolicy)){a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables});var s=e.updateQueries;s&&this.queries.forEach(function(l,f){var h=l.observableQuery,p=h&&h.queryName;if(!(!p||!Df.call(s,p))){var d=s[p],v=n.queries.get(f),m=v.document,b=v.variables,E=r.diff({query:m,variables:b,returnPartialData:!0,optimistic:!1}),I=E.result,w=E.complete;if(w&&I){var T=d(I,{mutationResult:i,queryName:m&&sr(m)||void 0,queryVariables:b});T&&a.push({result:T,dataId:"ROOT_QUERY",query:m,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(l){o||a.forEach(function(p){return l.write(p)});var f=e.update;if(f){if(!o){var h=l.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=y(y({},i),{data:h.result}))}f(l,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&l.modify({id:"ROOT_MUTATION",fields:function(p,d){var v=d.fieldName,m=d.DELETE;return v==="__typename"?p:m}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(l){return u.push(l)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then(function(){return i})}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(y(y({},r),{result:{data:i}}),a)}catch(o){__DEV__&&_.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=sa(this.cache.transformForLink(n)),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Zi(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:$t(et(n)),asQuery:y(y({},n),{definitions:n.definitions.map(function(l){return l.kind==="OperationDefinition"&&l.operation!=="query"?y(y({},l),{operation:"query"}):l})})},u=function(l){l&&!r.has(l)&&r.set(l,s)};u(e),u(n),u(a),u(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return y(y({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=y(y({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new si(this),n=new ai({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=this;return r===void 0&&(r=this.generateQueryId()),__DEV__?_(e.query,"query option is required. You must specify your GraphQL document in the query option."):_(e.query,14),__DEV__?_(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):_(e.query.kind==="Document",15),__DEV__?_(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):_(!e.returnPartialData,16),__DEV__?_(!e.pollInterval,"pollInterval option only supported on watchQuery."):_(!e.pollInterval,17),this.fetchQuery(r,e).finally(function(){return n.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new F("Store reset while query was in flight (not completed in link chain)"):new F(18)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=K.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):ta(o)?i.set(r.transform(o).document,!1):Q(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var u=o.observableQuery,l=o.document;if(u){if(e==="all"){n.set(s,u);return}var f=u.queryName,h=u.options.fetchPolicy;if(h==="standby"||e==="active"&&!u.hasObservers())return;(e==="active"||f&&i.has(f)||l&&i.has(l))&&(n.set(s,u),f&&i.set(f,!0),l&&i.set(l,!0))}}),a.size&&a.forEach(function(o){var s=Br("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),l=new ai({queryManager:r,queryInfo:u,options:y(y({},o),{fetchPolicy:"network-only"})});_(l.queryId===s),u.setObservableQuery(l),n.set(s,l)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&_.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,u=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var l=function(h){return r.getObservableFromLink(n,u,h).map(function(p){if(i!=="no-cache"&&(ci(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:h}),r.broadcastQueries()),fr(p))throw new dt({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var f=this.localState.addExportedVariables(n,o,u).then(l);return new q(function(h){var p=null;return f.then(function(d){return p=d.subscribe(h)},h.error),function(){return p&&p.unsubscribe()}})}return l(o)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,n,i){var a=this,o;i===void 0&&(i=(o=r?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,u=this.transform(e).serverQuery;if(u){var l=this,f=l.inFlightLinkObservables,h=l.link,p={query:u,variables:n,operationName:sr(u)||void 0,context:this.prepareContext(y(y({},r),{forceFetch:!i}))};if(r=p.context,i){var d=f.get(u)||new Map;f.set(u,d);var v=Re(n);if(s=d.get(v),!s){var m=new lr([pr(h,p)]);d.set(v,s=m),m.cleanup(function(){d.delete(v)&&d.size<1&&f.delete(u)})}}else s=new lr([pr(h,p)])}else s=new lr([q.of({data:{}})]),r=this.prepareContext(r);var b=this.transform(e).clientQuery;return b&&(s=$n(s,function(E){return a.localState.runResolvers({document:b,remoteResult:E,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId();return $n(this.getObservableFromLink(e.document,n.context,n.variables),function(a){var o=Ne(a.errors);if(i>=e.lastRequestId){if(o&&n.errorPolicy==="none")throw e.markError(new dt({graphQLErrors:a.errors}));e.markResult(a,n,r),e.markReady()}var s={data:a.data,loading:!1,networkStatus:K.ready};return o&&n.errorPolicy!=="ignore"&&(s.errors=a.errors,s.networkStatus=K.error),s},function(a){var o=jc(a)?a:new dt({networkError:a});throw i>=e.lastRequestId&&e.markError(o),o})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=K.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),u=this.defaultOptions.watchQuery,l=r.fetchPolicy,f=l===void 0?u&&u.fetchPolicy||"cache-first":l,h=r.errorPolicy,p=h===void 0?u&&u.errorPolicy||"none":h,d=r.returnPartialData,v=d===void 0?!1:d,m=r.notifyOnNetworkStatusChange,b=m===void 0?!1:m,E=r.context,I=E===void 0?{}:E,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:f,errorPolicy:p,returnPartialData:v,notifyOnNetworkStatusChange:b,context:I}),T=function(N){w.variables=N;var L=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&L.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),L},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(N){A(),setTimeout(function(){return P.cancel(N)})});var P=new lr(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(T):T(w.variables));return P.promise.then(A,A),P},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,u=s===void 0?o?Br("refetchQueries"):void 0:s,l=e.onQueryUpdated,f=new Map;i&&this.getObservableQueries(i).forEach(function(p,d){f.set(d,{oq:p,lastDiff:r.getQuery(d).getDiff()})});var h=new Map;return n&&this.cache.batch({update:n,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(p,d,v){var m=p.watcher instanceof si&&p.watcher.observableQuery;if(m){if(l){f.delete(m.queryId);var b=l(m,d,v);return b===!0&&(b=m.refetch()),b!==!1&&h.set(m,b),b}l!==null&&f.set(m.queryId,{oq:m,lastDiff:v,diff:d})}}}),f.size&&f.forEach(function(p,d){var v=p.oq,m=p.lastDiff,b=p.diff,E;if(l){if(!b){var I=v.queryInfo;I.reset(),b=I.getDiff()}E=l(v,b,m)}(!l||E===!0)&&(E=v.refetch()),E!==!1&&h.set(v,E),d.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(d)}),u&&this.cache.removeOptimistic(u),h},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,a=r.query,o=r.variables,s=r.fetchPolicy,u=r.refetchWritePolicy,l=r.errorPolicy,f=r.returnPartialData,h=r.context,p=r.notifyOnNetworkStatusChange,d=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var v=function(){return e.getDiff(o)},m=function(T,A){A===void 0&&(A=e.networkStatus||K.loading);var P=T.result;__DEV__&&!f&&!ne(P,{})&&Ja(T.missing);var N=function(L){return q.of(y({data:L,loading:Ot(A),networkStatus:A},T.complete?null:{partial:!0}))};return P&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:P},context:h,variables:o,onlyRunForcedResolvers:!0}).then(function(L){return N(L.data||void 0)}):N(P)},b=s==="no-cache"?0:n===K.refetch&&u!=="merge"?1:2,E=function(){return i.getResultsFromLink(e,b,{variables:o,context:h,fetchPolicy:s,errorPolicy:l})},I=p&&typeof d=="number"&&d!==n&&Ot(n);switch(s){default:case"cache-first":{var w=v();return w.complete?[m(w,e.markReady())]:f||I?[m(w),E()]:[E()]}case"cache-and-network":{var w=v();return w.complete||f||I?[m(w),E()]:[E()]}case"cache-only":return[m(v(),e.markReady())];case"network-only":return I?[m(v()),E()]:[E()];case"no-cache":return I?[m(e.getDiff()),E()]:[E()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new si(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return y(y({},r),{clientAwareness:this.clientAwareness})},t}();var Vc=!1;var Ya=function(){function t(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,u=s===void 0?!1:s,l=e.ssrForceFetchDelay,f=l===void 0?0:l,h=e.connectToDevTools,p=h===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:h,d=e.queryDeduplication,v=d===void 0?!0:d,m=e.defaultOptions,b=e.assumeImmutableResults,E=b===void 0?!1:b,I=e.resolvers,w=e.typeDefs,T=e.fragmentMatcher,A=e.name,P=e.version,N=e.link;if(N||(N=n?new Ea({uri:n,credentials:i,headers:a}):qe.empty()),!o)throw __DEV__?new F(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
47
|
+
For more information, please visit: https://go.apollo.dev/c/docs`):new F(7);if(this.link=N,this.cache=o,this.disableNetworkFetches=u||f>0,this.queryDeduplication=v,this.defaultOptions=m||Object.create(null),this.typeDefs=w,f&&setTimeout(function(){return r.disableNetworkFetches=!1},f),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!Vc&&__DEV__&&(Vc=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var L=window.navigator,pe=L&&L.userAgent,B=void 0;typeof pe=="string"&&(pe.indexOf("Chrome/")>-1?B="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":pe.indexOf("Firefox/")>-1&&(B="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),B&&__DEV__&&_.log("Download the Apollo DevTools for a better development experience: "+B)}this.version=Cs,this.localState=new oi({cache:o,client:this,resolvers:I,fragmentMatcher:T}),this.queryManager=new $c({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:v,ssrMode:u,clientAwareness:{name:A,version:P},localState:this.localState,assumeImmutableResults:E,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Gr(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=y(y({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=Gr(this.defaultOptions.query,e)),__DEV__?_(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."):_(e.fetchPolicy!=="cache-and-network",8),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=y(y({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Gr(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){this.cache.writeQuery(e),this.queryManager.broadcastQueries()},t.prototype.writeFragment=function(e){this.cache.writeFragment(e),this.queryManager.broadcastQueries()},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return pr(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&_.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();rs(Mt?"log":"silent");function Te(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function ht(t){return Te(t)==="object"}function Uc(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Xa(t,e){return t.length<124?t:e}var Qc="graphql-transport-ws";var De;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(De||(De={}));var ue;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(ue||(ue={}));function Bc(t){if(!ht(t))throw new Error(`Message is expected to be an object, but got ${Te(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${Te(t.type)}`);switch(t.type){case ue.ConnectionInit:case ue.ConnectionAck:case ue.Ping:case ue.Pong:{if("payload"in t&&!ht(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or missing, but got "${t.payload}"`);break}case ue.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Te(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ht(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Te(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${Te(t.payload.query)}`);if(t.payload.variables!=null&&!ht(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${Te(t.payload.variables)}`);if(t.payload.operationName!=null&&Te(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${Te(t.payload.operationName)}`);if(t.payload.extensions!=null&&!ht(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${Te(t.payload.extensions)}`);break}case ue.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Te(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ht(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${Te(t.payload)}`);break}case ue.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Te(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Uc(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case ue.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${Te(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function Gc(t,e){return Bc(typeof t=="string"?JSON.parse(t,e):t)}function gr(t,e){return Bc(t),JSON.stringify(t,e)}function Kc(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:u=0,retryAttempts:l=5,retryWait:f=async function(fe){let J=1e3;for(let C=0;C<fe;C++)J*=2;await new Promise(C=>setTimeout(C,J+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:h=ui,isFatalConnectionProblem:p,on:d,webSocketImpl:v,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,fe=>{let J=Math.random()*16|0;return(fe=="x"?J:J&3|8).toString(16)})},jsonMessageReplacer:b,jsonMessageReviver:E}=t,I;if(v){if(!Pf(v))throw new Error("Invalid WebSocket implementation provided");I=v}else typeof WebSocket<"u"?I=WebSocket:typeof global<"u"?I=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(I=window.WebSocket||window.MozWebSocket);if(!I)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=I,T=(()=>{let j=(()=>{let J={};return{on(C,re){return J[C]=re,()=>{delete J[C]}},emit(C){var re;"id"in C&&((re=J[C.id])===null||re===void 0||re.call(J,C))}}})(),fe={connecting:d?.connecting?[d.connecting]:[],opened:d?.opened?[d.opened]:[],connected:d?.connected?[d.connected]:[],ping:d?.ping?[d.ping]:[],pong:d?.pong?[d.pong]:[],message:d?.message?[j.emit,d.message]:[j.emit],closed:d?.closed?[d.closed]:[],error:d?.error?[d.error]:[]};return{onMessage:j.on,on(J,C){let re=fe[J];return re.push(C),()=>{re.splice(re.indexOf(C),1)}},emit(J,...C){for(let re of[...fe[J]])re(...C)}}})();function A(j){let fe=[T.on("error",J=>{fe.forEach(C=>C()),j(J)}),T.on("closed",J=>{fe.forEach(C=>C()),j(J)})]}let P,N=0,L,pe=!1,B=0,Fe=!1;async function Ft(){clearTimeout(L);let[j,fe]=await(P??(P=new Promise((re,oe)=>(async()=>{if(pe){if(await f(B),!N)return P=void 0,oe({code:1e3,reason:"All Subscriptions Gone"});B++}T.emit("connecting");let H=new w(typeof e=="function"?await e():e,Qc),rr,Pr;function xn(){isFinite(o)&&o>0&&(clearTimeout(Pr),Pr=setTimeout(()=>{H.readyState===w.OPEN&&(H.send(gr({type:ue.Ping})),T.emit("ping",!1,void 0))},o))}A(ve=>{P=void 0,clearTimeout(rr),clearTimeout(Pr),oe(ve),ui(ve)&&ve.code===4499&&(H.close(4499,"Terminated"),H.onerror=null,H.onclose=null)}),H.onerror=ve=>T.emit("error",ve),H.onclose=ve=>T.emit("closed",ve),H.onopen=async()=>{try{T.emit("opened",H);let ve=typeof r=="function"?await r():r;if(H.readyState!==w.OPEN)return;H.send(gr(ve?{type:ue.ConnectionInit,payload:ve}:{type:ue.ConnectionInit},b)),isFinite(u)&&u>0&&(rr=setTimeout(()=>{H.close(De.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),xn()}catch(ve){T.emit("error",ve),H.close(De.InternalClientError,Xa(ve instanceof Error?ve.message:new Error(ve).message,"Internal client error"))}};let nr=!1;H.onmessage=({data:ve})=>{try{let ge=Gc(ve,E);if(T.emit("message",ge),ge.type==="ping"||ge.type==="pong"){T.emit(ge.type,!0,ge.payload),ge.type==="pong"?xn():s||(H.send(gr(ge.payload?{type:ue.Pong,payload:ge.payload}:{type:ue.Pong})),T.emit("pong",!1,ge.payload));return}if(nr)return;if(ge.type!==ue.ConnectionAck)throw new Error(`First message cannot be of type ${ge.type}`);clearTimeout(rr),nr=!0,T.emit("connected",H,ge.payload),pe=!1,B=0,re([H,new Promise(($p,Mu)=>A(Mu))])}catch(ge){H.onmessage=null,T.emit("error",ge),H.close(De.BadResponse,Xa(ge instanceof Error?ge.message:new Error(ge).message,"Bad response"))}}})())));j.readyState===w.CLOSING&&await fe;let J=()=>{},C=new Promise(re=>J=re);return[j,J,Promise.race([C.then(()=>{if(!N){let re=()=>j.close(1e3,"Normal Closure");isFinite(a)&&a>0?L=setTimeout(()=>{j.readyState===w.OPEN&&re()},a):re()}}),fe])]}function On(j){if(ui(j)&&(If(j.code)||[De.InternalServerError,De.InternalClientError,De.BadRequest,De.BadResponse,De.Unauthorized,De.SubprotocolNotAcceptable,De.SubscriberAlreadyExists,De.TooManyInitialisationRequests].includes(j.code)))throw j;if(Fe)return!1;if(ui(j)&&j.code===1e3)return N>0;if(!l||B>=l||!h(j)||p?.(j))throw j;return pe=!0}return n||(async()=>{for(N++;;)try{let[,,j]=await Ft();await j}catch(j){try{if(!On(j))return}catch(fe){return i?.(fe)}}})(),{on:T.on,subscribe(j,fe){let J=m(j),C=!1,re=!1,oe=()=>{N--,C=!0};return(async()=>{for(N++;;)try{let[H,rr,Pr]=await Ft();if(C)return rr();let xn=T.onMessage(J,nr=>{switch(nr.type){case ue.Next:{fe.next(nr.payload);return}case ue.Error:{re=!0,C=!0,fe.error(nr.payload),oe();return}case ue.Complete:{C=!0,oe();return}}});H.send(gr({id:J,type:ue.Subscribe,payload:j},b)),oe=()=>{!C&&H.readyState===w.OPEN&&H.send(gr({id:J,type:ue.Complete},b)),N--,C=!0,rr()},await Pr.finally(xn);return}catch(H){if(!On(H))return}})().then(()=>{re||fe.complete()}).catch(H=>{fe.error(H)}),()=>{C||oe()}},async dispose(){if(Fe=!0,P){let[j]=await P;j.close(1e3,"Normal Closure")}},terminate(){P&&T.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function ui(t){return ht(t)&&"code"in t&&"reason"in t}function If(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function Pf(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function Af(t){return Q(t)&&"code"in t&&"reason"in t}var Wc=function(t){de(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new q(function(i){return n.client.subscribe(y(y({},r),{query:ar(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Af(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new dt({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(qe);var Ti=function(){return Ti=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Ti.apply(this,arguments)};function mi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mi=function(r){return typeof r}:mi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mi(t)}function Nf(t){return mi(t)=="object"&&t!==null}var Su=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function so(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Rf(t){return wu(t.source,so(t.source,t.start))}function wu(t,e){var r=t.locationOffset.column-1,n=yi(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,u=e.column+s,l="".concat(t.name,":").concat(o,":").concat(u,`
|
|
48
|
+
`),f=n.split(/\r\n|[\n\r]/g),h=f[i];if(h.length>120){for(var p=Math.floor(u/80),d=u%80,v=[],m=0;m<h.length;m+=80)v.push(h.slice(m,m+80));return l+zc([["".concat(o),v[0]]].concat(v.slice(1,p+1).map(function(b){return["",b]}),[[" ",yi(d-1)+"^"],["",v[p+1]]]))}return l+zc([["".concat(o-1),f[i-1]],["".concat(o),h],["",yi(u-1)+"^"],["".concat(o+1),f[i+1]]])}function zc(t){var e=t.filter(function(n){n[0];var i=n[1];return i!==void 0}),r=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return Cf(r,i)+(a?" | "+a:" |")}).join(`
|
|
49
|
+
`)}function yi(t){return Array(t+1).join(" ")}function Cf(t,e){return yi(t-e.length)+e}function vi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?vi=function(r){return typeof r}:vi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vi(t)}function Jc(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function Lf(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Jc(Object(r),!0).forEach(function(n){Ff(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Jc(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ff(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mf(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function jf(t,e,r){return e&&Hc(t.prototype,e),r&&Hc(t,r),t}function qf(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&hn(t,e)}function $f(t){var e=Eu();return function(){var n=mn(t),i;if(e){var a=mn(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return _u(this,i)}}function _u(t,e){return e&&(vi(e)==="object"||typeof e=="function")?e:en(t)}function en(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function co(t){var e=typeof Map=="function"?new Map:void 0;return co=function(n){if(n===null||!Vf(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return gi(n,arguments,mn(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hn(i,n)},co(t)}function gi(t,e,r){return Eu()?gi=Reflect.construct:gi=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),l=new u;return o&&hn(l,o.prototype),l},gi.apply(null,arguments)}function Eu(){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 Vf(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function hn(t,e){return hn=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},hn(t,e)}function mn(t){return mn=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},mn(t)}var Uf=function(t){qf(r,t);var e=$f(r);function r(n,i,a,o,s,u,l){var f,h,p,d;Mf(this,r),d=e.call(this,n),d.name="GraphQLError",d.originalError=u??void 0,d.nodes=Yc(Array.isArray(i)?i:i?[i]:void 0);for(var v=[],m=0,b=(E=d.nodes)!==null&&E!==void 0?E:[];m<b.length;m++){var E,I=b[m],w=I.loc;w!=null&&v.push(w)}v=Yc(v),d.source=a??((f=v)===null||f===void 0?void 0:f[0].source),d.positions=o??((h=v)===null||h===void 0?void 0:h.map(function(A){return A.start})),d.locations=o&&a?o.map(function(A){return so(a,A)}):(p=v)===null||p===void 0?void 0:p.map(function(A){return so(A.source,A.start)}),d.path=s??void 0;var T=u?.extensions;return l==null&&Nf(T)?d.extensions=Lf({},T):d.extensions=l??{},Object.defineProperties(en(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?(Object.defineProperty(en(d),"stack",{value:u.stack,writable:!0,configurable:!0}),_u(d)):(Error.captureStackTrace?Error.captureStackTrace(en(d),r):Object.defineProperty(en(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return jf(r,[{key:"toString",value:function(){return Qf(this)}},{key:Su,get:function(){return"Object"}}]),r}(co(Error));function Yc(t){return t===void 0||t.length===0?void 0:t}function Qf(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
|
|
50
|
+
|
|
51
|
+
`+Rf(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
|
|
52
|
+
|
|
53
|
+
`+wu(t.source,s)}return e}function Le(t,e,r){return new Uf("Syntax Error: ".concat(r),void 0,t,[e])}var R=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 Bf(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Gf=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,uo=Gf;function Ou(t){var e=t.prototype.toJSON;typeof e=="function"||Bf(0),t.prototype.inspect=e,uo&&(t.prototype[uo]=e)}var xu=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Ou(xu);var le=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=u,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Ou(le);var g=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 bi(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bi=function(r){return typeof r}:bi=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bi(t)}var Kf=10,Tu=2;function Wf(t){return $i(t,[])}function $i(t,e){switch(bi(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":zf(t,e);default:return String(t)}}function zf(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Yf(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:$i(i,r)}else if(Array.isArray(t))return Hf(t,r);return Jf(t,r)}function Jf(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Tu)return"["+Xf(t)+"]";var n=r.map(function(i){var a=$i(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Hf(t,e){if(t.length===0)return"[]";if(e.length>Tu)return"[Array]";for(var r=Math.min(Kf,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push($i(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Yf(t){var e=t[String(uo)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Xf(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function Za(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function eo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?eo=function(r){return typeof r}:eo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},eo(t)}var Zf=function(e,r){return e instanceof r};function Xc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function ep(t,e,r){return e&&Xc(t.prototype,e),r&&Xc(t,r),t}var ku=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Za(0,"Body must be a string. Received: ".concat(Wf(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Za(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Za(0,"column in locationOffset is 1-indexed and must be positive.")}return ep(t,[{key:Su,get:function(){return"Source"}}]),t}();function tp(t){return Zf(t,ku)}var rp=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 np(t){var e=t.split(/\r\n|[\n\r]/g),r=ip(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Zc(e[i]);)++i;for(var a=e.length;a>i&&Zc(e[a-1]);)--a;return e.slice(i,a).join(`
|
|
54
|
+
`)}function Zc(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function ip(t){for(var e,r=!0,n=!0,i=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var ap=function(){function t(r){var n=new le(g.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==g.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=sp(this,n)}while(n.kind===g.COMMENT);return n},t}();function op(t){return t===g.BANG||t===g.DOLLAR||t===g.AMP||t===g.PAREN_L||t===g.PAREN_R||t===g.SPREAD||t===g.COLON||t===g.EQUALS||t===g.AT||t===g.BRACKET_L||t===g.BRACKET_R||t===g.BRACE_L||t===g.PIPE||t===g.BRACE_R}function Ht(t){return isNaN(t)?g.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function sp(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=t.line,u=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new le(g.BANG,a,a+1,s,u,e);case 35:return up(r,a,s,u,e);case 36:return new le(g.DOLLAR,a,a+1,s,u,e);case 38:return new le(g.AMP,a,a+1,s,u,e);case 40:return new le(g.PAREN_L,a,a+1,s,u,e);case 41:return new le(g.PAREN_R,a,a+1,s,u,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new le(g.SPREAD,a,a+3,s,u,e);break;case 58:return new le(g.COLON,a,a+1,s,u,e);case 61:return new le(g.EQUALS,a,a+1,s,u,e);case 64:return new le(g.AT,a,a+1,s,u,e);case 91:return new le(g.BRACKET_L,a,a+1,s,u,e);case 93:return new le(g.BRACKET_R,a,a+1,s,u,e);case 123:return new le(g.BRACE_L,a,a+1,s,u,e);case 124:return new le(g.PIPE,a,a+1,s,u,e);case 125:return new le(g.BRACE_R,a,a+1,s,u,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?pp(r,a,s,u,e,t):fp(r,a,s,u,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return lp(r,a,o,s,u,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 hp(r,a,s,u,e)}throw Le(r,a,cp(o))}var l=t.line,f=1+a-t.lineStart;return new le(g.EOF,i,i,l,f,e)}function cp(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(Ht(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Ht(t),".")}function up(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new le(g.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function lp(t,e,r,n,i,a){var o=t.body,s=r,u=e,l=!1;if(s===45&&(s=o.charCodeAt(++u)),s===48){if(s=o.charCodeAt(++u),s>=48&&s<=57)throw Le(t,u,"Invalid number, unexpected digit after 0: ".concat(Ht(s),"."))}else u=to(t,u,s),s=o.charCodeAt(u);if(s===46&&(l=!0,s=o.charCodeAt(++u),u=to(t,u,s),s=o.charCodeAt(u)),(s===69||s===101)&&(l=!0,s=o.charCodeAt(++u),(s===43||s===45)&&(s=o.charCodeAt(++u)),u=to(t,u,s),s=o.charCodeAt(u)),s===46||mp(s))throw Le(t,u,"Invalid number, expected digit but got: ".concat(Ht(s),"."));return new le(l?g.FLOAT:g.INT,e,u,n,i,a,o.slice(e,u))}function to(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw Le(t,i,"Invalid number, expected digit but got: ".concat(Ht(a),"."))}function fp(t,e,r,n,i){for(var a=t.body,o=e+1,s=o,u=0,l="";o<a.length&&!isNaN(u=a.charCodeAt(o))&&u!==10&&u!==13;){if(u===34)return l+=a.slice(s,o),new le(g.STRING,e,o+1,r,n,i,l);if(u<32&&u!==9)throw Le(t,o,"Invalid character within String: ".concat(Ht(u),"."));if(++o,u===92){switch(l+=a.slice(s,o-1),u=a.charCodeAt(o),u){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+=`
|
|
55
|
+
`;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var f=dp(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(f<0){var h=a.slice(o+1,o+5);throw Le(t,o,"Invalid character escape sequence: \\u".concat(h,"."))}l+=String.fromCharCode(f),o+=4;break}default:throw Le(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw Le(t,o,"Unterminated string.")}function pp(t,e,r,n,i,a){for(var o=t.body,s=e+3,u=s,l=0,f="";s<o.length&&!isNaN(l=o.charCodeAt(s));){if(l===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return f+=o.slice(u,s),new le(g.BLOCK_STRING,e,s+3,r,n,i,np(f));if(l<32&&l!==9&&l!==10&&l!==13)throw Le(t,s,"Invalid character within String: ".concat(Ht(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?(f+=o.slice(u,s)+'"""',s+=4,u=s):++s}throw Le(t,s,"Unterminated string.")}function dp(t,e,r,n){return li(t)<<12|li(e)<<8|li(r)<<4|li(n)}function li(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function hp(t,e,r,n,i){for(var a=t.body,o=a.length,s=e+1,u=0;s!==o&&!isNaN(u=a.charCodeAt(s))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new le(g.NAME,e,s,r,n,i,a.slice(e,s))}function mp(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function yp(t,e){var r=new vp(t,e);return r.parseDocument()}var vp=function(){function t(r,n){var i=tp(r)?r:new ku(r);this._lexer=new ap(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(g.NAME);return{kind:R.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:R.DOCUMENT,definitions:this.many(g.SOF,this.parseDefinition,g.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(g.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(g.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(g.BRACE_L))return{kind:R.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(g.NAME)&&(a=this.parseName()),{kind:R.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(g.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(g.PAREN_L,this.parseVariableDefinition,g.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:R.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(g.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(g.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(g.DOLLAR),{kind:R.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:R.SELECTION_SET,selections:this.many(g.BRACE_L,this.parseSelection,g.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(g.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(g.COLON)?(a=i,o=this.parseName()):o=i,{kind:R.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(g.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(g.PAREN_L,i,g.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(g.COLON),{kind:R.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:R.ARGUMENT,name:this.parseName(),value:(this.expectToken(g.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(g.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(g.NAME)?{kind:R.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:R.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:R.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:R.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case g.BRACKET_L:return this.parseList(n);case g.BRACE_L:return this.parseObject(n);case g.INT:return this._lexer.advance(),{kind:R.INT,value:i.value,loc:this.loc(i)};case g.FLOAT:return this._lexer.advance(),{kind:R.FLOAT,value:i.value,loc:this.loc(i)};case g.STRING:case g.BLOCK_STRING:return this.parseStringLiteral();case g.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:R.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:R.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:R.NULL,loc:this.loc(i)};default:return{kind:R.ENUM,value:i.value,loc:this.loc(i)}}case g.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:R.STRING,value:n.value,block:n.kind===g.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:R.LIST,values:this.any(g.BRACKET_L,o,g.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:R.OBJECT,fields:this.any(g.BRACE_L,o,g.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(g.COLON),{kind:R.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(g.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(g.AT),{kind:R.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(g.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(g.BRACKET_R),i={kind:R.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(g.BANG)?{kind:R.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:R.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===g.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},e.peekDescription=function(){return this.peek(g.STRING)||this.peek(g.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(g.BRACE_L,this.parseOperationTypeDefinition,g.BRACE_R);return{kind:R.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(g.COLON);var a=this.parseNamedType();return{kind:R.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:R.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:R.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(g.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(g.AMP)||this.peek(g.NAME));return i}return this.delimitedMany(g.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(g.BRACE_L)&&this._lexer.lookahead().kind===g.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(g.BRACE_L,this.parseFieldDefinition,g.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(g.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:R.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(g.PAREN_L,this.parseInputValueDef,g.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(g.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(g.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:R.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:R.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:R.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(g.EQUALS)?this.delimitedMany(g.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:R.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(g.BRACE_L,this.parseEnumValueDefinition,g.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:R.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:R.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(g.BRACE_L,this.parseInputValueDef,g.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===g.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(g.BRACE_L,this.parseOperationTypeDefinition,g.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:R.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:R.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:R.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:R.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:R.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:R.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:R.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(g.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:R.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(g.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(rp[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new xu(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw Le(this._lexer.source,i.start,"Expected ".concat(Du(n),", found ").concat(ro(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===g.NAME&&i.value===n)this._lexer.advance();else throw Le(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(ro(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===g.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return Le(this._lexer.source,i.start,"Unexpected ".concat(ro(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},t}();function ro(t){var e=t.value;return Du(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Du(t){return op(t)?'"'.concat(t,'"'):t}var Si=new Map,lo=new Map,Iu=!0,ki=!1;function Pu(t){return t.replace(/[\s,]+/g," ").trim()}function gp(t){return Pu(t.source.body.substring(t.start,t.end))}function bp(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=gp(n.loc),o=lo.get(i);o&&!o.has(a)?Iu&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
56
|
+
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
57
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||lo.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),Ti(Ti({},t),{definitions:r})}function Sp(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function wp(t){var e=Pu(t);if(!Si.has(e)){var r=yp(t,{experimentalFragmentVariables:ki,allowLegacyFragmentVariables:ki});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Si.set(e,Sp(bp(r)))}return Si.get(e)}function O(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),wp(n)}function _p(){Si.clear(),lo.clear()}function Ep(){Iu=!1}function Op(){ki=!0}function xp(){ki=!1}var Yr={gql:O,resetCaches:_p,disableFragmentWarnings:Ep,enableExperimentalFragmentVariables:Op,disableExperimentalFragmentVariables:xp};(function(t){t.gql=Yr.gql,t.resetCaches=Yr.resetCaches,t.disableFragmentWarnings=Yr.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Yr.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Yr.disableExperimentalFragmentVariables})(O||(O={}));O.default=O;function k(t){if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function Tp(){}function go(){return Tp}var S=go,He=go,G=go,Au=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Nu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Yt=class{constructor(e){this.code=e}};Au([S(),Nu("design:type",String)],Yt.prototype,"code",void 0);Yt=Au([G(),Nu("design:paramtypes",[String])],Yt);var bo=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},So=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},at=class{constructor(e,r){this.address=e,this.name=r}};bo([S(),So("design:type",String)],at.prototype,"address",void 0);bo([S(),So("design:type",String)],at.prototype,"name",void 0);at=bo([G(),So("design:paramtypes",[String,String])],at);var ae=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},he=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Dt=class{constructor(e,r){this.key=r,this.signature=e}};ae([S(),he("design:type",String)],Dt.prototype,"signature",void 0);ae([S(),he("design:type",String)],Dt.prototype,"key",void 0);ae([S(),he("design:type",Boolean)],Dt.prototype,"valid",void 0);ae([S(),he("design:type",Boolean)],Dt.prototype,"invalid",void 0);Dt=ae([G(),He(),he("design:paramtypes",[String,String])],Dt);var Xt=class{};ae([S(),he("design:type",String)],Xt.prototype,"signature",void 0);ae([S(),he("design:type",String)],Xt.prototype,"key",void 0);ae([S(),he("design:type",Boolean)],Xt.prototype,"valid",void 0);ae([S(),he("design:type",Boolean)],Xt.prototype,"invalid",void 0);Xt=ae([He()],Xt);function Ct(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ae([S(),he("design:type",String)],e.prototype,"author",void 0),ae([S(),he("design:type",String)],e.prototype,"timestamp",void 0),ae([S(),he("design:type",Object)],e.prototype,"data",void 0),ae([S(),he("design:type",Dt)],e.prototype,"proof",void 0),e=ae([G(),he("design:paramtypes",[String,String,Object,Dt])],e),e}function kp(t){let e=class{};return ae([S(),he("design:type",String)],e.prototype,"author",void 0),ae([S(),he("design:type",String)],e.prototype,"timestamp",void 0),ae([S(),he("design:type",Object)],e.prototype,"data",void 0),ae([S(),he("design:type",Xt)],e.prototype,"proof",void 0),e=ae([He()],e),e}var eu=class extends Ct(){};eu=ae([G()],eu);var Di=class extends Ct(){};ae([S(),he("design:type",at)],Di.prototype,"language",void 0);ae([S(),he("design:type",Yt)],Di.prototype,"icon",void 0);Di=ae([G()],Di);function pS(t){return t&&t.author&&t.timestamp&&t.data}var Oe=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ve=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},it=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Oe([S(),Ve("design:type",String)],it.prototype,"source",void 0);Oe([S(),Ve("design:type",String)],it.prototype,"target",void 0);Oe([S(),Ve("design:type",String)],it.prototype,"predicate",void 0);it=Oe([G(),Ve("design:paramtypes",[Object])],it);var Ii=class{};Oe([S(),Ve("design:type",Array)],Ii.prototype,"additions",void 0);Oe([S(),Ve("design:type",Array)],Ii.prototype,"removals",void 0);Ii=Oe([He()],Ii);var Pi=class{constructor(e,r){this.additions=e,this.removals=r}};Oe([S(),Ve("design:type",Array)],Pi.prototype,"additions",void 0);Oe([S(),Ve("design:type",Array)],Pi.prototype,"removals",void 0);Pi=Oe([G(),Ve("design:paramtypes",[Array,Array])],Pi);var yn=class{};Oe([S(),Ve("design:type",String)],yn.prototype,"source",void 0);Oe([S(),Ve("design:type",String)],yn.prototype,"target",void 0);Oe([S(),Ve("design:type",String)],yn.prototype,"predicate",void 0);yn=Oe([He()],yn);var tu=class extends Ct(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};tu=Oe([G()],tu);var ru=class extends kp(){};ru=Oe([He()],ru);function bS(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function SS(t){return t&&t.source&&t.target}var wn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},wo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},It=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};wn([S(),wo("design:type",Array)],It.prototype,"links",void 0);It=wn([G(),wo("design:paramtypes",[Array])],It);var fo=class{};wn([S(),wo("design:type",Array)],fo.prototype,"links",void 0);fo=wn([He()],fo);var nu=class extends Ct(){};nu=wn([G()],nu);var V=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},U=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},kt=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new It}};V([S(),U("design:type",String)],kt.prototype,"did",void 0);V([S(),U("design:type",It)],kt.prototype,"perspective",void 0);V([S(),U("design:type",String)],kt.prototype,"directMessageLanguage",void 0);kt=V([G(),U("design:paramtypes",[String,It])],kt);var iu=class extends Ct(){};iu=V([G()],iu);var Pt=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};V([S(),U("design:type",String)],Pt.prototype,"did",void 0);V([S(),U("design:type",String)],Pt.prototype,"didSigningKeyId",void 0);V([S(),U("design:type",String)],Pt.prototype,"deviceKeyType",void 0);V([S(),U("design:type",String)],Pt.prototype,"deviceKey",void 0);V([S(),U("design:type",String)],Pt.prototype,"deviceKeySignedByDid",void 0);V([S(),U("design:type",String)],Pt.prototype,"didSignedByDeviceKey",void 0);Pt=V([G(),U("design:paramtypes",[String,String,String,String,String,String])],Pt);var At=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};V([S(),U("design:type",String)],At.prototype,"did",void 0);V([S(),U("design:type",String)],At.prototype,"didSigningKeyId",void 0);V([S(),U("design:type",String)],At.prototype,"deviceKeyType",void 0);V([S(),U("design:type",String)],At.prototype,"deviceKey",void 0);V([S(),U("design:type",String)],At.prototype,"deviceKeySignedByDid",void 0);V([S(),U("design:type",String)],At.prototype,"didSignedByDeviceKey",void 0);At=V([He(),U("design:paramtypes",[String,String,String,String,String,String])],At);var Ai=class{constructor(e,r){this.signature=e,this.publicKey=r}};V([S(),U("design:type",String)],Ai.prototype,"signature",void 0);V([S(),U("design:type",String)],Ai.prototype,"publicKey",void 0);Ai=V([G(),U("design:paramtypes",[String,String])],Ai);var Or=class{constructor(e,r){this.domain=e,this.pointers=r}};V([S(),U("design:type",String)],Or.prototype,"domain",void 0);V([S(),U("design:type",Array)],Or.prototype,"pointers",void 0);Or=V([G(),U("design:paramtypes",[String,Array])],Or);var Ni=class{constructor(e,r){this.with=e,this.can=r}};V([S(),U("design:type",Or)],Ni.prototype,"with",void 0);V([S(),U("design:type",Array)],Ni.prototype,"can",void 0);Ni=V([G(),U("design:paramtypes",[Or,Array])],Ni);var Nt=class{constructor(e,r,n,i){this.appName=e,this.appDesc=r,this.appUrl=n,this.capabilities=i}};V([S(),U("design:type",String)],Nt.prototype,"appName",void 0);V([S(),U("design:type",String)],Nt.prototype,"appDesc",void 0);V([S(),U("design:type",String)],Nt.prototype,"appUrl",void 0);V([S(),U("design:type",Array)],Nt.prototype,"capabilities",void 0);Nt=V([G(),U("design:paramtypes",[String,String,String,Array])],Nt);var Ri=class{constructor(e,r){this.requestId=e,this.auth=r}};V([S(),U("design:type",String)],Ri.prototype,"requestId",void 0);V([S(),U("design:type",Nt)],Ri.prototype,"auth",void 0);Ri=V([G(),U("design:paramtypes",[String,Nt])],Ri);var kr=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Dr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},$e=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};kr([S(),Dr("design:type",Boolean)],$e.prototype,"isInitialized",void 0);kr([S(),Dr("design:type",Boolean)],$e.prototype,"isUnlocked",void 0);kr([S(),Dr("design:type",String)],$e.prototype,"did",void 0);kr([S(),Dr("design:type",String)],$e.prototype,"didDocument",void 0);kr([S(),Dr("design:type",String)],$e.prototype,"error",void 0);$e=kr([G(),Dr("design:paramtypes",[Object])],$e);var Zt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},er=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Pe=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)}};Zt([S(),er("design:type",String)],Pe.prototype,"source",void 0);Zt([S(),er("design:type",String)],Pe.prototype,"target",void 0);Zt([S(),er("design:type",String)],Pe.prototype,"predicate",void 0);Zt([S(),er("design:type",Date)],Pe.prototype,"fromDate",void 0);Zt([S(),er("design:type",Date)],Pe.prototype,"untilDate",void 0);Zt([S(),er("design:type",Number)],Pe.prototype,"limit",void 0);Pe=Zt([G(),He(),er("design:paramtypes",[Object])],Pe);var au=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ie=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ke,mt;function no(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ze=class{constructor(){Ke.set(this,void 0),mt.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new ze;return au(r,mt,e,"f"),r}static from(e){let r=new ze;return au(r,Ke,e,"f"),r}toUrl(){if(Ie(this,mt,"f")&&!Ie(this,Ke,"f"))return Ie(this,mt,"f");if(!Ie(this,mt,"f")&&!Ie(this,Ke,"f"))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,Ke,"f")){case"string":e=`string:${no(Ie(this,Ke,"f"))}`;break;case"number":e=`number:${no(Ie(this,Ke,"f"))}`;break;case"object":e=`json:${no(JSON.stringify(Ie(this,Ke,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,Ke,"f"))return Ie(this,Ke,"f");if(!Ie(this,mt,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,mt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,mt,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};Ke=new WeakMap,mt=new WeakMap;function Ru(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Cu(t){return`set${Ru(t)}`}function Dp(t){return t.replace("set","").replace(/^[A-Z]/,e=>e.toLowerCase())}function Ip(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Pp(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function Lu(t){return`add${Ru(Pp(t))}`}function Ap(t){let e=t.substring(3),r=Ip(e);return r.charAt(0).toLowerCase()+r.slice(1)}function wi(t){if(Array.isArray(t))return`[${t.map(wi).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var io=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},W=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},nt,Ce,Ee,Ci=class{constructor(t,e,r){nt.set(this,void 0),Ce.set(this,void 0),Ee.set(this,void 0),io(this,nt,e,"f"),io(this,Ce,r,"f"),io(this,Ee,t,"f")}get baseExpression(){return W(this,nt,"f")}async init(){let isInstance=await W(this,Ee,"f").isSubjectInstance(W(this,nt,"f"),W(this,Ce,"f"));if(!isInstance)throw`Not a valid subject instance of ${W(this,Ce,"f")} for ${W(this,nt,"f")}`;let results=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), property(c, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), property_resolve(c, "${t}")`);Object.defineProperty(this,t,{get:async()=>{let r=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), property_getter(c, "${W(this,nt,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e){let i=await W(this,Ee,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}else return}})}let setters=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), property_setter(c, Property, Setter)`);for(let setter of setters)if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), property_resolve_language(c, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Cu(property)]=async t=>{resolveLanguage&&(t=await W(this,Ee,"f").createExpression(t,resolveLanguage)),await W(this,Ee,"f").executeAction(actions,W(this,nt,"f"),[{name:"value",value:t}])}}let flattenPrologList=t=>{let e=[];for(;t&&t.head;)e.push(t.head),t=t.tail;return e},results2=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), collection(c, Collection)`),collections=results2.map(t=>t.Collection);for(let c of collections)Object.defineProperty(this,c,{get:async()=>{let results=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), collection_getter(c, "${W(this,nt,"f")}", "${c}", Value)`);return results&&results.length>0&&results[0].Value?flattenPrologList(eval(results[0].Value)):[]}});let adders=await W(this,Ee,"f").infer(`subject_class("${W(this,Ce,"f")}", c), collection_adder(c, Collection, Adder)`);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[Lu(collection)]=async t=>{await W(this,Ee,"f").executeAction(actions,W(this,nt,"f"),[{name:"value",value:t}])}}}};nt=new WeakMap,Ce=new WeakMap,Ee=new WeakMap;var fi=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},M=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},me,_e,Kt,Wt,Er=class{constructor(t,e){me.set(this,void 0),_e.set(this,void 0),Kt.set(this,void 0),Wt.set(this,void 0),fi(this,Kt,[],"f"),fi(this,Wt,[],"f"),fi(this,me,t,"f"),fi(this,_e,e,"f"),M(this,_e,"f").addPerspectiveLinkAddedListener(M(this,me,"f").uuid,M(this,Kt,"f")),M(this,_e,"f").addPerspectiveLinkRemovedListener(M(this,me,"f").uuid,M(this,Wt,"f"))}async executeAction(t,e,r){let n=a=>{if(a)return a.replace("this",e)},i=a=>{if(r){let o=a;for(let s of r)o=o.replace(s.name,s.value);return o}else return a};for(let a of t){let o=n(i(a.source)),s=n(i(a.predicate)),u=n(i(a.target));switch(a.action){case"addLink":await this.add(new it({source:o,predicate:s,target:u}));break;case"removeLink":let l=await this.get(new Pe({source:o,predicate:s,target:u}));for(let f of l)await this.remove(f);break;case"setSingleTarget":await this.setSingleTarget(new it({source:o,predicate:s,target:u}));break}}}get uuid(){return M(this,me,"f").uuid}get name(){return M(this,me,"f").name}get sharedUrl(){return M(this,me,"f").sharedUrl}get neighbourhood(){return M(this,me,"f").neighbourhood}async get(t){return await M(this,_e,"f").queryLinks(M(this,me,"f").uuid,t)}async infer(t){return await M(this,_e,"f").queryProlog(M(this,me,"f").uuid,t)}async add(t){return await M(this,_e,"f").addLink(M(this,me,"f").uuid,t)}async addLinks(t){return await M(this,_e,"f").addLinks(M(this,me,"f").uuid,t)}async removeLinks(t){return await M(this,_e,"f").removeLinks(M(this,me,"f").uuid,t)}async linkMutations(t){return await M(this,_e,"f").linkMutations(M(this,me,"f").uuid,t)}async addLinkExpression(t){return await M(this,_e,"f").addLinkExpression(M(this,me,"f").uuid,t)}async update(t,e){return await M(this,_e,"f").updateLink(M(this,me,"f").uuid,t,e)}async remove(t){return await M(this,_e,"f").removeLink(M(this,me,"f").uuid,t)}async getExpression(t){return await M(this,_e,"f").getExpression(t)}async createExpression(t,e){return await M(this,_e,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?M(this,Kt,"f").push(e):t==="link-removed"&&M(this,Wt,"f").push(e)}async removeListener(t,e){if(t==="link-added"){let r=M(this,Kt,"f").indexOf(e);M(this,Kt,"f").splice(r,1)}else if(t==="link-removed"){let r=M(this,Wt,"f").indexOf(e);M(this,Wt,"f").splice(r,1)}}async snapshot(){return M(this,_e,"f").snapshotByUUID(M(this,me,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t){let e=new Pe({source:t.source,predicate:t.predicate}),r=await this.get(e),n=[];for(let a of r)delete a.__typename,delete a.data.__typename,delete a.proof.__typename,n.push(a);let i=[t];await this.linkMutations({additions:i,removals:n})}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async setSdna(t){await this.setSingleTarget(new it({source:"ad4m://self",predicate:"ad4m://has_zome",target:ze.from(t).toUrl()}))}async getSdna(){return(await this.get(new Pe({source:"ad4m://self",predicate:"ad4m://has_zome"}))).map(e=>e.data.target).map(e=>ze.fromUrl(e).get())}async addSdna(t){await this.add(new it({source:"ad4m://self",predicate:"ad4m://has_zome",target:ze.from(t).toUrl()}))}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClass(t){return typeof t=="string"?t:(await this.subjectClassesByTemplate(t))[0]}async createSubject(subjectClass,exprAddr){let className=await this.stringOrTemplateObjectToSubjectClass(subjectClass),result=await this.infer(`subject_class("${className}", C), constructor(C, Actions)`);if(!result.length)throw"No constructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));return await this.executeAction(actions[0],exprAddr,void 0),this.getSubjectProxy(exprAddr,subjectClass)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClass(e);return await this.infer(`subject_class("${r}", c), instance(c, "${t}")`)}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${e}`;let r=await this.stringOrTemplateObjectToSubjectClass(e),n=new Ci(this,t,r);return await n.init(),n}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.infer(`subject_class("${n}", c), instance(c, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));r=r.concat(a)}return r}async subjectClassesByTemplate(t){let e=Object.keys(t).filter(s=>!Array.isArray(t[s])),r=Object.keys(t).filter(s=>Array.isArray(t[s])),n=Object.getOwnPropertyNames(t).filter(s=>typeof t[s]=="function"&&s.startsWith("set"));n=n.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(s=>typeof t[s]=="function"&&s.startsWith("set")));let i=Object.getOwnPropertyNames(t).filter(s=>typeof t[s]=="function"&&s.startsWith("add"));i=i.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(s=>typeof t[s]=="function"&&s.startsWith("add")));let a="subject_class(Class, c)";for(let s of e)a+=`, property(c, "${s}")`;for(let s of r)a+=`, collection(c, "${s}")`;for(let s of n){let u=s.substring(3);u=u.charAt(0).toLowerCase()+u.slice(1),a+=`, property_setter(c, "${u}", _)`}for(let s of i)a+=`, collection_adder(c, "${Ap(s)}", _)`;a+=".";let o=await this.infer(a);return o?o.map(s=>s.Class):[]}async ensureSDNASubjectClass(t){(await this.subjectClassesByTemplate(new t)).length>0||await this.addSdna(t.generateSDNA())}};me=new WeakMap,_e=new WeakMap,Kt=new WeakMap,Wt=new WeakMap;var Xr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},z=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ie,tn,rn,nn,an,Ge=`
|
|
58
|
+
author
|
|
59
|
+
timestamp
|
|
60
|
+
data { source, predicate, target }
|
|
61
|
+
proof { valid, invalid, signature, key }
|
|
62
|
+
`,br=`
|
|
63
|
+
uuid
|
|
64
|
+
name
|
|
65
|
+
sharedUrl
|
|
66
|
+
neighbourhood {
|
|
67
|
+
linkLanguage
|
|
68
|
+
meta {
|
|
69
|
+
links
|
|
70
|
+
{
|
|
71
|
+
author
|
|
72
|
+
timestamp
|
|
73
|
+
data { source, predicate, target }
|
|
74
|
+
proof { valid, invalid, signature, key }
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
`,Li=class{constructor(e,r=!0){ie.set(this,void 0),tn.set(this,void 0),rn.set(this,void 0),nn.set(this,void 0),an.set(this,void 0),Xr(this,ie,e,"f"),Xr(this,tn,[],"f"),Xr(this,rn,[],"f"),Xr(this,nn,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Xr(this,an,e,"f")}async all(){let{perspectives:e}=k(await z(this,ie,"f").query({query:O`query perspectives {
|
|
79
|
+
perspectives {
|
|
80
|
+
${br}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
}`}));return e.map(r=>new Er(r,this))}async byUUID(e){let{perspective:r}=k(await z(this,ie,"f").query({query:O`query perspective($uuid: String!) {
|
|
84
|
+
perspective(uuid: $uuid) {
|
|
85
|
+
${br}
|
|
86
|
+
}
|
|
87
|
+
}`,variables:{uuid:e}}));return r?new Er(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await z(this,ie,"f").query({query:O`query perspectiveSnapshot($uuid: String!) {
|
|
88
|
+
perspectiveSnapshot(uuid: $uuid) {
|
|
89
|
+
links { ${Ge} }
|
|
90
|
+
}
|
|
91
|
+
}`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
92
|
+
perspectivePublishSnapshot(uuid: $uuid)
|
|
93
|
+
}`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await z(this,ie,"f").query({query:O`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
94
|
+
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
95
|
+
${Ge}
|
|
96
|
+
}
|
|
97
|
+
}`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await z(this,ie,"f").query({query:O`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
98
|
+
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
99
|
+
}`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async add(e){let{perspectiveAdd:r}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveAdd($name: String!) {
|
|
100
|
+
perspectiveAdd(name: $name) {
|
|
101
|
+
${br}
|
|
102
|
+
}
|
|
103
|
+
}`,variables:{name:e}}));return new Er(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
104
|
+
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
105
|
+
${br}
|
|
106
|
+
}
|
|
107
|
+
}`,variables:{uuid:e,name:r}}));return new Er(n,this)}async remove(e){return k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveRemove($uuid: String!) {
|
|
108
|
+
perspectiveRemove(uuid: $uuid)
|
|
109
|
+
}`,variables:{uuid:e}}))}async addLink(e,r){let{perspectiveAddLink:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!){
|
|
110
|
+
perspectiveAddLink(link: $link, uuid: $uuid) {
|
|
111
|
+
${Ge}
|
|
112
|
+
}
|
|
113
|
+
}`,variables:{uuid:e,link:r}}));return n}async addLinks(e,r){let{perspectiveAddLinks:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!){
|
|
114
|
+
perspectiveAddLinks(links: $links, uuid: $uuid) {
|
|
115
|
+
${Ge}
|
|
116
|
+
}
|
|
117
|
+
}`,variables:{uuid:e,links:r}}));return n}async removeLinks(e,r){let{perspectiveRemoveLinks:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!){
|
|
118
|
+
perspectiveRemoveLinks(links: $links, uuid: $uuid) {
|
|
119
|
+
${Ge}
|
|
120
|
+
}
|
|
121
|
+
}`,variables:{uuid:e,links:r}}));return n}async linkMutations(e,r){let{perspectiveLinkMutations:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!){
|
|
122
|
+
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid) {
|
|
123
|
+
additions {
|
|
124
|
+
${Ge}
|
|
125
|
+
}
|
|
126
|
+
removals {
|
|
127
|
+
${Ge}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}`,variables:{uuid:e,mutations:r}}));return n}async addLinkExpression(e,r){let{perspectiveAddLinkExpression:n}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!){
|
|
131
|
+
perspectiveAddLinkExpression(link: $link, uuid: $uuid) {
|
|
132
|
+
${Ge}
|
|
133
|
+
}
|
|
134
|
+
}`,variables:{uuid:e,link:r}}));return n}async updateLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename;let{perspectiveUpdateLink:i}=k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveUpdateLink(
|
|
135
|
+
$uuid: String!,
|
|
136
|
+
$newLink: LinkInput!
|
|
137
|
+
$oldLink: LinkExpressionInput!
|
|
138
|
+
){
|
|
139
|
+
perspectiveUpdateLink(
|
|
140
|
+
newLink: $newLink,
|
|
141
|
+
oldLink: $oldLink,
|
|
142
|
+
uuid: $uuid
|
|
143
|
+
) {
|
|
144
|
+
${Ge}
|
|
145
|
+
}
|
|
146
|
+
}`,variables:{uuid:e,oldLink:r,newLink:n}}));return i}async removeLink(e,r){return delete r.__typename,delete r.data.__typename,delete r.proof.__typename,k(await z(this,ie,"f").mutate({mutation:O`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!) {
|
|
147
|
+
perspectiveRemoveLink(link: $link, uuid: $uuid)
|
|
148
|
+
}`,variables:{uuid:e,link:r}}))}async getExpression(e){return await z(this,an,"f").get(e)}async createExpression(e,r){return await z(this,an,"f").create(e,r)}addPerspectiveAddedListener(e){z(this,tn,"f").push(e)}subscribePerspectiveAdded(){z(this,ie,"f").subscribe({query:O` subscription {
|
|
149
|
+
perspectiveAdded { ${br} }
|
|
150
|
+
}
|
|
151
|
+
`}).subscribe({next:e=>{z(this,tn,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){z(this,rn,"f").push(e)}subscribePerspectiveUpdated(){z(this,ie,"f").subscribe({query:O` subscription {
|
|
152
|
+
perspectiveUpdated { ${br} }
|
|
153
|
+
}
|
|
154
|
+
`}).subscribe({next:e=>{z(this,rn,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveRemovedListener(e){z(this,nn,"f").push(e)}subscribePerspectiveRemoved(){z(this,ie,"f").subscribe({query:O` subscription {
|
|
155
|
+
perspectiveRemoved
|
|
156
|
+
}
|
|
157
|
+
`}).subscribe({next:e=>{z(this,nn,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){z(this,ie,"f").subscribe({query:O` subscription {
|
|
158
|
+
perspectiveLinkAdded(uuid: "${e}") { ${Ge} }
|
|
159
|
+
}
|
|
160
|
+
`}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){z(this,ie,"f").subscribe({query:O` subscription {
|
|
161
|
+
perspectiveLinkRemoved(uuid: "${e}") { ${Ge} }
|
|
162
|
+
}
|
|
163
|
+
`}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}};ie=new WeakMap,tn=new WeakMap,rn=new WeakMap,nn=new WeakMap,an=new WeakMap;var ao=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Y=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ee,on,sn,Zr=`
|
|
164
|
+
did
|
|
165
|
+
directMessageLanguage
|
|
166
|
+
perspective {
|
|
167
|
+
links {
|
|
168
|
+
author, timestamp,
|
|
169
|
+
proof {
|
|
170
|
+
signature, key, valid, invalid
|
|
171
|
+
}
|
|
172
|
+
data {
|
|
173
|
+
source, predicate, target
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
`,Np=`
|
|
178
|
+
requestId
|
|
179
|
+
auth {
|
|
180
|
+
appName
|
|
181
|
+
appDesc
|
|
182
|
+
appUrl
|
|
183
|
+
capabilities {
|
|
184
|
+
with {
|
|
185
|
+
domain
|
|
186
|
+
pointers
|
|
187
|
+
}
|
|
188
|
+
can
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`,Sr=`
|
|
192
|
+
isInitialized
|
|
193
|
+
isUnlocked
|
|
194
|
+
did
|
|
195
|
+
didDocument
|
|
196
|
+
error
|
|
197
|
+
`,pi=`
|
|
198
|
+
did
|
|
199
|
+
didSigningKeyId
|
|
200
|
+
deviceKeyType
|
|
201
|
+
deviceKey
|
|
202
|
+
deviceKeySignedByDid
|
|
203
|
+
didSignedByDeviceKey
|
|
204
|
+
`,Rp=`
|
|
205
|
+
signature
|
|
206
|
+
publicKey
|
|
207
|
+
`,vn=class{constructor(e,r=!0){ee.set(this,void 0),on.set(this,void 0),sn.set(this,void 0),ao(this,ee,e,"f"),ao(this,on,[],"f"),ao(this,sn,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged())}async me(){let{agent:e}=k(await Y(this,ee,"f").query({query:O`query agent { agent { ${Zr} } }`})),r=new kt(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await Y(this,ee,"f").query({query:O`query agentStatus {
|
|
208
|
+
agentStatus {
|
|
209
|
+
${Sr}
|
|
210
|
+
}
|
|
211
|
+
}`}));return new $e(e)}async generate(e){let{agentGenerate:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentGenerate(
|
|
212
|
+
$passphrase: String!
|
|
213
|
+
) {
|
|
214
|
+
agentGenerate(passphrase: $passphrase) {
|
|
215
|
+
${Sr}
|
|
216
|
+
}
|
|
217
|
+
}`,variables:{passphrase:e}}));return new $e(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentImport(
|
|
218
|
+
$did: String!,
|
|
219
|
+
$didDocument: String!,
|
|
220
|
+
$keystore: String!,
|
|
221
|
+
$passphrase: String!
|
|
222
|
+
) {
|
|
223
|
+
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
224
|
+
${Sr}
|
|
225
|
+
}
|
|
226
|
+
}`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new $e(o)}async lock(e){let{agentLock:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentLock($passphrase: String!) {
|
|
227
|
+
agentLock(passphrase: $passphrase) {
|
|
228
|
+
${Sr}
|
|
229
|
+
}
|
|
230
|
+
}`,variables:{passphrase:e}}));return new $e(r)}async unlock(e){let{agentUnlock:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentUnlock($passphrase: String!) {
|
|
231
|
+
agentUnlock(passphrase: $passphrase) {
|
|
232
|
+
${Sr}
|
|
233
|
+
}
|
|
234
|
+
}`,variables:{passphrase:e}}));return new $e(r)}async byDID(e){let{agentByDID:r}=k(await Y(this,ee,"f").query({query:O`query agentByDID($did: String!) {
|
|
235
|
+
agentByDID(did: $did) {
|
|
236
|
+
${Zr}
|
|
237
|
+
}
|
|
238
|
+
}`,variables:{did:e}}));return r}async updatePublicPerspective(e){let r=JSON.parse(JSON.stringify(e));delete r.__typename,r.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename});let{agentUpdatePublicPerspective:n}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
239
|
+
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
240
|
+
${Zr}
|
|
241
|
+
}
|
|
242
|
+
}`,variables:{perspective:r}})),i=n,a=new kt(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new Li(Y(this,ee,"f")),n=new vn(Y(this,ee,"f")),i=await r.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let u of e.additions)await i.add(u);for(let u of e.removals)await i.remove(u);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
243
|
+
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
244
|
+
${Zr}
|
|
245
|
+
}
|
|
246
|
+
}`,variables:{directMessageLanguage:e}})),n=r,i=new kt(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
247
|
+
agentAddEntanglementProofs(proofs: $proofs) {
|
|
248
|
+
${pi}
|
|
249
|
+
}
|
|
250
|
+
}`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
251
|
+
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
252
|
+
${pi}
|
|
253
|
+
}
|
|
254
|
+
}`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await Y(this,ee,"f").query({query:O`query agentGetEntanglementProofs {
|
|
255
|
+
agentGetEntanglementProofs {
|
|
256
|
+
${pi}
|
|
257
|
+
}
|
|
258
|
+
}`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
259
|
+
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
260
|
+
${pi}
|
|
261
|
+
}
|
|
262
|
+
}`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){Y(this,on,"f").push(e)}subscribeAgentUpdated(){Y(this,ee,"f").subscribe({query:O` subscription {
|
|
263
|
+
agentUpdated { ${Zr} }
|
|
264
|
+
}
|
|
265
|
+
`}).subscribe({next:e=>{let r=e.data.agentUpdated;Y(this,on,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Y(this,sn,"f").push(e)}subscribeAgentStatusChanged(){Y(this,ee,"f").subscribe({query:O` subscription {
|
|
266
|
+
agentStatusChanged { ${Sr} }
|
|
267
|
+
}
|
|
268
|
+
`}).subscribe({next:e=>{let r=e.data.agentStatusChanged;Y(this,sn,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e,r,n,i){let{agentRequestCapability:a}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentRequestCapability($appName: String!, $appDesc: String!, $appUrl: String!, $capabilities: String!) {
|
|
269
|
+
agentRequestCapability(appName: $appName, appDesc: $appDesc, appUrl: $appUrl, capabilities: $capabilities)
|
|
270
|
+
}`,variables:{appName:e,appDesc:r,appUrl:n,capabilities:i}}));return a}async permitCapability(e){let{agentPermitCapability:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentPermitCapability($auth: String!) {
|
|
271
|
+
agentPermitCapability(auth: $auth)
|
|
272
|
+
}`,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
273
|
+
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
274
|
+
}`,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await Y(this,ee,"f").mutate({mutation:O`query agentGetApps {
|
|
275
|
+
agentGetApps {
|
|
276
|
+
${Np}
|
|
277
|
+
}
|
|
278
|
+
}`}));return e}async isLocked(){let{agentIsLocked:e}=k(await Y(this,ee,"f").mutate({mutation:O`query agentIsLocked {
|
|
279
|
+
agentIsLocked
|
|
280
|
+
}`}));return e}async signMessage(e){let{agentSignMessage:r}=k(await Y(this,ee,"f").mutate({mutation:O`mutation agentSignMessage($message: String!) {
|
|
281
|
+
agentSignMessage(message: $message) {
|
|
282
|
+
${Rp}
|
|
283
|
+
}
|
|
284
|
+
}`,variables:{message:e}}));return r}};ee=new WeakMap,on=new WeakMap,sn=new WeakMap;var Cp=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},xt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},We,ou=`
|
|
285
|
+
name
|
|
286
|
+
address
|
|
287
|
+
settings
|
|
288
|
+
icon { code }
|
|
289
|
+
constructorIcon { code }
|
|
290
|
+
settingsIcon { code }
|
|
291
|
+
`,su=`
|
|
292
|
+
name
|
|
293
|
+
address
|
|
294
|
+
description
|
|
295
|
+
author
|
|
296
|
+
templated
|
|
297
|
+
templateSourceLanguageAddress
|
|
298
|
+
templateAppliedParams
|
|
299
|
+
possibleTemplateParams
|
|
300
|
+
sourceCodeLink
|
|
301
|
+
`,po=class{constructor(e){We.set(this,void 0),Cp(this,We,e,"f")}async byAddress(e){let{language:r}=k(await xt(this,We,"f").query({query:O`query byAddress($address: String!) {
|
|
302
|
+
language(address: $address) {
|
|
303
|
+
${ou}
|
|
304
|
+
}
|
|
305
|
+
}`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await xt(this,We,"f").query({query:O`query byFilter($filter: String!) {
|
|
306
|
+
languages(filter: $filter) {
|
|
307
|
+
${ou}
|
|
308
|
+
}
|
|
309
|
+
}`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await xt(this,We,"f").mutate({mutation:O`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
310
|
+
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
311
|
+
}`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await xt(this,We,"f").mutate({mutation:O`mutation languageApplyTemplateAndPublish(
|
|
312
|
+
$sourceLanguageHash: String!,
|
|
313
|
+
$templateData: String!,
|
|
314
|
+
) {
|
|
315
|
+
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
316
|
+
name, address
|
|
317
|
+
}
|
|
318
|
+
}`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await xt(this,We,"f").mutate({mutation:O`mutation languagePublish(
|
|
319
|
+
$languagePath: String!,
|
|
320
|
+
$languageMeta: LanguageMetaInput!,
|
|
321
|
+
) {
|
|
322
|
+
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
323
|
+
${su}
|
|
324
|
+
}
|
|
325
|
+
}`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await xt(this,We,"f").query({query:O`query languageMeta(
|
|
326
|
+
$address: String!,
|
|
327
|
+
) {
|
|
328
|
+
languageMeta(address: $address) {
|
|
329
|
+
${su}
|
|
330
|
+
}
|
|
331
|
+
}`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await xt(this,We,"f").query({query:O`query languageSource(
|
|
332
|
+
$address: String!,
|
|
333
|
+
) {
|
|
334
|
+
languageSource(address: $address)
|
|
335
|
+
}`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await xt(this,We,"f").mutate({mutation:O`mutation languageRemove(
|
|
336
|
+
$address: String!,
|
|
337
|
+
) {
|
|
338
|
+
languageRemove(address: $address)
|
|
339
|
+
}`,variables:{address:e}}));return r}};We=new WeakMap;var Lp=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},cu=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},cn,ho=class{constructor(e){cn.set(this,void 0),Lp(this,cn,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await cu(this,cn,"f").mutate({mutation:O`mutation neighbourhoodPublishFromPerspective(
|
|
340
|
+
$linkLanguage: String!,
|
|
341
|
+
$meta: PerspectiveInput!,
|
|
342
|
+
$perspectiveUUID: String!
|
|
343
|
+
) {
|
|
344
|
+
neighbourhoodPublishFromPerspective(
|
|
345
|
+
linkLanguage: $linkLanguage,
|
|
346
|
+
meta: $meta,
|
|
347
|
+
perspectiveUUID: $perspectiveUUID
|
|
348
|
+
)
|
|
349
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await cu(this,cn,"f").mutate({mutation:O` mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
350
|
+
neighbourhoodJoinFromUrl(url: $url) {
|
|
351
|
+
uuid
|
|
352
|
+
name
|
|
353
|
+
sharedUrl
|
|
354
|
+
neighbourhood {
|
|
355
|
+
linkLanguage
|
|
356
|
+
meta {
|
|
357
|
+
links
|
|
358
|
+
{
|
|
359
|
+
author
|
|
360
|
+
timestamp
|
|
361
|
+
data { source, predicate, target }
|
|
362
|
+
proof { valid, invalid, signature, key }
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}`,variables:{url:e}}));return r}};cn=new WeakMap;var oo=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Z=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},te,un,ln,di=`
|
|
368
|
+
author
|
|
369
|
+
timestamp
|
|
370
|
+
data {
|
|
371
|
+
links {
|
|
372
|
+
author
|
|
373
|
+
timestamp
|
|
374
|
+
data { source, predicate, target }
|
|
375
|
+
proof { valid, invalid, signature, key }
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
proof { valid, invalid, signature, key }
|
|
379
|
+
`,mo=class{constructor(e,r=!0){te.set(this,void 0),un.set(this,void 0),ln.set(this,void 0),oo(this,te,e,"f"),oo(this,un,[],"f"),oo(this,ln,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred())}async info(){let{runtimeInfo:e}=k(await Z(this,te,"f").query({query:O`query runtimeInfo {
|
|
380
|
+
runtimeInfo {
|
|
381
|
+
ad4mExecutorVersion,
|
|
382
|
+
isInitialized,
|
|
383
|
+
isUnlocked
|
|
384
|
+
}
|
|
385
|
+
}`}));return e}async quit(){return k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeOpenLink($url: String!) {
|
|
386
|
+
runtimeOpenLink(url: $url)
|
|
387
|
+
}`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation addTrustedAgents($agents: [String!]!) {
|
|
388
|
+
addTrustedAgents(agents: $agents)
|
|
389
|
+
}`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
390
|
+
deleteTrustedAgents(agents: $agents)
|
|
391
|
+
}`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await Z(this,te,"f").query({query:O`query getTrustedAgents {
|
|
392
|
+
getTrustedAgents
|
|
393
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
394
|
+
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
395
|
+
}`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
396
|
+
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
397
|
+
}`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await Z(this,te,"f").query({query:O`query runtimeKnownLinkLanguageTemplates {
|
|
398
|
+
runtimeKnownLinkLanguageTemplates
|
|
399
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeAddFriends($dids: [String!]!) {
|
|
400
|
+
runtimeAddFriends(dids: $dids)
|
|
401
|
+
}`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
402
|
+
runtimeRemoveFriends(dids: $dids)
|
|
403
|
+
}`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await Z(this,te,"f").query({query:O`query runtimeFriends {
|
|
404
|
+
runtimeFriends
|
|
405
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await Z(this,te,"f").query({query:O`query runtimeHcAgentInfos {
|
|
406
|
+
runtimeHcAgentInfos
|
|
407
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
408
|
+
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
409
|
+
}`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await Z(this,te,"f").mutate({mutation:O`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
410
|
+
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
411
|
+
}`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
412
|
+
runtimeSetStatus(status: $status)
|
|
413
|
+
}`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await Z(this,te,"f").query({query:O`query runtimeFriendStatus($did: String!) {
|
|
414
|
+
runtimeFriendStatus(did: $did) { ${di} }
|
|
415
|
+
}`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await Z(this,te,"f").mutate({mutation:O`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
416
|
+
runtimeFriendSendMessage(did: $did, message: $message)
|
|
417
|
+
}`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await Z(this,te,"f").query({query:O`query runtimeMessageInbox($filter: String) {
|
|
418
|
+
runtimeMessageInbox(filter: $filter) { ${di} }
|
|
419
|
+
}`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await Z(this,te,"f").query({query:O`query runtimeMessageOutbox($filter: String) {
|
|
420
|
+
runtimeMessageOutbox(filter: $filter) {
|
|
421
|
+
recipient,
|
|
422
|
+
message {
|
|
423
|
+
${di}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}`,variables:{filter:e}}));return r}addMessageCallback(e){Z(this,un,"f").push(e)}subscribeMessageReceived(){Z(this,te,"f").subscribe({query:O` subscription {
|
|
427
|
+
runtimeMessageReceived { ${di} }
|
|
428
|
+
}
|
|
429
|
+
`}).subscribe({next:e=>{Z(this,un,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){Z(this,ln,"f").push(e)}subscribeExceptionOccurred(){Z(this,te,"f").subscribe({query:O` subscription {
|
|
430
|
+
exceptionOccurred {
|
|
431
|
+
title
|
|
432
|
+
message
|
|
433
|
+
type
|
|
434
|
+
addon
|
|
435
|
+
}
|
|
436
|
+
}`}).subscribe({next:e=>{Z(this,ln,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};te=new WeakMap,un=new WeakMap,ln=new WeakMap;var Fp=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},wr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},yt,yo=class{constructor(e){yt.set(this,void 0),Fp(this,yt,e,"f")}async get(e){let{expression:r}=k(await wr(this,yt,"f").query({query:O`query expression($url: String!) {
|
|
437
|
+
expression(url: $url) {
|
|
438
|
+
author
|
|
439
|
+
timestamp
|
|
440
|
+
data
|
|
441
|
+
language {
|
|
442
|
+
address
|
|
443
|
+
}
|
|
444
|
+
proof {
|
|
445
|
+
valid
|
|
446
|
+
invalid
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:r}=k(await wr(this,yt,"f").query({query:O`query expressionMany($urls: [String!]!) {
|
|
450
|
+
expressionMany(urls: $urls) {
|
|
451
|
+
author
|
|
452
|
+
timestamp
|
|
453
|
+
data
|
|
454
|
+
language {
|
|
455
|
+
address
|
|
456
|
+
}
|
|
457
|
+
proof {
|
|
458
|
+
valid
|
|
459
|
+
invalid
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await wr(this,yt,"f").query({query:O`query expressionRaw($url: String!) {
|
|
463
|
+
expressionRaw(url: $url)
|
|
464
|
+
}`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await wr(this,yt,"f").mutate({mutation:O`mutation expressionCreate($content: String!, $languageAddress: String!){
|
|
465
|
+
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
466
|
+
}`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await wr(this,yt,"f").query({query:O`query expressionInteractions($url: String!) {
|
|
467
|
+
expressionInteractions(url: $url) {
|
|
468
|
+
label
|
|
469
|
+
name
|
|
470
|
+
parameters { name, type }
|
|
471
|
+
}
|
|
472
|
+
}`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await wr(this,yt,"f").mutate({mutation:O`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
473
|
+
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
474
|
+
}`,variables:{url:e,interactionCall:r}}));return n}};yt=new WeakMap;var Gt=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Tt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},vo,_i,fn,Ei,Oi,pn,xi,Fi=class{constructor(e,r=!0){vo.set(this,void 0),_i.set(this,void 0),fn.set(this,void 0),Ei.set(this,void 0),Oi.set(this,void 0),pn.set(this,void 0),xi.set(this,void 0),Gt(this,vo,e,"f"),Gt(this,_i,new vn(e,r),"f"),Gt(this,fn,new yo(e),"f"),Gt(this,Ei,new po(e),"f"),Gt(this,Oi,new ho(e),"f"),Gt(this,pn,new Li(e,r),"f"),Tt(this,pn,"f").setExpressionClient(Tt(this,fn,"f")),Gt(this,xi,new mo(e,r),"f")}get agent(){return Tt(this,_i,"f")}get expression(){return Tt(this,fn,"f")}get languages(){return Tt(this,Ei,"f")}get neighbourhood(){return Tt(this,Oi,"f")}get perspective(){return Tt(this,pn,"f")}get runtime(){return Tt(this,xi,"f")}};vo=new WeakMap,_i=new WeakMap,fn=new WeakMap,Ei=new WeakMap,Oi=new WeakMap,pn=new WeakMap,xi=new WeakMap;var uu;(function(t){t[t.LanguageIsNotLoaded=0]="LanguageIsNotLoaded",t[t.ExpressionIsNotVerified=1]="ExpressionIsNotVerified",t[t.AgentIsUntrusted=2]="AgentIsUntrusted",t[t.CapabilityRequested=3]="CapabilityRequested"})(uu||(uu={}));var _o=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Eo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Jt=class{constructor(e,r){this.language=e,this.expression=r}};_o([S(),Eo("design:type",at)],Jt.prototype,"language",void 0);_o([S(),Eo("design:type",String)],Jt.prototype,"expression",void 0);Jt=_o([G(),Eo("design:paramtypes",[at,String])],Jt);function FS(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function MS(t){if(t.startsWith("literal://")){let a=new at;a.address="literal",a.name="literal";let o=t.substring(10);return new Jt(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new at;return s.address=a,new Jt(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new at;return a.address="did",new Jt(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var ot=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Lt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mi=class{};ot([S(),Lt("design:type",String)],Mi.prototype,"name",void 0);ot([S(),Lt("design:type",String)],Mi.prototype,"type",void 0);Mi=ot([G()],Mi);var gn=class{};ot([S(),Lt("design:type",String)],gn.prototype,"label",void 0);ot([S(),Lt("design:type",String)],gn.prototype,"name",void 0);ot([S(),Lt("design:type",Array)],gn.prototype,"parameters",void 0);gn=ot([G()],gn);var ji=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};ot([S(),Lt("design:type",String)],ji.prototype,"name",void 0);ot([S(),Lt("design:type",String)],ji.prototype,"parametersStringified",void 0);ji=ot([He(),Lt("design:paramtypes",[String,Object])],ji);var lu=class{},fu=class{},pu=class{},tr=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ir=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Rt=class{};tr([S(),Ir("design:type",String)],Rt.prototype,"name",void 0);tr([S(),Ir("design:type",String)],Rt.prototype,"address",void 0);tr([S(),Ir("design:type",String)],Rt.prototype,"settings",void 0);tr([S(),Ir("design:type",Yt)],Rt.prototype,"icon",void 0);tr([S(),Ir("design:type",Yt)],Rt.prototype,"constructorIcon",void 0);tr([S(),Ir("design:type",Yt)],Rt.prototype,"settingsIcon",void 0);Rt=tr([G()],Rt);var ke=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ae=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Je=class{};ke([S(),Ae("design:type",String)],Je.prototype,"name",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"address",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"description",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"author",void 0);ke([S(),Ae("design:type",Boolean)],Je.prototype,"templated",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"templateSourceLanguageAddress",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"templateAppliedParams",void 0);ke([S(),Ae("design:type",Array)],Je.prototype,"possibleTemplateParams",void 0);ke([S(),Ae("design:type",String)],Je.prototype,"sourceCodeLink",void 0);Je=ke([G()],Je);var xr=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ke([S(),Ae("design:type",String)],xr.prototype,"name",void 0);ke([S(),Ae("design:type",String)],xr.prototype,"description",void 0);ke([S(),Ae("design:type",Array)],xr.prototype,"possibleTemplateParams",void 0);ke([S(),Ae("design:type",String)],xr.prototype,"sourceCodeLink",void 0);xr=ke([He(),Ae("design:paramtypes",[String,String])],xr);var du=class{},hu=class extends Ct(){},mu=class{},Vi=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Oo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},bn=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Vi([S(),Oo("design:type",String)],bn.prototype,"linkLanguage",void 0);Vi([S(),Oo("design:type",It)],bn.prototype,"meta",void 0);bn=Vi([G(),Oo("design:paramtypes",[String,It])],bn);var yu=class extends Ct(){};yu=Vi([G()],yu);var _n=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},En=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Tr=class{constructor(e,r){this.uuid=e,this.name=r}};_n([S(),En("design:type",String)],Tr.prototype,"uuid",void 0);_n([S(),En("design:type",String)],Tr.prototype,"name",void 0);_n([S(),En("design:type",String)],Tr.prototype,"sharedUrl",void 0);_n([S(),En("design:type",bn)],Tr.prototype,"neighbourhood",void 0);Tr=_n([G(),En("design:paramtypes",[String,String])],Tr);var Ui=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Fu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},qi=class{};Ui([S(),Fu("design:type",Array)],qi.prototype,"additions",void 0);Ui([S(),Fu("design:type",Array)],qi.prototype,"removals",void 0);qi=Ui([G()],qi);var vu=class extends Ct(){};vu=Ui([G()],vu);var gu=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},_r=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},dn,zt,hi="smart_literal://content";function Mp(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var Sn=class{constructor(e,r){dn.set(this,void 0),zt.set(this,void 0),gu(this,dn,e,"f"),gu(this,zt,r,"f")}get base(){return _r(this,zt,"f")}static async create(e,r){let n=ze.from(Mp(10)).toUrl(),i=new Sn(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Pe({source:r,predicate:hi}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Pe({predicate:hi}))).map(n=>new Sn(e,n.data.source))}async get(){let e=await _r(this,dn,"f").getSingleTarget(new Pe({source:_r(this,zt,"f"),predicate:hi}));if(!e)throw`No content for smart literal ${_r(this,zt,"f")}`;return ze.fromUrl(e).get()}async set(e){let r=ze.from(e);await _r(this,dn,"f").setSingleTarget(new it({source:_r(this,zt,"f"),predicate:hi,target:r.toUrl()}))}};dn=new WeakMap,zt=new WeakMap;var bu=class{};function JS(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function HS(t){return`triple(this, "${t}", _)`}function YS(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("instanceQuery decorator can only be applied to methods");n.value=async function(a){let o=[],s=e.name,u=`subject_class("${s}", c), instance(c, Instance)`;if(t&&t.where)for(let f in t.where){let h=t.where[f];u+=`, property_getter(c, Instance, "${f}", "${h}")`}t&&t.condition&&(u+=", "+t.condition);let l=await a.infer(u);if(l==!1)return o;if(typeof l=="string")throw l;for(let f of l){let h=f.Instance,p=new Ci(a,h,s);await p.init(),o.push(p)}return o}}}function XS(t){return function(e,r){e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},Object.defineProperty(e,r,{})}}function ZS(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t,Object.defineProperty(e,r,{})}}function ew(t){return function(e,r){let n=Dp(r);e.__properties=e.__properties||{},e.__properties[n]=e.__properties[n]||{},e.__properties[n]={...e.__properties[n],...t}}}function tw(t,e,r){if(typeof r.value!="function")throw new Error("sdnaOutput decorator can only be applied to methods");return r.value=()=>{let i="",a=t.name,o=new t;i+=`subject_class("${a}", c).
|
|
475
|
+
`;let s=[];o.subjectConstructor&&o.subjectConstructor.length&&(s=s.concat(o.subjectConstructor));let u=[];o.isSubjectInstance&&o.isSubjectInstance.length&&(u=u.concat(o.isSubjectInstance));let l=[],f=o.__properties||{};for(let m in f){let b=`property(c, "${m}").
|
|
476
|
+
`,{through:E,initial:I,required:w,resolve:T,resolveLanguage:A}=f[m];T&&(b+=`property_resolve(c, "${m}").
|
|
477
|
+
`,A&&(b+=`property_resolve_language(c, "${m}", "${A}").
|
|
478
|
+
`)),E&&(b+=`property_getter(c, Base, "${m}", Value) :- triple(Base, "${E}", Value).
|
|
479
|
+
`,w&&u.push(`triple(Base, "${E}", _)`),typeof o[Cu(m)]=="function"&&(b+=`property_setter(c, "${m}", '${wi([{action:"setSingleTarget",source:"this",predicate:E,target:"value"}])}').
|
|
480
|
+
`)),l.push(b),I&&s.push({action:"addLink",source:"this",predicate:E,target:I})}let h=[],p=o.__collections||{};for(let m in p){let b=`collection(c, "${m}").
|
|
481
|
+
`,{through:E,where:I}=p[m];if(E){if(I){if(!I.isInstance)throw"'where' currently only supports 'isInstance'";let T;I.isInstance.name?T=I.isInstance.name:T=I.isInstance,b+=`collection_getter(c, Base, "${m}", List) :- setof(C, (triple(Base, "${E}", C), instance(OtherClass, C), subject_class("${T}", OtherClass)), List).
|
|
482
|
+
`}else b+=`collection_getter(c, Base, "${m}", List) :- findall(C, triple(Base, "${E}", C), List).
|
|
483
|
+
`;typeof o[Lu(m)]=="function"&&(b+=`collection_adder(c, "${m}", '${wi([{action:"addLink",source:"this",predicate:E,target:"value"}])}').
|
|
484
|
+
`)}h.push(b)}let d=wi(s);i+=`constructor(c, '${d}').
|
|
485
|
+
`;let v=u.join(", ");return i+=`instance(c, Base) :- ${v}.
|
|
486
|
+
`,i+=`
|
|
487
|
+
`,i+=l.join(`
|
|
488
|
+
`),i+=`
|
|
489
|
+
`,i+=h.join(`
|
|
490
|
+
`),i},r}var rw=`
|
|
491
|
+
type Agent {
|
|
492
|
+
did: String!
|
|
493
|
+
directMessageLanguage: String
|
|
494
|
+
perspective: Perspective
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
type AgentSignature {
|
|
498
|
+
publicKey: String!
|
|
499
|
+
signature: String!
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
type AgentStatus {
|
|
503
|
+
did: String
|
|
504
|
+
didDocument: String
|
|
505
|
+
error: String
|
|
506
|
+
isInitialized: Boolean!
|
|
507
|
+
isUnlocked: Boolean!
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
type Apps {
|
|
511
|
+
auth: AuthInfo!
|
|
512
|
+
requestId: String!
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
type AuthInfo {
|
|
516
|
+
appDesc: String!
|
|
517
|
+
appName: String!
|
|
518
|
+
appUrl: String!
|
|
519
|
+
capabilities: [Capability!]!
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
type Capability {
|
|
523
|
+
can: [String!]!
|
|
524
|
+
with: Resource!
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
scalar DateTime
|
|
528
|
+
|
|
529
|
+
type EntanglementProof {
|
|
530
|
+
deviceKey: String!
|
|
531
|
+
deviceKeySignedByDid: String!
|
|
532
|
+
deviceKeyType: String!
|
|
533
|
+
did: String!
|
|
534
|
+
didSignedByDeviceKey: String
|
|
535
|
+
didSigningKeyId: String!
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
input EntanglementProofInput {
|
|
539
|
+
deviceKey: String!
|
|
540
|
+
deviceKeySignedByDid: String!
|
|
541
|
+
deviceKeyType: String!
|
|
542
|
+
did: String!
|
|
543
|
+
didSignedByDeviceKey: String!
|
|
544
|
+
didSigningKeyId: String!
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
type ExceptionInfo {
|
|
548
|
+
addon: String
|
|
549
|
+
message: String!
|
|
550
|
+
title: String!
|
|
551
|
+
type: Float!
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
type ExpressionProof {
|
|
555
|
+
invalid: Boolean
|
|
556
|
+
key: String!
|
|
557
|
+
signature: String!
|
|
558
|
+
valid: Boolean
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
input ExpressionProofInput {
|
|
562
|
+
invalid: Boolean
|
|
563
|
+
key: String!
|
|
564
|
+
signature: String!
|
|
565
|
+
valid: Boolean
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
type ExpressionRendered {
|
|
569
|
+
author: String!
|
|
570
|
+
data: String!
|
|
571
|
+
icon: Icon!
|
|
572
|
+
language: LanguageRef!
|
|
573
|
+
proof: ExpressionProof!
|
|
574
|
+
timestamp: String!
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
type Icon {
|
|
578
|
+
code: String!
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
input InteractionCall {
|
|
582
|
+
name: String!
|
|
583
|
+
parametersStringified: String!
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
type InteractionMeta {
|
|
587
|
+
label: String!
|
|
588
|
+
name: String!
|
|
589
|
+
parameters: [InteractionParameter!]!
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
type InteractionParameter {
|
|
593
|
+
name: String!
|
|
594
|
+
type: String!
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
type LanguageHandle {
|
|
598
|
+
address: String!
|
|
599
|
+
constructorIcon: Icon
|
|
600
|
+
icon: Icon
|
|
601
|
+
name: String!
|
|
602
|
+
settings: String
|
|
603
|
+
settingsIcon: Icon
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
type LanguageMeta {
|
|
607
|
+
address: String!
|
|
608
|
+
author: String!
|
|
609
|
+
description: String
|
|
610
|
+
name: String!
|
|
611
|
+
possibleTemplateParams: [String!]
|
|
612
|
+
sourceCodeLink: String
|
|
613
|
+
templateAppliedParams: String
|
|
614
|
+
templateSourceLanguageAddress: String
|
|
615
|
+
templated: Boolean
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
input LanguageMetaInput {
|
|
619
|
+
description: String = ""
|
|
620
|
+
name: String!
|
|
621
|
+
possibleTemplateParams: [String!]
|
|
622
|
+
sourceCodeLink: String
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
type LanguageRef {
|
|
626
|
+
address: String!
|
|
627
|
+
name: String!
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
type Link {
|
|
631
|
+
predicate: String
|
|
632
|
+
source: String!
|
|
633
|
+
target: String!
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
type LinkExpression {
|
|
637
|
+
author: String!
|
|
638
|
+
data: Link!
|
|
639
|
+
proof: ExpressionProof!
|
|
640
|
+
timestamp: String!
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
input LinkExpressionInput {
|
|
644
|
+
author: String!
|
|
645
|
+
data: LinkInput!
|
|
646
|
+
proof: ExpressionProofInput!
|
|
647
|
+
timestamp: String!
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
type LinkExpressionMutations {
|
|
651
|
+
additions: [LinkExpression!]!
|
|
652
|
+
removals: [LinkExpression!]!
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
input LinkInput {
|
|
656
|
+
predicate: String
|
|
657
|
+
source: String!
|
|
658
|
+
target: String!
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
input LinkMutations {
|
|
662
|
+
additions: [LinkInput!]!
|
|
663
|
+
removals: [LinkExpressionInput!]!
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
input LinkQuery {
|
|
667
|
+
fromDate: DateTime
|
|
668
|
+
limit: Float
|
|
669
|
+
predicate: String
|
|
670
|
+
source: String
|
|
671
|
+
target: String
|
|
672
|
+
untilDate: DateTime
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
type Mutation {
|
|
676
|
+
addTrustedAgents(agents: [String!]!): [String!]!
|
|
677
|
+
agentAddEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
|
|
678
|
+
agentDeleteEntanglementProofs(proofs: [EntanglementProofInput!]!): [EntanglementProof!]!
|
|
679
|
+
agentEntanglementProofPreFlight(deviceKey: String!, deviceKeyType: String!): EntanglementProof!
|
|
680
|
+
agentGenerate(passphrase: String!): AgentStatus!
|
|
681
|
+
agentGenerateJwt(rand: String!, requestId: String!): String!
|
|
682
|
+
agentImport(did: String!, didDocument: String!, keystore: String!, passphrase: String!): AgentStatus!
|
|
683
|
+
agentLock(passphrase: String!): AgentStatus!
|
|
684
|
+
agentPermitCapability(auth: String!): String!
|
|
685
|
+
agentRequestCapability(appDesc: String!, appName: String!, appUrl: String!, capabilities: String!): String!
|
|
686
|
+
agentSignMessage(message: String!): AgentSignature!
|
|
687
|
+
agentUnlock(passphrase: String!): AgentStatus!
|
|
688
|
+
agentUpdateDirectMessageLanguage(directMessageLanguage: String!): Agent!
|
|
689
|
+
agentUpdatePublicPerspective(perspective: PerspectiveInput!): Agent!
|
|
690
|
+
deleteTrustedAgents(agents: [String!]!): [String!]!
|
|
691
|
+
expressionCreate(content: String!, languageAddress: String!): String!
|
|
692
|
+
expressionInteract(interactionCall: InteractionCall!, url: String!): String
|
|
693
|
+
languageApplyTemplateAndPublish(sourceLanguageHash: String!, templateData: String!): LanguageRef!
|
|
694
|
+
languagePublish(languageMeta: LanguageMetaInput!, languagePath: String!): LanguageMeta!
|
|
695
|
+
languageRemove(address: String!): Boolean!
|
|
696
|
+
languageWriteSettings(languageAddress: String!, settings: String!): Boolean!
|
|
697
|
+
neighbourhoodJoinFromUrl(url: String!): PerspectiveHandle!
|
|
698
|
+
neighbourhoodPublishFromPerspective(linkLanguage: String!, meta: PerspectiveInput!, perspectiveUUID: String!): String!
|
|
699
|
+
perspectiveAdd(name: String!): PerspectiveHandle!
|
|
700
|
+
perspectiveAddLink(link: LinkInput!, uuid: String!): LinkExpression!
|
|
701
|
+
perspectiveAddLinkExpression(link: LinkExpressionInput!, uuid: String!): LinkExpression!
|
|
702
|
+
perspectiveAddLinks(links: [LinkInput!]!, uuid: String!): [LinkExpression!]!
|
|
703
|
+
perspectiveLinkMutations(mutations: LinkMutations!, uuid: String!): LinkExpressionMutations!
|
|
704
|
+
perspectivePublishSnapshot(uuid: String!): String
|
|
705
|
+
perspectiveRemove(uuid: String!): Boolean!
|
|
706
|
+
perspectiveRemoveLink(link: LinkExpressionInput!, uuid: String!): Boolean!
|
|
707
|
+
perspectiveRemoveLinks(links: [LinkExpressionInput!]!, uuid: String!): [LinkExpression!]!
|
|
708
|
+
perspectiveUpdate(name: String!, uuid: String!): PerspectiveHandle
|
|
709
|
+
perspectiveUpdateLink(newLink: LinkInput!, oldLink: LinkExpressionInput!, uuid: String!): LinkExpression!
|
|
710
|
+
runtimeAddFriends(dids: [String!]!): [String!]!
|
|
711
|
+
runtimeAddKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
712
|
+
runtimeFriendSendMessage(did: String!, message: PerspectiveInput!): Boolean!
|
|
713
|
+
runtimeHcAddAgentInfos(agentInfos: String!): Boolean!
|
|
714
|
+
runtimeOpenLink(url: String!): Boolean!
|
|
715
|
+
runtimeQuit: Boolean!
|
|
716
|
+
runtimeRemoveFriends(dids: [String!]!): [String!]!
|
|
717
|
+
runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
|
|
718
|
+
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
type Neighbourhood {
|
|
722
|
+
linkLanguage: String!
|
|
723
|
+
meta: Perspective!
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
type Perspective {
|
|
727
|
+
links: [LinkExpression!]!
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
type PerspectiveExpression {
|
|
731
|
+
author: String!
|
|
732
|
+
data: Perspective!
|
|
733
|
+
proof: ExpressionProof!
|
|
734
|
+
timestamp: String!
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
type PerspectiveHandle {
|
|
738
|
+
name: String!
|
|
739
|
+
neighbourhood: Neighbourhood
|
|
740
|
+
sharedUrl: String
|
|
741
|
+
uuid: String!
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
input PerspectiveInput {
|
|
745
|
+
links: [LinkExpressionInput!]!
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
type Query {
|
|
749
|
+
agent: Agent!
|
|
750
|
+
agentByDID(did: String!): Agent
|
|
751
|
+
agentGetApps: [Apps!]!
|
|
752
|
+
agentGetEntanglementProofs: [EntanglementProof!]!
|
|
753
|
+
agentIsLocked: Boolean!
|
|
754
|
+
agentStatus: AgentStatus!
|
|
755
|
+
expression(url: String!): ExpressionRendered
|
|
756
|
+
expressionInteractions(url: String!): [InteractionMeta!]!
|
|
757
|
+
expressionMany(urls: [String!]!): [ExpressionRendered]!
|
|
758
|
+
expressionRaw(url: String!): String
|
|
759
|
+
getTrustedAgents: [String!]!
|
|
760
|
+
language(address: String!): LanguageHandle
|
|
761
|
+
languageMeta(address: String!): LanguageMeta!
|
|
762
|
+
languageSource(address: String!): String!
|
|
763
|
+
languages(filter: String): [LanguageHandle!]!
|
|
764
|
+
perspective(uuid: String!): PerspectiveHandle
|
|
765
|
+
perspectiveQueryLinks(query: LinkQuery!, uuid: String!): [LinkExpression!]
|
|
766
|
+
perspectiveQueryProlog(query: String!, uuid: String!): String!
|
|
767
|
+
perspectiveSnapshot(uuid: String!): Perspective
|
|
768
|
+
perspectives: [PerspectiveHandle!]!
|
|
769
|
+
runtimeFriendStatus(did: String!): PerspectiveExpression
|
|
770
|
+
runtimeFriends: [String!]!
|
|
771
|
+
runtimeHcAgentInfos: String!
|
|
772
|
+
runtimeInfo: RuntimeInfo!
|
|
773
|
+
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
774
|
+
runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
|
|
775
|
+
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
776
|
+
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
type Resource {
|
|
780
|
+
domain: String!
|
|
781
|
+
pointers: [String!]!
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
type RuntimeInfo {
|
|
785
|
+
ad4mExecutorVersion: String!
|
|
786
|
+
isInitialized: Boolean!
|
|
787
|
+
isUnlocked: Boolean!
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
type SentMessage {
|
|
791
|
+
message: PerspectiveExpression!
|
|
792
|
+
recipient: String!
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
type Subscription {
|
|
796
|
+
agentStatusChanged: AgentStatus
|
|
797
|
+
agentUpdated: Agent
|
|
798
|
+
exceptionOccurred: ExceptionInfo
|
|
799
|
+
perspectiveAdded: PerspectiveHandle
|
|
800
|
+
perspectiveLinkAdded(uuid: String!): LinkExpression
|
|
801
|
+
perspectiveLinkRemoved(uuid: String!): LinkExpression
|
|
802
|
+
perspectiveRemoved: String
|
|
803
|
+
perspectiveUpdated: PerspectiveHandle
|
|
804
|
+
runtimeMessageReceived: PerspectiveExpression
|
|
805
|
+
}
|
|
806
|
+
`;function jp(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function xo(t){return Ye(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:jp().signal,mode:"no-cors"});return e.status===400||e.status===0?t:null}catch(e){throw e}})}function qp(t){let e=t.port||parseInt(localStorage.getItem("ad4minPort")||"12000"),r=t.token||localStorage.getItem("ad4minToken")||"",n=t.url||localStorage.getItem("ad4minURL")||"";return new To(Ao(Po({},t),{port:e,token:r,url:n}))}var To=class{constructor({appName:e,appDesc:r,appDomain:n,capabilities:i,port:a,token:o,url:s}){this.isFullyInitialized=!1;this.port=12e3;this.portSearchState="na";this.appName=e,this.appDesc=r,this.appDomain=n,this.capabilities=i,this.port=a||this.port,this.url=s||`ws://localhost:${this.port}/graphql`,this.token=o||this.token,this.stateListeners=[],this.configListeners=[],this.buildClient(),this.ad4mClient.agent.status().then(()=>{this.notifyStateChange("connected_with_capabilities")}),this.ad4mClient.agent.addAgentStatusChangedListener(()=>{this.checkConnection()})}onStateChange(e){this.stateListeners.push(e)}notifyStateChange(e){this.stateListeners.forEach(r=>{r(e)})}onConfigChange(e){this.configListeners.push(e)}notifyConfigChange(e,r){this.configListeners.forEach(n=>{n(e,r)})}setPort(e){this.port!==e&&(this.portSearchState="found",this.port=e,this.notifyConfigChange("port",e),this.setUrl(`ws://localhost:${this.port}/graphql`))}setUrl(e){this.url=e,this.notifyConfigChange("url",e),this.buildClient()}setToken(e){this.token!==e&&(this.token=e,this.buildClient(),this.notifyConfigChange("token",e))}connect(e){return Ye(this,null,function*(){e&&this.setUrl(e),this.notifyStateChange("loading"),this.checkConnection()})}reconnect(){return Ye(this,null,function*(){this.buildClient(),this.notifyStateChange("loading"),this.checkConnection()})}connectToPort(){return Ye(this,null,function*(){try{this.notifyStateChange("loading");let e=yield xo(this.port);if(e)this.setPort(e),yield this.checkConnection();else{this.setPortSearchState("searching");let r=yield this.findPort();r&&(this.setPort(r),yield this.checkConnection())}}catch(e){this.handleErrorMessage(e.message)}})}handleErrorMessage(e){e.includes("Capability is not matched, you have capabilities:")?this.notifyStateChange("capabilities_not_matched"):e.includes("Cannot extractByTags from a ciphered wallet. You must unlock first.")?this.notifyStateChange("agent_locked"):e.includes("signature verification failed")?this.notifyStateChange("invalid_token"):e.includes("Invalid Compact JWS")?this.notifyStateChange("invalid_token"):e.includes("JWS Protected Header is invalid")?this.notifyStateChange("invalid_token"):e.includes("Failed to fetch")?this.notifyStateChange("connection-error"):e==="Couldn't find an open port"?(this.setPortSearchState("not_found"),this.notifyStateChange("connection-error")):e==="The user aborted a request."?this.notifyStateChange("connection-error"):this.notifyStateChange("not_connected")}findPort(){return Ye(this,null,function*(){this.notifyStateChange("loading");for(let e=12e3;e<=12010;e++)try{let r=yield xo(e);if(r)return this.setPort(r),r;continue}catch(r){this.handleErrorMessage(r.message)}throw this.setPortSearchState("not_found"),Error("Couldn't find an open port")})}setPortSearchState(e){this.portSearchState=e}buildClient(){let e=new Wc(Kc({url:this.url,connectionParams:{headers:{authorization:this.token}},on:{closed:()=>{this.isFullyInitialized&&this.notifyStateChange("disconnected")}}}));this.apolloClient=new Ya({link:e,cache:new ii({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Fi(this.apolloClient)}checkConnection(){return Ye(this,null,function*(){try{yield this.ad4mClient.agent.status(),this.isFullyInitialized=!0,this.notifyStateChange("connected_with_capabilities")}catch(e){e.message===void 0?this.notifyStateChange("not_connected"):this.handleErrorMessage(e.message)}})}requestCapability(e=!1){return Ye(this,null,function*(){var r;e&&this.setToken(null);try{this.requestId=yield(r=this.ad4mClient)==null?void 0:r.agent.requestCapability(this.appName,this.appDesc,this.appDomain,JSON.stringify(this.capabilities)),this.notifyStateChange("verify_code")}catch(n){this.handleErrorMessage(n.message)}})}verifyCode(e){return Ye(this,null,function*(){var r;try{this.notifyStateChange("loading");let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);this.setToken(n),this.isFullyInitialized=!0,this.notifyStateChange("connected_with_capabilities")}catch(n){this.handleErrorMessage(n.message)}})}};function pw(t){if(window===void 0)console.log("Running ad4m-connect in node.js");else return console.log("Running ad4m-connect in browser"),qp(t)}export{pw as ad4mConnect};
|
|
807
|
+
//! @fayeed - make it support node.js
|