@coasys/ad4m-connect 0.12.0-rc1-dev → 0.12.0-rc1-dev.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/core.js CHANGED
@@ -48,7 +48,7 @@ For more information about these options, please refer to the documentation:
48
48
  `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
49
49
  `)),e=e.replace(/\n$/,""),e},ur=function(r){Ne(e,r);function e(t){var n=t.graphQLErrors,i=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||vg(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var pe;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(pe||(pe={}));function Nr(r){return r?r<7:!1}var bg=Object.assign,Sg=Object.hasOwnProperty,No=function(r){Ne(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(y){try{var _=y._subscription._observer;_&&!_.error&&(_.error=_g)}catch{}var S=!o.observers.size;o.observers.add(y);var w=o.last;return w&&w.error?y.error&&y.error(w.error):w&&w.result&&y.next&&y.next(w.result),S&&o.reobserve().catch(function(){}),function(){o.observers.delete(y)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?l:f:p;o.options=x(x({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=i.queryId||n.generateQueryId();var m=Wt(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(n,i){var a={next:function(s){n(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||pe.ready,a=x(x({},n),{loading:Nr(i),networkStatus:i}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Ie(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===pe.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=pe.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Zc(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ie(this.last.result,t)||n&&!Ie(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ie(i.variables,this.variables)))return i[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&t&&Sg.call(t,"variables")){var o=Vi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&F.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.value)||JSON.stringify(o),`, which does not declare a $variables variable.
50
50
  Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ie(this.options.variables,t)&&(i.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,pe.refetch)},e.prototype.fetchMore=function(t){var n=this,i=x(x({},t.query?t:x(x(x(x({},this.options),{query:this.query}),t),{variables:x(x({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=pe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,pe.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===pe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Yc(n)})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&F.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ie(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},pe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:s}):t==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,n)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?F(a,"Attempted to start a polling query without a polling interval."):F(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Nr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},pe.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,n){return n===void 0&&(n=this.variables),this.last=x(x({},this.last),{result:this.queryManager.assumeImmutableResults?t:so(t),variables:n}),Me(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===pe.refetch||n===pe.fetchMore||n===pe.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Tr(this.options,t||{}),u=a?c:bg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ie(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=pe.setVariables)));var l=u.variables&&x({},u.variables),d=this.fetch(u,n),f={next:function(p){i.reportResult(p,l)},error:function(p){i.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),cn(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:pe.error,loading:!1});this.updateLastResult(i,n),cn(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(X);uo(No);function Yc(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):t}}):r.reobserve()}function _g(r){__DEV__&&F.error("Unhandled error",r.message,r.stack)}function Zc(r){__DEV__&&r&&__DEV__&&F.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Do=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=pc(t.resolvers,n)}):this.resolvers=pc(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Lt(this,void 0,void 0,function(){return Ft(this,function(c){return t?[2,this.resolveDocument(t,n.data,i,a,this.fragmentMatcher,s).then(function(u){return x(x({},n),{data:u.result})})]:[2,n]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return lc(e)},r.prototype.prepareContext=function(e){var t=this.cache;return x(x({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),Lt(this,void 0,void 0,function(){return Ft(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then(function(a){return x(x({},t),a.exportedVariables)})]:[2,x({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Xe(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return en}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:uc(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Lt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,y,_;return Ft(this,function(S){return s=an(e),c=nn(e),u=tn(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:u,context:x(x({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,y).then(function(w){return{result:w,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Ft(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(f){return Lt(l,void 0,void 0,function(){var p,h;return Ft(this,function(m){return!t&&!i.selectionsToResolve.has(f)?[2]:sr(f,s)?gt(f)?[2,this.resolveField(f,t,n,i).then(function(y){var _;typeof y<"u"&&c.push((_={},_[Tt(f)]=y,_))})]:(ac(f)?p=f:(p=a[f.name.value],__DEV__?F(p,"No fragment named ".concat(f.name.value)):F(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,n,i).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Ft(this,function(m){return n?(a=i.variables,o=e.name.value,s=Tt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(ai.withValue(this.cache,p,[n,cr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(y){var _,S;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(A){A.name.value==="as"&&A.value.kind==="StringValue"&&(i.exportedVariables[A.value.value]=y)})}),!e.selectionSet||y==null)return y;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(v){return v.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||w,y,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||w,y,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),Xe(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){n(p)&&ji(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?F(p,"No fragment named ".concat(c.name.value)):F(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){n(m)&&ji(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var si=new(kt?WeakMap:Map);function Xc(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return si.set(r,(si.get(r)+1)%1e15),t.apply(this,arguments)})}function ef(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Co=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;si.has(n)||(si.set(n,0),Xc(n,"evict"),Xc(n,"modify"),Xc(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||pe.loading;return this.variables&&this.networkStatus!==pe.loading&&!Ie(this.variables,e.variables)&&(t=pe.setVariables),Ie(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){ef(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ie(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(t);return this.updateLastDiff(i,t),i},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ie(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=t.getDiff();n.fromOptimisticTransaction?e.observe():Yc(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;ef(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Nr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=x(x({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ie(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===si.get(this.cache)&&Ie(t,n.variables)&&Ie(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new ut,s=Me(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Me(e.incremental)){var c=lo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Ro(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:si.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),f=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=pe.ready},r.prototype.markError=function(e){return this.networkStatus=pe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Ro(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ei(r);return!n&&t&&r.data&&(n=!0),n}var wg=Object.prototype.hasOwnProperty,tf=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(kt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new Do({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new G("QueryManager stopped while query was in flight"):new G(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,_=y===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":y,S=e.keepRootFields,w=e.context;return Lt(this,void 0,void 0,function(){var v,A,R,E,P,L;return Ft(this,function(C){switch(C.label){case 0:return __DEV__?F(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):F(i,15),__DEV__?F(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):F(m==="network-only"||m==="no-cache",16),v=this.generateMutationId(),A=this.transform(i),R=A.document,E=A.hasClientExports,i=this.cache.transformForLink(R),a=this.getVariables(i,a),E?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=C.sent(),C.label=2;case 2:return P=this.mutationStore&&(this.mutationStore[v]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:f,keepRootFields:S}),this.broadcastQueries(),L=this,[2,new Promise(function(T,xe){return co(L.getObservableFromLink(i,x(x({},w),{optimisticResponse:o}),a,!1),function(ne){if(ei(ne)&&_==="none")throw new ur({graphQLErrors:po(ne)});P&&(P.loading=!1,P.error=null);var M=x({},ne);return typeof u=="function"&&(u=u(M)),_==="ignore"&&ei(M)&&delete M.errors,L.markMutationResult({mutationId:v,result:M,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:S})}).subscribe({next:function(ne){L.broadcastQueries(),(!("hasNext"in ne)||ne.hasNext===!1)&&T(ne)},error:function(ne){P&&(P.loading=!1,P.error=ne),o&&L.cache.removeOptimistic(v),L.broadcastQueries(),xe(ne instanceof ur?ne:new ur({networkError:ne}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Ro(i,e.errorPolicy)){if(Ir(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ir(i)&&Me(i.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=lo(s.result,i)),typeof c<"u"&&(i.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!wg.call(u,h))){var m=u[h],y=n.queries.get(f),_=y.document,S=y.variables,w=t.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),v=w.result,A=w.complete;if(A&&v){var R=m(v,{mutationResult:i,queryName:_&&Jn(_)||void 0,queryVariables:S});R&&a.push({result:R,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Ml(i)||Ir(i)&&!i.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=x(x({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&f(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,y){var _=y.fieldName,S=y.DELETE;return _==="__typename"?m:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(x(x({},t),{result:{data:i}}),a)}catch(o){__DEV__&&F.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,n){return this.fetchQueryObservable(e,t,n).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var n=this.cache.transformDocument(e),i=cc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:tc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:on(Wt(n)),asQuery:x(x({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?x(x({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(n),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return x(x({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=x(x({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Co(this),n=new No({queryManager:this,queryInfo:t,options:e});return this.queries.set(n.queryId,t),t.init({document:n.query,observableQuery:n,variables:n.variables}),n},r.prototype.query=function(e,t){var n=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?F(e.query,"query option is required. You must specify your GraphQL document in the query option."):F(e.query,17),__DEV__?F(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):F(e.query.kind==="Document",18),__DEV__?F(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):F(!e.returnPartialData,19),__DEV__?F(!e.pollInterval,"pollInterval option only supported on watchQuery."):F(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return n.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new G("Store reset while query was in flight (not completed in link chain)"):new G(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=pe.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):nc(o)?i.set(t.transform(o).document,!1):se(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Gi("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new No({queryManager:t,queryInfo:c,options:x(x({},o),{fetchPolicy:"network-only"})});F(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&F.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(d){return t.getObservableFromLink(n,c,d).map(function(f){if(i!=="no-cache"&&(Ro(f,a)&&t.cache.write({query:n,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),ei(f))throw new ur({graphQLErrors:f.errors});return f})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new X(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:n,operationName:Jn(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!i}))};if(t=f.context,i){var p=l.get(c)||new Map;l.set(c,p);var h=yt(n);if(s=p.get(h),!s){var m=new Xn([ti(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new Xn([ti(d,f)])}else s=new Xn([X.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=co(s,function(_){return a.localState.runResolvers({document:y,remoteResult:_,context:t,variables:n})})),s},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return co(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=po(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new ur({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:pe.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=pe.error),u},function(o){var s=Xp(o)?o:new ur({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=pe.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,_=t.context,S=_===void 0?{}:_,w=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:y,context:S}),v=function(E){w.variables=E;var P=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&P.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),P},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){A(),setTimeout(function(){return R.cancel(E)})});var R=new Xn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(v):v(w.variables));return R.promise.then(A,A),R},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Gi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof Co&&f.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var y=u(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&d.set(m,y),y}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,y=f.diff,_;if(u){if(!y){var S=h.queryInfo;S.reset(),y=S.getDiff()}_=u(h,y,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(v,A){A===void 0&&(A=e.networkStatus||pe.loading);var R=v.result;__DEV__&&!l&&!Ie(R,{})&&Zc(v.missing);var E=function(P){return X.of(x({data:P,loading:Nr(A),networkStatus:A},v.complete?null:{partial:!0}))};return R&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(P){return E(P.data||void 0)}):u==="none"&&A===pe.refetch&&Array.isArray(v.missing)?E(void 0):E(R)},y=s==="no-cache"?0:n===pe.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,y,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},S=f&&typeof p=="number"&&p!==n&&Nr(n);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Co(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return x(x({},t),{clientAwareness:this.clientAwareness})},r}();var rf=!1;var eu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,_=y===void 0?!1:y,S=e.resolvers,w=e.typeDefs,v=e.fragmentMatcher,A=e.name,R=e.version,E=e.link;if(E||(E=n?new Ac({uri:n,credentials:i,headers:a}):At.empty()),!o)throw __DEV__?new G(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
51
- For more information, please visit: https://go.apollo.dev/c/docs`):new G(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!rf&&f&&__DEV__&&(rf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var P=window.navigator,L=P&&P.userAgent,C=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?C="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(C="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),C&&__DEV__&&F.log("Download the Apollo DevTools for a better development experience: "+C)}this.version=Bl,this.localState=new Do({cache:o,client:this,resolvers:S,fragmentMatcher:v}),this.queryManager=new tf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:R},localState:this.localState,assumeImmutableResults:_,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?F(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):F(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return ti(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&F.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();hl(Xr?"log":"silent");function rt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function lr(r){return rt(r)==="object"}function nf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function tu(r,e){return r.length<124?r:e}var af="graphql-transport-ws";var lt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(lt||(lt={}));var Ce;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Ce||(Ce={}));function of(r){if(!lr(r))throw new Error(`Message is expected to be an object, but got ${rt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${rt(r.type)}`);switch(r.type){case Ce.ConnectionInit:case Ce.ConnectionAck:case Ce.Ping:case Ce.Pong:{if(r.payload!=null&&!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Ce.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${rt(r.payload.query)}`);if(r.payload.variables!=null&&!lr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${rt(r.payload.variables)}`);if(r.payload.operationName!=null&&rt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${rt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!lr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${rt(r.payload.extensions)}`);break}case Ce.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);break}case Ce.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!nf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Ce.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function sf(r,e){return of(typeof r=="string"?JSON.parse(r,e):r)}function ci(r,e){return of(r),JSON.stringify(r,e)}function ru(r){let{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ve){let be=1e3;for(let ae=0;ae<ve;ae++)be*=2;await new Promise(ae=>setTimeout(ae,be+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Po,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ve=>{let be=Math.random()*16|0;return(ve=="x"?be:be&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:_}=r,S;if(h){if(!xg(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,v=(()=>{let M=(()=>{let be={};return{on(ae,oe){return be[ae]=oe,()=>{delete be[ae]}},emit(ae){var oe;"id"in ae&&((oe=be[ae.id])===null||oe===void 0||oe.call(be,ae))}}})(),ve={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(be,ae){let oe=ve[be];return oe.push(ae),()=>{oe.splice(oe.indexOf(ae),1)}},emit(be,...ae){for(let oe of[...ve[be]])oe(...ae)}}})();function A(M){let ve=[v.on("error",be=>{ve.forEach(ae=>ae()),M(be)}),v.on("closed",be=>{ve.forEach(ae=>ae()),M(be)})]}let R,E=0,P,L=!1,C=0,T=!1;async function xe(){clearTimeout(P);let[M,ve]=await(R??(R=new Promise((oe,Bt)=>(async()=>{if(L){if(await l(C),!E)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});C++}v.emit("connecting");let Z=new w(typeof e=="function"?await e():e,af),Vt,Sr;function Ja(){isFinite(o)&&o>0&&(clearTimeout(Sr),Sr=setTimeout(()=>{Z.readyState===w.OPEN&&(Z.send(ci({type:Ce.Ping})),v.emit("ping",!1,void 0))},o))}A(Ge=>{R=void 0,clearTimeout(Vt),clearTimeout(Sr),Bt(Ge),Po(Ge)&&Ge.code===4499&&(Z.close(4499,"Terminated"),Z.onerror=null,Z.onclose=null)}),Z.onerror=Ge=>v.emit("error",Ge),Z.onclose=Ge=>v.emit("closed",Ge),Z.onopen=async()=>{try{v.emit("opened",Z);let Ge=typeof t=="function"?await t():t;if(Z.readyState!==w.OPEN)return;Z.send(ci(Ge?{type:Ce.ConnectionInit,payload:Ge}:{type:Ce.ConnectionInit},y)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{Z.close(lt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ja()}catch(Ge){v.emit("error",Ge),Z.close(lt.InternalClientError,tu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Internal client error"))}};let Wn=!1;Z.onmessage=({data:Ge})=>{try{let Ke=sf(Ge,_);if(v.emit("message",Ke),Ke.type==="ping"||Ke.type==="pong"){v.emit(Ke.type,!0,Ke.payload),Ke.type==="pong"?Ja():s||(Z.send(ci(Ke.payload?{type:Ce.Pong,payload:Ke.payload}:{type:Ce.Pong})),v.emit("pong",!1,Ke.payload));return}if(Wn)return;if(Ke.type!==Ce.ConnectionAck)throw new Error(`First message cannot be of type ${Ke.type}`);clearTimeout(Vt),Wn=!0,v.emit("connected",Z,Ke.payload),L=!1,C=0,oe([Z,new Promise((WS,Ch)=>A(Ch))])}catch(Ke){Z.onmessage=null,v.emit("error",Ke),Z.close(lt.BadResponse,tu(Ke instanceof Error?Ke.message:new Error(Ke).message,"Bad response"))}}})())));M.readyState===w.CLOSING&&await ve;let be=()=>{},ae=new Promise(oe=>be=oe);return[M,be,Promise.race([ae.then(()=>{if(!E){let oe=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?P=setTimeout(()=>{M.readyState===w.OPEN&&oe()},a):oe()}}),ve])]}function ne(M){if(Po(M)&&(Eg(M.code)||[lt.InternalServerError,lt.InternalClientError,lt.BadRequest,lt.BadResponse,lt.Unauthorized,lt.SubprotocolNotAcceptable,lt.SubscriberAlreadyExists,lt.TooManyInitialisationRequests].includes(M.code)))throw M;if(T)return!1;if(Po(M)&&M.code===1e3)return E>0;if(!u||C>=u||!d(M)||f?.(M))throw M;return L=!0}return n||(async()=>{for(E++;;)try{let[,,M]=await xe();await M}catch(M){try{if(!ne(M))return}catch(ve){return i?.(ve)}}})(),{on:v.on,subscribe(M,ve){let be=m(M),ae=!1,oe=!1,Bt=()=>{E--,ae=!0};return(async()=>{for(E++;;)try{let[Z,Vt,Sr]=await xe();if(ae)return Vt();let Ja=v.onMessage(be,Wn=>{switch(Wn.type){case Ce.Next:{ve.next(Wn.payload);return}case Ce.Error:{oe=!0,ae=!0,ve.error(Wn.payload),Bt();return}case Ce.Complete:{ae=!0,Bt();return}}});Z.send(ci({id:be,type:Ce.Subscribe,payload:M},y)),Bt=()=>{!ae&&Z.readyState===w.OPEN&&Z.send(ci({id:be,type:Ce.Complete},y)),E--,ae=!0,Vt()},await Sr.finally(Ja);return}catch(Z){if(!ne(Z))return}})().then(()=>{oe||ve.complete()}).catch(Z=>{ve.error(Z)}),()=>{ae||Bt()}},async dispose(){if(T=!0,R){let[M]=await R;M.close(1e3,"Normal Closure")}},terminate(){R&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Po(r){return lr(r)&&"code"in r&&"reason"in r}function Eg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function xg(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Ig(r){return se(r)&&"code"in r&&"reason"in r}var cf=function(r){Ne(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new X(function(i){return n.client.subscribe(x(x({},t),{query:Gn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Ig(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Lo="0.12.0-rc1-dev";function uf(){return typeof window!="undefined"&&window.self!==window.top}function nu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function pr(r,e){nu()&&localStorage.setItem(`${Lo}/${r}`,e)}function Fo(r){return nu()?localStorage.getItem(`${Lo}/${r}`):null}function ra(r){nu()&&localStorage.removeItem(`${Lo}/${r}`)}function lf(r,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,n)=>{let i;try{i=new WebSocket(r,"graphql-transport-ws"),i.onopen=()=>{i.close(),t(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((t,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(t){return typeof t}:Jo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jo(r)}function kg(r){return Jo(r)=="object"&&r!==null}var Dd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Eu(r,e){for(var t=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=t.exec(r.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Ag(r){return Cd(r.source,Eu(r.source,r.start))}function Cd(r,e){var t=r.locationOffset.column-1,n=Yo(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
51
+ For more information, please visit: https://go.apollo.dev/c/docs`):new G(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!rf&&f&&__DEV__&&(rf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var P=window.navigator,L=P&&P.userAgent,C=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?C="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(C="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),C&&__DEV__&&F.log("Download the Apollo DevTools for a better development experience: "+C)}this.version=Bl,this.localState=new Do({cache:o,client:this,resolvers:S,fragmentMatcher:v}),this.queryManager=new tf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:R},localState:this.localState,assumeImmutableResults:_,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?F(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):F(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return ti(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&F.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();hl(Xr?"log":"silent");function rt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function lr(r){return rt(r)==="object"}function nf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function tu(r,e){return r.length<124?r:e}var af="graphql-transport-ws";var lt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(lt||(lt={}));var Ce;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Ce||(Ce={}));function of(r){if(!lr(r))throw new Error(`Message is expected to be an object, but got ${rt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${rt(r.type)}`);switch(r.type){case Ce.ConnectionInit:case Ce.ConnectionAck:case Ce.Ping:case Ce.Pong:{if(r.payload!=null&&!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Ce.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${rt(r.payload.query)}`);if(r.payload.variables!=null&&!lr(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${rt(r.payload.variables)}`);if(r.payload.operationName!=null&&rt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${rt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!lr(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${rt(r.payload.extensions)}`);break}case Ce.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);break}case Ce.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!nf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Ce.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function sf(r,e){return of(typeof r=="string"?JSON.parse(r,e):r)}function ci(r,e){return of(r),JSON.stringify(r,e)}function ru(r){let{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ve){let be=1e3;for(let ae=0;ae<ve;ae++)be*=2;await new Promise(ae=>setTimeout(ae,be+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Po,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ve=>{let be=Math.random()*16|0;return(ve=="x"?be:be&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:_}=r,S;if(h){if(!xg(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,v=(()=>{let M=(()=>{let be={};return{on(ae,oe){return be[ae]=oe,()=>{delete be[ae]}},emit(ae){var oe;"id"in ae&&((oe=be[ae.id])===null||oe===void 0||oe.call(be,ae))}}})(),ve={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(be,ae){let oe=ve[be];return oe.push(ae),()=>{oe.splice(oe.indexOf(ae),1)}},emit(be,...ae){for(let oe of[...ve[be]])oe(...ae)}}})();function A(M){let ve=[v.on("error",be=>{ve.forEach(ae=>ae()),M(be)}),v.on("closed",be=>{ve.forEach(ae=>ae()),M(be)})]}let R,E=0,P,L=!1,C=0,T=!1;async function xe(){clearTimeout(P);let[M,ve]=await(R??(R=new Promise((oe,Bt)=>(async()=>{if(L){if(await l(C),!E)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});C++}v.emit("connecting");let Z=new w(typeof e=="function"?await e():e,af),Vt,Sr;function Ja(){isFinite(o)&&o>0&&(clearTimeout(Sr),Sr=setTimeout(()=>{Z.readyState===w.OPEN&&(Z.send(ci({type:Ce.Ping})),v.emit("ping",!1,void 0))},o))}A(Ge=>{R=void 0,clearTimeout(Vt),clearTimeout(Sr),Bt(Ge),Po(Ge)&&Ge.code===4499&&(Z.close(4499,"Terminated"),Z.onerror=null,Z.onclose=null)}),Z.onerror=Ge=>v.emit("error",Ge),Z.onclose=Ge=>v.emit("closed",Ge),Z.onopen=async()=>{try{v.emit("opened",Z);let Ge=typeof t=="function"?await t():t;if(Z.readyState!==w.OPEN)return;Z.send(ci(Ge?{type:Ce.ConnectionInit,payload:Ge}:{type:Ce.ConnectionInit},y)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{Z.close(lt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ja()}catch(Ge){v.emit("error",Ge),Z.close(lt.InternalClientError,tu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Internal client error"))}};let Wn=!1;Z.onmessage=({data:Ge})=>{try{let Ke=sf(Ge,_);if(v.emit("message",Ke),Ke.type==="ping"||Ke.type==="pong"){v.emit(Ke.type,!0,Ke.payload),Ke.type==="pong"?Ja():s||(Z.send(ci(Ke.payload?{type:Ce.Pong,payload:Ke.payload}:{type:Ce.Pong})),v.emit("pong",!1,Ke.payload));return}if(Wn)return;if(Ke.type!==Ce.ConnectionAck)throw new Error(`First message cannot be of type ${Ke.type}`);clearTimeout(Vt),Wn=!0,v.emit("connected",Z,Ke.payload),L=!1,C=0,oe([Z,new Promise((WS,Ch)=>A(Ch))])}catch(Ke){Z.onmessage=null,v.emit("error",Ke),Z.close(lt.BadResponse,tu(Ke instanceof Error?Ke.message:new Error(Ke).message,"Bad response"))}}})())));M.readyState===w.CLOSING&&await ve;let be=()=>{},ae=new Promise(oe=>be=oe);return[M,be,Promise.race([ae.then(()=>{if(!E){let oe=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?P=setTimeout(()=>{M.readyState===w.OPEN&&oe()},a):oe()}}),ve])]}function ne(M){if(Po(M)&&(Eg(M.code)||[lt.InternalServerError,lt.InternalClientError,lt.BadRequest,lt.BadResponse,lt.Unauthorized,lt.SubprotocolNotAcceptable,lt.SubscriberAlreadyExists,lt.TooManyInitialisationRequests].includes(M.code)))throw M;if(T)return!1;if(Po(M)&&M.code===1e3)return E>0;if(!u||C>=u||!d(M)||f?.(M))throw M;return L=!0}return n||(async()=>{for(E++;;)try{let[,,M]=await xe();await M}catch(M){try{if(!ne(M))return}catch(ve){return i?.(ve)}}})(),{on:v.on,subscribe(M,ve){let be=m(M),ae=!1,oe=!1,Bt=()=>{E--,ae=!0};return(async()=>{for(E++;;)try{let[Z,Vt,Sr]=await xe();if(ae)return Vt();let Ja=v.onMessage(be,Wn=>{switch(Wn.type){case Ce.Next:{ve.next(Wn.payload);return}case Ce.Error:{oe=!0,ae=!0,ve.error(Wn.payload),Bt();return}case Ce.Complete:{ae=!0,Bt();return}}});Z.send(ci({id:be,type:Ce.Subscribe,payload:M},y)),Bt=()=>{!ae&&Z.readyState===w.OPEN&&Z.send(ci({id:be,type:Ce.Complete},y)),E--,ae=!0,Vt()},await Sr.finally(Ja);return}catch(Z){if(!ne(Z))return}})().then(()=>{oe||ve.complete()}).catch(Z=>{ve.error(Z)}),()=>{ae||Bt()}},async dispose(){if(T=!0,R){let[M]=await R;M.close(1e3,"Normal Closure")}},terminate(){R&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Po(r){return lr(r)&&"code"in r&&"reason"in r}function Eg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function xg(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Ig(r){return se(r)&&"code"in r&&"reason"in r}var cf=function(r){Ne(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new X(function(i){return n.client.subscribe(x(x({},t),{query:Gn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Ig(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Lo="0.12.0-rc1-dev.1";function uf(){return typeof window!="undefined"&&window.self!==window.top}function nu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function pr(r,e){nu()&&localStorage.setItem(`${Lo}/${r}`,e)}function Fo(r){return nu()?localStorage.getItem(`${Lo}/${r}`):null}function ra(r){nu()&&localStorage.removeItem(`${Lo}/${r}`)}function lf(r,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,n)=>{let i;try{i=new WebSocket(r,"graphql-transport-ws"),i.onopen=()=>{i.close(),t(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((t,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(t){return typeof t}:Jo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jo(r)}function kg(r){return Jo(r)=="object"&&r!==null}var Dd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Eu(r,e){for(var t=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=t.exec(r.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Ag(r){return Cd(r.source,Eu(r.source,r.start))}function Cd(r,e){var t=r.locationOffset.column-1,n=Yo(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
52
52
  `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+pf([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(y){return["",y]}),[[" ",Yo(p-1)+"^"],["",h[f+1]]]))}return u+pf([["".concat(o-1),l[i-1]],["".concat(o),d],["",Yo(c-1)+"^"],["".concat(o+1),l[i+1]]])}function pf(r){var e=r.filter(function(n){n[0];var i=n[1];return i!==void 0}),t=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return Og(t,i)+(a?" | "+a:" |")}).join(`
53
53
  `)}function Yo(r){return Array(r+1).join(" ")}function Og(r,e){return Yo(r-e.length)+e}function Zo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(t){return typeof t}:Zo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(r)}function ff(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ng(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ff(Object(t),!0).forEach(function(n){Dg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ff(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Dg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function df(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Rg(r,e,t){return e&&df(r.prototype,e),t&&df(r,t),r}function Pg(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&Oa(r,e)}function Lg(r){var e=Pd();return function(){var n=Na(r),i;if(e){var a=Na(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(r,e){return e&&(Zo(e)==="object"||typeof e=="function")?e:sa(r)}function sa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xu(r){var e=typeof Map=="function"?new Map:void 0;return xu=function(n){if(n===null||!Fg(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return Xo(n,arguments,Na(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Oa(i,n)},xu(r)}function Xo(r,e,t){return Pd()?Xo=Reflect.construct:Xo=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Oa(u,o.prototype),u},Xo.apply(null,arguments)}function Pd(){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 Fg(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Oa(r,e){return Oa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Oa(r,e)}function Na(r){return Na=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Na(r)}var $g=function(r){Pg(t,r);var e=Lg(t);function t(n,i,a,o,s,c,u){var l,d,f,p;Cg(this,t),p=e.call(this,n),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=hf(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,y=(_=p.nodes)!==null&&_!==void 0?_:[];m<y.length;m++){var _,S=y[m],w=S.loc;w!=null&&h.push(w)}h=hf(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(A){return A.start})),p.locations=o&&a?o.map(function(A){return Eu(a,A)}):(f=h)===null||f===void 0?void 0:f.map(function(A){return Eu(A.source,A.start)}),p.path=s??void 0;var v=c?.extensions;return u==null&&kg(v)?p.extensions=Ng({},v):p.extensions=u??{},Object.defineProperties(sa(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(sa(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Rd(p)):(Error.captureStackTrace?Error.captureStackTrace(sa(p),t):Object.defineProperty(sa(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return Rg(t,[{key:"toString",value:function(){return Mg(this)}},{key:Dd,get:function(){return"Object"}}]),t}(xu(Error));function hf(r){return r===void 0||r.length===0?void 0:r}function Mg(r){var e=r.message;if(r.nodes)for(var t=0,n=r.nodes;t<n.length;t++){var i=n[t];i.loc&&(e+=`
54
54
 
@@ -1563,7 +1563,7 @@ input VoiceActivityParamsInput {
1563
1563
  FROM link
1564
1564
  WHERE in.uri = ${e.formatSurrealValue(re(this,tt,"f"))}
1565
1565
  ORDER BY timestamp ASC
1566
- `,a=await re(this,Te,"f").querySurrealDB(i);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,d]of Object.entries(t.properties)){if(d.getter)continue;let f=a.filter(p=>p.predicate===d.predicate);if(f.length>0){let p=f[f.length-1],h=p.target;if(p.timestamp&&((!o||p.timestamp<o)&&(o=p.timestamp,u=p.author),(!s||p.timestamp>s)&&(s=p.timestamp,c=p.author)),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await re(this,Te,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let m=ye.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}d.transform&&typeof d.transform=="function"&&(h=d.transform(h)),this[l]=h}}for(let[l,d]of Object.entries(t.collections)){if(d.getter)continue;let p=a.filter(h=>h.predicate===d.predicate).map(h=>h.target);if(d.where?.condition&&p.length>0)try{let h=[];for(let m of p){let y=d.where.condition.replace(/\$perspective/g,`'${re(this,Te,"f").uuid}'`).replace(/\$base/g,`'${re(this,tt,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);y.trim().startsWith("WHERE")&&(y=`array::len(SELECT * FROM link ${y}) > 0`);let _=`RETURN ${y}`,S=await re(this,Te,"f").querySurrealDB(_);(S===!0||Array.isArray(S)&&S.length>0&&S[0]===!0)&&h.push(m)}p=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(d.where?.isInstance&&p.length>0)try{let h=typeof d.where.isInstance=="string"?d.where.isInstance:d.where.isInstance.name,m=await re(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await re(this,Te,"f").batchCheckSubjectInstances(p,m))}catch{}this[l]=p}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,re(this,Te,"f"),t);for(let[o,s]of Object.entries(t.collections))if(s.getter&&s.where?.isInstance&&this[o]?.length>0)try{let c=typeof s.where.isInstance=="string"?s.where.isInstance:s.where.isInstance.name,u=await re(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await re(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${re(this,tt,"f")}:`,e)}return this}static async queryToProlog(e,t,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=t,f=n||await this.getClassName(e),p=[wd(),_d(i),qS(a),BS(o),Ed(s)],h=[xd(d),Id(c),Td(u),kd(l)];return`
1566
+ `,a=await re(this,Te,"f").querySurrealDB(i);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,d]of Object.entries(t.properties)){if(d.getter)continue;let f=a.filter(p=>p.predicate===d.predicate);if(f.length>0){let p=f[f.length-1],h=p.target;if(p.timestamp&&((!o||p.timestamp<o)&&(o=p.timestamp,u=p.author),(!s||p.timestamp>s)&&(s=p.timestamp,c=p.author)),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await re(this,Te,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(d.resolveLanguage==="literal"&&typeof h=="string"&&h.startsWith("literal://"))try{let m=ye.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}d.transform&&typeof d.transform=="function"&&(h=d.transform(h)),this[l]=h}}for(let[l,d]of Object.entries(t.collections)){if(d.getter)continue;let p=a.filter(h=>h.predicate===d.predicate).map(h=>h.target);if(d.where?.condition&&p.length>0)try{let h=[];for(let m of p){let y=d.where.condition.replace(/\$perspective/g,`'${re(this,Te,"f").uuid}'`).replace(/\$base/g,`'${re(this,tt,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);y.trim().startsWith("WHERE")&&(y=`array::len(SELECT * FROM link ${y}) > 0`);let _=`RETURN ${y}`,S=await re(this,Te,"f").querySurrealDB(_);(S===!0||Array.isArray(S)&&S.length>0&&S[0]===!0)&&h.push(m)}p=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(d.where?.isInstance&&p.length>0)try{let h=typeof d.where.isInstance=="string"?d.where.isInstance:d.where.isInstance.name,m=await re(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await re(this,Te,"f").batchCheckSubjectInstances(p,m))}catch{}this[l]=p}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,re(this,Te,"f"),t);for(let[o,s]of Object.entries(t.collections))if(s.getter&&s.where?.isInstance&&this[o]?.length>0)try{let c=typeof s.where.isInstance=="string"?s.where.isInstance:s.where.isInstance.name,u=await re(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await re(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${re(this,tt,"f")}:`,e)}return this}static async queryToProlog(e,t,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=t,f=n||await this.getClassName(e),p=[wd(),_d(i),qS(a),BS(o),Ed(s)],h=[xd(d),Id(c),Td(u),kd(l)];return`
1567
1567
  findall([Base, Properties, Collections, Timestamp, Author], (
1568
1568
  subject_class("${f}", SubjectClass),
1569
1569
  instance(SubjectClass, Base),
package/dist/index.js CHANGED
@@ -48,7 +48,7 @@ For more information about these options, please refer to the documentation:
48
48
  `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
49
49
  `)),e=e.replace(/\n$/,""),e},xr=function(r){Re(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||Zy(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var he;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(he||(he={}));function zr(r){return r?r<7:!1}var Yy=Object.assign,Xy=Object.hasOwnProperty,ms=function(r){Re(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(y){try{var S=y._subscription._observer;S&&!S.error&&(S.error=ev)}catch{}var w=!o.observers.size;o.observers.add(y);var _=o.last;return _&&_.error?y.error&&y.error(_.error):_&&_.result&&y.next&&y.next(_.result),w&&o.reobserve().catch(function(){}),function(){o.observers.delete(y)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,f=a.fetchPolicy,d=f===void 0?l:f,p=a.initialFetchPolicy,h=p===void 0?d==="standby"?l:d:p;o.options=x(x({},a),{initialFetchPolicy:h,fetchPolicy:d}),o.queryId=n.queryId||i.generateQueryId();var m=or(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||he.ready,a=x(x({},i),{loading:zr(n),networkStatus:n}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),ke(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===he.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=he.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Wu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!ke(this.last.result,t)||i&&!ke(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||ke(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&Xy.call(t,"variables")){var o=Sa(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&P.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
50
50
  Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!ke(this.options.variables,t)&&(n.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,he.refetch)},e.prototype.fetchMore=function(t){var i=this,n=x(x({},t.query?t:x(x(x(x({},this.options),{query:this.query}),t),{variables:x(x({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=he.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,he.fetchMore).then(function(u){return i.queryManager.removeQuery(a),o.networkStatus===he.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var f=t.updateQuery;f?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(d){return f(d,{fetchMoreResult:u.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(i.query)||zu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&P.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return ke(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},he.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?P(a,"Attempted to start a polling query without a polling interval."):P(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(zr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},he.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=x(x({},this.last),{result:this.queryManager.assumeImmutableResults?t:Ho(t),variables:i}),Be(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===he.refetch||i===he.fetchMore||i===he.poll,o=this.options.variables,s=this.options.fetchPolicy,c=qr(this.options,t||{}),u=a?c:Yy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!ke(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),i===void 0&&(i=he.setVariables)));var l=u.variables&&x({},u.variables),f=this.fetch(u,i),d={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=d),f.addObserver(d),f.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Ai(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:he.error,loading:!1});this.updateLastResult(n,i),Ai(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(re);Ko(ms);function zu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function ev(r){__DEV__&&P.error("Unhandled error",r.message,r.stack)}function Wu(r){__DEV__&&r&&__DEV__&&P.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var gs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=au(t.resolvers,i)}):this.resolvers=au(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ht(this,void 0,void 0,function(){return Gt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(u){return x(x({},i),{data:u.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return bn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return nu(e)},r.prototype.prepareContext=function(e){var t=this.cache;return x(x({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Ht(this,void 0,void 0,function(){return Gt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return x(x({},t),a.exportedVariables)})]:[2,x({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return at(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return vi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:iu(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ht(this,void 0,void 0,function(){var s,c,u,l,f,d,p,h,m,y,S;return Gt(this,function(w){return s=_i(e),c=Si(e),u=bi(c),l=this.collectSelectionsToResolve(s,u),f=s.operation,d=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:u,context:x(x({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},S=!1,[2,this.resolveSelectionSet(s.selectionSet,S,t,y).then(function(_){return{result:_,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Gt(this,function(f){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],u=function(d){return Ht(l,void 0,void 0,function(){var p,h;return Gt(this,function(m){return!t&&!n.selectionsToResolve.has(d)?[2]:_r(d,s)?At(d)?[2,this.resolveField(d,t,i,n).then(function(y){var S;typeof y<"u"&&c.push((S={},S[Mt(d)]=y,S))})]:(Xc(d)?p=d:(p=a[d.name.value],__DEV__?P(p,"No fragment named ".concat(d.name.value)):P(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return _a(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l,f,d,p,h=this;return Gt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Mt(e),c=o!==s,u=i[s]||i[o],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(f=i.__typename||n.defaultOperationType,d=this.resolvers&&this.resolvers[f],d&&(p=d[c?o:s],p&&(l=Promise.resolve(Cn.withValue(this.cache,p,[i,Er(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(y){var S,w;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(n.exportedVariables[T.value.value]=y)})}),!e.selectionSet||y==null)return y;var _=(w=(S=e.directives)===null||S===void 0?void 0:S.some(function(v){return v.name.value==="client"}))!==null&&w!==void 0?w:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||_,y,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||_,y,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),at(o,{Directive:function(c,u,l,f,d){c.name.value==="client"&&d.forEach(function(p){i(p)&&ya(p)&&s.add(p)})},FragmentSpread:function(c,u,l,f,d){var p=t[c.name.value];__DEV__?P(p,"No fragment named ".concat(c.name.value)):P(p,12);var h=a(p);h.size>0&&(d.forEach(function(m){i(m)&&ya(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Dn=new(Ut?WeakMap:Map);function Hu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Dn.set(r,(Dn.get(r)+1)%1e15),t.apply(this,arguments)})}function df(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ys=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Dn.has(i)||(Dn.set(i,0),Hu(i,"evict"),Hu(i,"modify"),Hu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!ke(this.variables,e.variables)&&(t=he.setVariables),ke(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){df(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&ke(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!ke(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():zu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;df(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(zr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=x(x({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!ke(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Dn.get(this.cache)&&ke(t,i.variables)&&ke(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new vt,s=Be(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Be(e.incremental)){var c=Jo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(vs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Dn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var f=a.getDiffOptions(i.variables),d=l.diff(f);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(d,f),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=he.ready},r.prototype.markError=function(e){return this.networkStatus=he.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function vs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!An(r);return!i&&t&&r.data&&(i=!0),i}var tv=Object.prototype.hasOwnProperty,ff=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,f=l===void 0?{}:l,d=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Ut?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=f,this.localState=d||new gs({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new J("QueryManager stopped while query was in flight"):new J(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,f=l===void 0?!1:l,d=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,S=y===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":y,w=e.keepRootFields,_=e.context;return Ht(this,void 0,void 0,function(){var v,T,$,E,R,L;return Gt(this,function(D){switch(D.label){case 0:return __DEV__?P(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):P(n,15),__DEV__?P(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):P(m==="network-only"||m==="no-cache",16),v=this.generateMutationId(),T=this.transform(n),$=T.document,E=T.hasClientExports,n=this.cache.transformForLink($),a=this.getVariables(n,a),E?[4,this.localState.addExportedVariables(n,a,_)]:[3,2];case 1:a=D.sent(),D.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[v]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:n,variables:a,fetchPolicy:m,errorPolicy:S,context:_,updateQueries:s,update:d,keepRootFields:w}),this.broadcastQueries(),L=this,[2,new Promise(function(I,Ie){return Go(L.getObservableFromLink(n,x(x({},_),{optimisticResponse:o}),a,!1),function(oe){if(An(oe)&&S==="none")throw new xr({graphQLErrors:Zo(oe)});R&&(R.loading=!1,R.error=null);var M=x({},oe);return typeof u=="function"&&(u=u(M)),S==="ignore"&&An(M)&&delete M.errors,L.markMutationResult({mutationId:v,result:M,document:n,variables:a,fetchPolicy:m,errorPolicy:S,context:_,update:d,updateQueries:s,awaitRefetchQueries:f,refetchQueries:u,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:w})}).subscribe({next:function(oe){L.broadcastQueries(),(!("hasNext"in oe)||oe.hasNext===!1)&&I(oe)},error:function(oe){R&&(R.loading=!1,R.error=oe),o&&L.cache.removeOptimistic(v),L.broadcastQueries(),Ie(oe instanceof xr?oe:new xr({networkError:oe}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&vs(n,e.errorPolicy)){if(jr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),jr(n)&&Be(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Jo(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(f,d){var p=f.observableQuery,h=p&&p.queryName;if(!(!h||!tv.call(u,h))){var m=u[h],y=i.queries.get(d),S=y.document,w=y.variables,_=t.diff({query:S,variables:w,returnPartialData:!0,optimistic:!1}),v=_.result,T=_.complete;if(T&&v){var $=m(v,{mutationResult:n,queryName:S&&Sn(S)||void 0,queryVariables:w});$&&a.push({result:$,dataId:"ROOT_QUERY",query:S,variables:w})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(f){o||a.forEach(function(m){return f.write(m)});var d=e.update,p=!Kp(n)||jr(n)&&!n.hasNext;if(d){if(!o){var h=f.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=x(x({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&d(f,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&f.modify({id:"ROOT_MUTATION",fields:function(m,y){var S=y.fieldName,w=y.DELETE;return S==="__typename"?m:w}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(f){return l.push(f)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(x(x({},t),{result:{data:n}}),a)}catch(o){__DEV__&&P.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=ru(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Kc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ei(or(i)),asQuery:x(x({},i),{definitions:i.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?x(x({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return x(x({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=x(x({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new ys(this),i=new ms({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?P(e.query,"query option is required. You must specify your GraphQL document in the query option."):P(e.query,17),__DEV__?P(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):P(e.query.kind==="Document",18),__DEV__?P(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):P(!e.returnPartialData,19),__DEV__?P(!e.pollInterval,"pollInterval option only supported on watchQuery."):P(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new J("Store reset while query was in flight (not completed in link chain)"):new J(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=he.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):Zc(o)?n.set(t.transform(o).document,!1):le(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){i.set(s,c);return}var l=c.queryName,f=c.options.fetchPolicy;if(f==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&n.has(l)||u&&n.has(u))&&(i.set(s,c),l&&n.set(l,!0),u&&n.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Aa("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new ms({queryManager:t,queryInfo:c,options:x(x({},o),{fetchPolicy:"network-only"})});P(u.queryId===s),c.setObservableQuery(u),i.set(s,u)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&P.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var u=function(f){return t.getObservableFromLink(i,c,f).map(function(d){if(n!=="no-cache"&&(vs(d,a)&&t.cache.write({query:i,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:f}),t.broadcastQueries()),An(d))throw new xr({graphQLErrors:d.errors});return d})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,c).then(u);return new re(function(f){var d=null;return l.then(function(p){return d=p.subscribe(f)},f.error),function(){return d&&d.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,f=u.link,d={query:c,variables:i,operationName:Sn(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!n}))};if(t=d.context,n){var p=l.get(c)||new Map;l.set(c,p);var h=It(i);if(s=p.get(h),!s){var m=new xn([In(f,d)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new xn([In(f,d)])}else s=new xn([re.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=Go(s,function(S){return a.localState.runResolvers({document:y,remoteResult:S,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Go(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Zo(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new xr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:he.ready};return c&&i.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=he.error),u},function(o){var s=pf(o)?o:new xr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=he.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,f=t.errorPolicy,d=f===void 0?c&&c.errorPolicy||"none":f,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,S=t.context,w=S===void 0?{}:S,_=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:y,context:w}),v=function(E){_.variables=E;var R=n.fetchQueryByPolicy(s,_,i);return _.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),R},T=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){T(),setTimeout(function(){return $.cancel(E)})});var $=new xn(this.transform(_.query).hasClientExports?this.localState.addExportedVariables(_.query,_.variables,_.context).then(v):v(_.variables));return $.promise.then(T,T),$},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Aa("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(d,p){l.set(p,{oq:d,lastDiff:t.getQuery(p).getDiff()})});var f=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,p,h){var m=d.watcher instanceof ys&&d.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var y=u(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&f.set(m,y),y}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(d,p){var h=d.oq,m=d.lastDiff,y=d.diff,S;if(u){if(!y){var w=h.queryInfo;w.reset(),y=w.getDiff()}S=u(h,y,m)}(!u||S===!0)&&(S=h.refetch()),S!==!1&&f.set(h,S),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),f},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,f=t.context,d=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(v,T){T===void 0&&(T=e.networkStatus||he.loading);var $=v.result;__DEV__&&!l&&!ke($,{})&&Wu(v.missing);var E=function(R){return re.of(x({data:R,loading:zr(T),networkStatus:T},v.complete?null:{partial:!0}))};return $&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:$},context:f,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return E(R.data||void 0)}):u==="none"&&T===he.refetch&&Array.isArray(v.missing)?E(void 0):E($)},y=s==="no-cache"?0:i===he.refetch&&c!=="merge"?1:2,S=function(){return n.getResultsFromLink(e,y,{variables:o,context:f,fetchPolicy:s,errorPolicy:u})},w=d&&typeof p=="number"&&p!==i&&zr(i);switch(s){default:case"cache-first":{var _=h();return _.complete?[m(_,e.markReady())]:l||w?[m(_),S()]:[S()]}case"cache-and-network":{var _=h();return _.complete||l||w?[m(_),S()]:[S()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return w?[m(h()),S()]:[S()];case"no-cache":return w?[m(e.getDiff()),S()]:[S()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ys(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return x(x({},t),{clientAwareness:this.clientAwareness})},r}();var hf=!1;var Gu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,f=e.connectToDevTools,d=f===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:f,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,S=y===void 0?!1:y,w=e.resolvers,_=e.typeDefs,v=e.fragmentMatcher,T=e.name,$=e.version,E=e.link;if(E||(E=i?new _u({uri:i,credentials:n,headers:a}):jt.empty()),!o)throw __DEV__?new J(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
51
- For more information, please visit: https://go.apollo.dev/c/docs`):new J(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=_,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!hf&&d&&__DEV__&&(hf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,L=R&&R.userAgent,D=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=Xp,this.localState=new gs({cache:o,client:this,resolvers:w,fragmentMatcher:v}),this.queryManager=new ff({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:$},localState:this.localState,assumeImmutableResults:S,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ia(this.defaultOptions.query,e)),__DEV__?P(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):P(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return In(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&P.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Ap(yi?"log":"silent");function lt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ar(r){return lt(r)==="object"}function mf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Ku(r,e){return r.length<124?r:e}var gf="graphql-transport-ws";var bt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(bt||(bt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function yf(r){if(!Ar(r))throw new Error(`Message is expected to be an object, but got ${lt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${lt(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${lt(r.payload.query)}`);if(r.payload.variables!=null&&!Ar(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${lt(r.payload.variables)}`);if(r.payload.operationName!=null&&lt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${lt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ar(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${lt(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!mf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function vf(r,e){return yf(typeof r=="string"?JSON.parse(r,e):r)}function $n(r,e){return yf(r),JSON.stringify(r,e)}function Ju(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(Se){let _e=1e3;for(let ce=0;ce<Se;ce++)_e*=2;await new Promise(ce=>setTimeout(ce,_e+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=bs,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Se=>{let _e=Math.random()*16|0;return(Se=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:S}=r,w;if(h){if(!iv(h))throw new Error("Invalid WebSocket implementation provided");w=h}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let _=w,v=(()=>{let M=(()=>{let _e={};return{on(ce,ue){return _e[ce]=ue,()=>{delete _e[ce]}},emit(ce){var ue;"id"in ce&&((ue=_e[ce.id])===null||ue===void 0||ue.call(_e,ce))}}})(),Se={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(_e,ce){let ue=Se[_e];return ue.push(ce),()=>{ue.splice(ue.indexOf(ce),1)}},emit(_e,...ce){for(let ue of[...Se[_e]])ue(...ce)}}})();function T(M){let Se=[v.on("error",_e=>{Se.forEach(ce=>ce()),M(_e)}),v.on("closed",_e=>{Se.forEach(ce=>ce()),M(_e)})]}let $,E=0,R,L=!1,D=0,I=!1;async function Ie(){clearTimeout(R);let[M,Se]=await($??($=new Promise((ue,rr)=>(async()=>{if(L){if(await l(D),!E)return $=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});D++}v.emit("connecting");let te=new _(typeof e=="function"?await e():e,gf),ir,Lr;function Po(){isFinite(o)&&o>0&&(clearTimeout(Lr),Lr=setTimeout(()=>{te.readyState===_.OPEN&&(te.send($n({type:Pe.Ping})),v.emit("ping",!1,void 0))},o))}T(Ye=>{$=void 0,clearTimeout(ir),clearTimeout(Lr),rr(Ye),bs(Ye)&&Ye.code===4499&&(te.close(4499,"Terminated"),te.onerror=null,te.onclose=null)}),te.onerror=Ye=>v.emit("error",Ye),te.onclose=Ye=>v.emit("closed",Ye),te.onopen=async()=>{try{v.emit("opened",te);let Ye=typeof t=="function"?await t():t;if(te.readyState!==_.OPEN)return;te.send($n(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},y)),isFinite(c)&&c>0&&(ir=setTimeout(()=>{te.close(bt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Po()}catch(Ye){v.emit("error",Ye),te.close(bt.InternalClientError,Ku(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let yn=!1;te.onmessage=({data:Ye})=>{try{let Xe=vf(Ye,S);if(v.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){v.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Po():s||(te.send($n(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),v.emit("pong",!1,Xe.payload));return}if(yn)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(ir),yn=!0,v.emit("connected",te,Xe.payload),L=!1,D=0,ue([te,new Promise((RS,sg)=>T(sg))])}catch(Xe){te.onmessage=null,v.emit("error",Xe),te.close(bt.BadResponse,Ku(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));M.readyState===_.CLOSING&&await Se;let _e=()=>{},ce=new Promise(ue=>_e=ue);return[M,_e,Promise.race([ce.then(()=>{if(!E){let ue=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{M.readyState===_.OPEN&&ue()},a):ue()}}),Se])]}function oe(M){if(bs(M)&&(rv(M.code)||[bt.InternalServerError,bt.InternalClientError,bt.BadRequest,bt.BadResponse,bt.Unauthorized,bt.SubprotocolNotAcceptable,bt.SubscriberAlreadyExists,bt.TooManyInitialisationRequests].includes(M.code)))throw M;if(I)return!1;if(bs(M)&&M.code===1e3)return E>0;if(!u||D>=u||!f(M)||d?.(M))throw M;return L=!0}return i||(async()=>{for(E++;;)try{let[,,M]=await Ie();await M}catch(M){try{if(!oe(M))return}catch(Se){return n?.(Se)}}})(),{on:v.on,subscribe(M,Se){let _e=m(M),ce=!1,ue=!1,rr=()=>{E--,ce=!0};return(async()=>{for(E++;;)try{let[te,ir,Lr]=await Ie();if(ce)return ir();let Po=v.onMessage(_e,yn=>{switch(yn.type){case Pe.Next:{Se.next(yn.payload);return}case Pe.Error:{ue=!0,ce=!0,Se.error(yn.payload),rr();return}case Pe.Complete:{ce=!0,rr();return}}});te.send($n({id:_e,type:Pe.Subscribe,payload:M},y)),rr=()=>{!ce&&te.readyState===_.OPEN&&te.send($n({id:_e,type:Pe.Complete},y)),E--,ce=!0,ir()},await Lr.finally(Po);return}catch(te){if(!oe(te))return}})().then(()=>{ue||Se.complete()}).catch(te=>{Se.error(te)}),()=>{ce||rr()}},async dispose(){if(I=!0,$){let[M]=await $;M.close(1e3,"Normal Closure")}},terminate(){$&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function bs(r){return Ar(r)&&"code"in r&&"reason"in r}function rv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function iv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function nv(r){return le(r)&&"code"in r&&"reason"in r}var bf=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new re(function(n){return i.client.subscribe(x(x({},t),{query:vn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):nv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new xr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(jt);var ws="0.12.0-rc1-dev";function Ss(){return typeof window!="undefined"&&window.self!==window.top}function Zu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Zu()&&localStorage.setItem(`${ws}/${r}`,e)}function _s(r){return Zu()?localStorage.getItem(`${ws}/${r}`):null}function Ra(r){Zu()&&localStorage.removeItem(`${ws}/${r}`)}function Rn(r,e=1e4){return K(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}var tc=function(){return tc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ps(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ps=function(t){return typeof t}:Ps=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ps(r)}function ov(r){return Ps(r)=="object"&&r!==null}var jh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function yl(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function sv(r){return qh(r.source,yl(r.source,r.start))}function qh(r,e){var t=r.locationOffset.column-1,i=Fs(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
51
+ For more information, please visit: https://go.apollo.dev/c/docs`):new J(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=_,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!hf&&d&&__DEV__&&(hf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,L=R&&R.userAgent,D=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=Xp,this.localState=new gs({cache:o,client:this,resolvers:w,fragmentMatcher:v}),this.queryManager=new ff({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:$},localState:this.localState,assumeImmutableResults:S,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ia(this.defaultOptions.query,e)),__DEV__?P(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):P(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return In(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&P.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Ap(yi?"log":"silent");function lt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ar(r){return lt(r)==="object"}function mf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Ku(r,e){return r.length<124?r:e}var gf="graphql-transport-ws";var bt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(bt||(bt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function yf(r){if(!Ar(r))throw new Error(`Message is expected to be an object, but got ${lt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${lt(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${lt(r.payload.query)}`);if(r.payload.variables!=null&&!Ar(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${lt(r.payload.variables)}`);if(r.payload.operationName!=null&&lt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${lt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ar(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${lt(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!mf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function vf(r,e){return yf(typeof r=="string"?JSON.parse(r,e):r)}function $n(r,e){return yf(r),JSON.stringify(r,e)}function Ju(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(Se){let _e=1e3;for(let ce=0;ce<Se;ce++)_e*=2;await new Promise(ce=>setTimeout(ce,_e+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=bs,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Se=>{let _e=Math.random()*16|0;return(Se=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:S}=r,w;if(h){if(!iv(h))throw new Error("Invalid WebSocket implementation provided");w=h}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let _=w,v=(()=>{let M=(()=>{let _e={};return{on(ce,ue){return _e[ce]=ue,()=>{delete _e[ce]}},emit(ce){var ue;"id"in ce&&((ue=_e[ce.id])===null||ue===void 0||ue.call(_e,ce))}}})(),Se={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(_e,ce){let ue=Se[_e];return ue.push(ce),()=>{ue.splice(ue.indexOf(ce),1)}},emit(_e,...ce){for(let ue of[...Se[_e]])ue(...ce)}}})();function T(M){let Se=[v.on("error",_e=>{Se.forEach(ce=>ce()),M(_e)}),v.on("closed",_e=>{Se.forEach(ce=>ce()),M(_e)})]}let $,E=0,R,L=!1,D=0,I=!1;async function Ie(){clearTimeout(R);let[M,Se]=await($??($=new Promise((ue,rr)=>(async()=>{if(L){if(await l(D),!E)return $=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});D++}v.emit("connecting");let te=new _(typeof e=="function"?await e():e,gf),ir,Lr;function Po(){isFinite(o)&&o>0&&(clearTimeout(Lr),Lr=setTimeout(()=>{te.readyState===_.OPEN&&(te.send($n({type:Pe.Ping})),v.emit("ping",!1,void 0))},o))}T(Ye=>{$=void 0,clearTimeout(ir),clearTimeout(Lr),rr(Ye),bs(Ye)&&Ye.code===4499&&(te.close(4499,"Terminated"),te.onerror=null,te.onclose=null)}),te.onerror=Ye=>v.emit("error",Ye),te.onclose=Ye=>v.emit("closed",Ye),te.onopen=async()=>{try{v.emit("opened",te);let Ye=typeof t=="function"?await t():t;if(te.readyState!==_.OPEN)return;te.send($n(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},y)),isFinite(c)&&c>0&&(ir=setTimeout(()=>{te.close(bt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Po()}catch(Ye){v.emit("error",Ye),te.close(bt.InternalClientError,Ku(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let yn=!1;te.onmessage=({data:Ye})=>{try{let Xe=vf(Ye,S);if(v.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){v.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Po():s||(te.send($n(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),v.emit("pong",!1,Xe.payload));return}if(yn)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(ir),yn=!0,v.emit("connected",te,Xe.payload),L=!1,D=0,ue([te,new Promise((RS,sg)=>T(sg))])}catch(Xe){te.onmessage=null,v.emit("error",Xe),te.close(bt.BadResponse,Ku(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));M.readyState===_.CLOSING&&await Se;let _e=()=>{},ce=new Promise(ue=>_e=ue);return[M,_e,Promise.race([ce.then(()=>{if(!E){let ue=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{M.readyState===_.OPEN&&ue()},a):ue()}}),Se])]}function oe(M){if(bs(M)&&(rv(M.code)||[bt.InternalServerError,bt.InternalClientError,bt.BadRequest,bt.BadResponse,bt.Unauthorized,bt.SubprotocolNotAcceptable,bt.SubscriberAlreadyExists,bt.TooManyInitialisationRequests].includes(M.code)))throw M;if(I)return!1;if(bs(M)&&M.code===1e3)return E>0;if(!u||D>=u||!f(M)||d?.(M))throw M;return L=!0}return i||(async()=>{for(E++;;)try{let[,,M]=await Ie();await M}catch(M){try{if(!oe(M))return}catch(Se){return n?.(Se)}}})(),{on:v.on,subscribe(M,Se){let _e=m(M),ce=!1,ue=!1,rr=()=>{E--,ce=!0};return(async()=>{for(E++;;)try{let[te,ir,Lr]=await Ie();if(ce)return ir();let Po=v.onMessage(_e,yn=>{switch(yn.type){case Pe.Next:{Se.next(yn.payload);return}case Pe.Error:{ue=!0,ce=!0,Se.error(yn.payload),rr();return}case Pe.Complete:{ce=!0,rr();return}}});te.send($n({id:_e,type:Pe.Subscribe,payload:M},y)),rr=()=>{!ce&&te.readyState===_.OPEN&&te.send($n({id:_e,type:Pe.Complete},y)),E--,ce=!0,ir()},await Lr.finally(Po);return}catch(te){if(!oe(te))return}})().then(()=>{ue||Se.complete()}).catch(te=>{Se.error(te)}),()=>{ce||rr()}},async dispose(){if(I=!0,$){let[M]=await $;M.close(1e3,"Normal Closure")}},terminate(){$&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function bs(r){return Ar(r)&&"code"in r&&"reason"in r}function rv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function iv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function nv(r){return le(r)&&"code"in r&&"reason"in r}var bf=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new re(function(n){return i.client.subscribe(x(x({},t),{query:vn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):nv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new xr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(jt);var ws="0.12.0-rc1-dev.1";function Ss(){return typeof window!="undefined"&&window.self!==window.top}function Zu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Zu()&&localStorage.setItem(`${ws}/${r}`,e)}function _s(r){return Zu()?localStorage.getItem(`${ws}/${r}`):null}function Ra(r){Zu()&&localStorage.removeItem(`${ws}/${r}`)}function Rn(r,e=1e4){return K(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}var tc=function(){return tc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ps(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ps=function(t){return typeof t}:Ps=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ps(r)}function ov(r){return Ps(r)=="object"&&r!==null}var jh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function yl(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function sv(r){return qh(r.source,yl(r.source,r.start))}function qh(r,e){var t=r.locationOffset.column-1,i=Fs(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
52
52
  `),l=i.split(/\r\n|[\n\r]/g),f=l[n];if(f.length>120){for(var d=Math.floor(c/80),p=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return u+wf([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(y){return["",y]}),[[" ",Fs(p-1)+"^"],["",h[d+1]]]))}return u+wf([["".concat(o-1),l[n-1]],["".concat(o),f],["",Fs(c-1)+"^"],["".concat(o+1),l[n+1]]])}function wf(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return cv(t,n)+(a?" | "+a:" |")}).join(`
53
53
  `)}function Fs(r){return Array(r+1).join(" ")}function cv(r,e){return Fs(r-e.length)+e}function Ms(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ms=function(t){return typeof t}:Ms=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(r)}function Sf(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function uv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Sf(Object(t),!0).forEach(function(i){lv(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Sf(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function lv(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function pv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function _f(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function dv(r,e,t){return e&&_f(r.prototype,e),t&&_f(r,t),r}function fv(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&so(r,e)}function hv(r){var e=Vh();return function(){var i=co(r),n;if(e){var a=co(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return Bh(this,n)}}function Bh(r,e){return e&&(Ms(e)==="object"||typeof e=="function")?e:Ua(r)}function Ua(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function vl(r){var e=typeof Map=="function"?new Map:void 0;return vl=function(i){if(i===null||!mv(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Us(i,arguments,co(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),so(n,i)},vl(r)}function Us(r,e,t){return Vh()?Us=Reflect.construct:Us=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),u=new c;return o&&so(u,o.prototype),u},Us.apply(null,arguments)}function Vh(){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 mv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function so(r,e){return so=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},so(r,e)}function co(r){return co=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},co(r)}var gv=function(r){fv(t,r);var e=hv(t);function t(i,n,a,o,s,c,u){var l,f,d,p;pv(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Ef(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,y=(S=p.nodes)!==null&&S!==void 0?S:[];m<y.length;m++){var S,w=y[m],_=w.loc;_!=null&&h.push(_)}h=Ef(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((f=h)===null||f===void 0?void 0:f.map(function(T){return T.start})),p.locations=o&&a?o.map(function(T){return yl(a,T)}):(d=h)===null||d===void 0?void 0:d.map(function(T){return yl(T.source,T.start)}),p.path=s??void 0;var v=c?.extensions;return u==null&&ov(v)?p.extensions=uv({},v):p.extensions=u??{},Object.defineProperties(Ua(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ua(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Bh(p)):(Error.captureStackTrace?Error.captureStackTrace(Ua(p),t):Object.defineProperty(Ua(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return dv(t,[{key:"toString",value:function(){return yv(this)}},{key:jh,get:function(){return"Object"}}]),t}(vl(Error));function Ef(r){return r===void 0||r.length===0?void 0:r}function yv(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
54
54
 
@@ -1563,7 +1563,7 @@ input VoiceActivityParamsInput {
1563
1563
  FROM link
1564
1564
  WHERE in.uri = ${e.formatSurrealValue(ae(this,st,"f"))}
1565
1565
  ORDER BY timestamp ASC
1566
- `,a=await ae(this,Te,"f").querySurrealDB(n);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,f]of Object.entries(t.properties)){if(f.getter)continue;let d=a.filter(p=>p.predicate===f.predicate);if(d.length>0){let p=d[d.length-1],h=p.target;if(p.timestamp&&((!o||p.timestamp<o)&&(o=p.timestamp,u=p.author),(!s||p.timestamp>s)&&(s=p.timestamp,c=p.author)),f.resolveLanguage&&f.resolveLanguage!=="literal")try{let m=await ae(this,Te,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let m=we.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}f.transform&&typeof f.transform=="function"&&(h=f.transform(h)),this[l]=h}}for(let[l,f]of Object.entries(t.collections)){if(f.getter)continue;let p=a.filter(h=>h.predicate===f.predicate).map(h=>h.target);if(f.where?.condition&&p.length>0)try{let h=[];for(let m of p){let y=f.where.condition.replace(/\$perspective/g,`'${ae(this,Te,"f").uuid}'`).replace(/\$base/g,`'${ae(this,st,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);y.trim().startsWith("WHERE")&&(y=`array::len(SELECT * FROM link ${y}) > 0`);let S=`RETURN ${y}`,w=await ae(this,Te,"f").querySurrealDB(S);(w===!0||Array.isArray(w)&&w.length>0&&w[0]===!0)&&h.push(m)}p=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(f.where?.isInstance&&p.length>0)try{let h=typeof f.where.isInstance=="string"?f.where.isInstance:f.where.isInstance.name,m=await ae(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await ae(this,Te,"f").batchCheckSubjectInstances(p,m))}catch{}this[l]=p}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,ae(this,Te,"f"),t);for(let[o,s]of Object.entries(t.collections))if(s.getter&&s.where?.isInstance&&this[o]?.length>0)try{let c=typeof s.where.isInstance=="string"?s.where.isInstance:s.where.isInstance.name,u=await ae(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await ae(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${ae(this,st,"f")}:`,e)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:f}=t,d=i||await this.getClassName(e),p=[Nh(),Ch(n),wS(a),SS(o),Dh(s)],h=[$h(f),Rh(c),Lh(u),Ph(l)];return`
1566
+ `,a=await ae(this,Te,"f").querySurrealDB(n);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,f]of Object.entries(t.properties)){if(f.getter)continue;let d=a.filter(p=>p.predicate===f.predicate);if(d.length>0){let p=d[d.length-1],h=p.target;if(p.timestamp&&((!o||p.timestamp<o)&&(o=p.timestamp,u=p.author),(!s||p.timestamp>s)&&(s=p.timestamp,c=p.author)),f.resolveLanguage&&f.resolveLanguage!=="literal")try{let m=await ae(this,Te,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(f.resolveLanguage==="literal"&&typeof h=="string"&&h.startsWith("literal://"))try{let m=we.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}f.transform&&typeof f.transform=="function"&&(h=f.transform(h)),this[l]=h}}for(let[l,f]of Object.entries(t.collections)){if(f.getter)continue;let p=a.filter(h=>h.predicate===f.predicate).map(h=>h.target);if(f.where?.condition&&p.length>0)try{let h=[];for(let m of p){let y=f.where.condition.replace(/\$perspective/g,`'${ae(this,Te,"f").uuid}'`).replace(/\$base/g,`'${ae(this,st,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);y.trim().startsWith("WHERE")&&(y=`array::len(SELECT * FROM link ${y}) > 0`);let S=`RETURN ${y}`,w=await ae(this,Te,"f").querySurrealDB(S);(w===!0||Array.isArray(w)&&w.length>0&&w[0]===!0)&&h.push(m)}p=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(f.where?.isInstance&&p.length>0)try{let h=typeof f.where.isInstance=="string"?f.where.isInstance:f.where.isInstance.name,m=await ae(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await ae(this,Te,"f").batchCheckSubjectInstances(p,m))}catch{}this[l]=p}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,ae(this,Te,"f"),t);for(let[o,s]of Object.entries(t.collections))if(s.getter&&s.where?.isInstance&&this[o]?.length>0)try{let c=typeof s.where.isInstance=="string"?s.where.isInstance:s.where.isInstance.name,u=await ae(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await ae(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${ae(this,st,"f")}:`,e)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:f}=t,d=i||await this.getClassName(e),p=[Nh(),Ch(n),wS(a),SS(o),Dh(s)],h=[$h(f),Rh(c),Lh(u),Ph(l)];return`
1567
1567
  findall([Base, Properties, Collections, Timestamp, Author], (
1568
1568
  subject_class("${d}", SubjectClass),
1569
1569
  instance(SubjectClass, Base),
package/dist/utils.js CHANGED
@@ -1 +1 @@
1
- var i=(t,c,s)=>new Promise((r,e)=>{var a=o=>{try{u(s.next(o))}catch(d){e(d)}},l=o=>{try{u(s.throw(o))}catch(d){e(d)}},u=o=>o.done?r(o.value):Promise.resolve(o.value).then(a,l);u((s=s.apply(t,c)).next())});var n="0.12.0-rc1-dev";function y(){return typeof window!="undefined"&&window.self!==window.top}function p(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function k(t,c){p()&&localStorage.setItem(`${n}/${t}`,c)}function f(t){return p()?localStorage.getItem(`${n}/${t}`):null}function w(t){p()&&localStorage.removeItem(`${n}/${t}`)}function _(t,c=1e4){return i(this,null,function*(){return Promise.race([new Promise((s,r)=>{let e;try{e=new WebSocket(t,"graphql-transport-ws"),e.onopen=()=>{e.close(),s(e)},e.onerror=a=>{r(a)},e.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){e&&e.close(),r(a)}}),new Promise((s,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},c)})])})}export{_ as connectWebSocket,f as getLocal,y as isEmbedded,w as removeLocal,k as setLocal};
1
+ var i=(t,c,s)=>new Promise((r,e)=>{var a=o=>{try{u(s.next(o))}catch(d){e(d)}},l=o=>{try{u(s.throw(o))}catch(d){e(d)}},u=o=>o.done?r(o.value):Promise.resolve(o.value).then(a,l);u((s=s.apply(t,c)).next())});var n="0.12.0-rc1-dev.1";function y(){return typeof window!="undefined"&&window.self!==window.top}function p(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function k(t,c){p()&&localStorage.setItem(`${n}/${t}`,c)}function f(t){return p()?localStorage.getItem(`${n}/${t}`):null}function w(t){p()&&localStorage.removeItem(`${n}/${t}`)}function _(t,c=1e4){return i(this,null,function*(){return Promise.race([new Promise((s,r)=>{let e;try{e=new WebSocket(t,"graphql-transport-ws"),e.onopen=()=>{e.close(),s(e)},e.onerror=a=>{r(a)},e.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){e&&e.close(),r(a)}}),new Promise((s,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},c)})])})}export{_ as connectWebSocket,f as getLocal,y as isEmbedded,w as removeLocal,k as setLocal};
package/dist/web.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var du=Object.defineProperty;var pu=Object.getOwnPropertyDescriptor;var fu=Object.getPrototypeOf;var hu=Reflect.get;var B=(i,e,t,r)=>{for(var n=r>1?void 0:r?pu(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&du(e,t,n),n};var wo=(i,e,t)=>hu(fu(i),t,e);var Ee=(i,e,t)=>new Promise((r,n)=>{var a=c=>{try{o(t.next(c))}catch(l){n(l)}},s=c=>{try{o(t.throw(c))}catch(l){n(l)}},o=c=>c.done?r(c.value):Promise.resolve(c.value).then(a,s);o((t=t.apply(i,e)).next())});var Cn=window,Ln=Cn.ShadowRoot&&(Cn.ShadyCSS===void 0||Cn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ga=Symbol(),_o=new WeakMap,Lr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ga)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ln&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=_o.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&_o.set(t,e))}return e}toString(){return this.cssText}},Eo=i=>new Lr(typeof i=="string"?i:i+"",void 0,Ga),Ze=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+i[a+1],i[0]);return new Lr(t,i,Ga)},Za=(i,e)=>{Ln?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Cn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Nn=Ln?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Eo(t)})(i):i;var Ja,Pn=window,xo=Pn.trustedTypes,gu=xo?xo.emptyScript:"",$o=Pn.reactiveElementPolyfillSupport,Xa={toAttribute(i,e){switch(e){case Boolean:i=i?gu:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Ao=(i,e)=>e!==i&&(e==e||i==i),Ya={attribute:!0,type:String,converter:Xa,reflect:!1,hasChanged:Ao},es="finalized",Ct=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=Ya){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Ya}static finalize(){if(this.hasOwnProperty(es))return!1;this[es]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(Nn(n))}else e!==void 0&&t.push(Nn(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Za(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Ya){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:Xa).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:Xa;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||Ao)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Ct[es]=!0,Ct.elementProperties=new Map,Ct.elementStyles=[],Ct.shadowRootOptions={mode:"open"},$o?.({ReactiveElement:Ct}),((Ja=Pn.reactiveElementVersions)!==null&&Ja!==void 0?Ja:Pn.reactiveElementVersions=[]).push("1.6.3");var ts,Rn=window,Yi=Rn.trustedTypes,Io=Yi?Yi.createPolicy("lit-html",{createHTML:i=>i}):void 0,rs="$lit$",Ft=`lit$${(Math.random()+"").slice(9)}$`,Ro="?"+Ft,mu=`<${Ro}>`,pi=document,Pr=()=>pi.createComment(""),Rr=i=>i===null||typeof i!="object"&&typeof i!="function",Oo=Array.isArray,yu=i=>Oo(i)||typeof i?.[Symbol.iterator]=="function",is=`[
2
2
  \f\r]`,Nr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ko=/-->/g,To=/>/g,ui=RegExp(`>|${is}(?:([^\\s"'>=/]+)(${is}*=${is}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,Lo=/"/g,Do=/^(?:script|style|textarea|title)$/i,Uo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),P=Uo(1),Zh=Uo(2),fi=Symbol.for("lit-noChange"),xe=Symbol.for("lit-nothing"),No=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Mo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(e):e}var vu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Nr;for(let o=0;o<t;o++){let c=i[o],l,u,m=-1,p=0;for(;p<c.length&&(s.lastIndex=p,u=s.exec(c),u!==null);)p=s.lastIndex,s===Nr?u[1]==="!--"?s=ko:u[1]!==void 0?s=To:u[2]!==void 0?(Do.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Nr,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,l=u[1],s=u[3]===void 0?ui:u[3]==='"'?Lo:Co):s===Lo||s===Co?s=ui:s===ko||s===To?s=Nr:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Nr?c+mu:m>=0?(r.push(l),c.slice(0,m)+rs+c.slice(m)+Ft+d):c+Ft+(m===-2?(r.push(void 0),o):d)}return[Mo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},hi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,c=this.parts,[l,u]=vu(e,t);if(this.el=hi.createElement(l,r),di.currentNode=this.el.content,t===2){let m=this.el.content,p=m.firstChild;p.remove(),m.append(...p.childNodes)}for(;(n=di.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let p of n.getAttributeNames())if(p.endsWith(rs)||p.startsWith(Ft)){let d=u[s++];if(m.push(p),d!==void 0){let f=n.getAttribute(d.toLowerCase()+rs).split(Ft),y=/([.?@])?(.*)/.exec(d);c.push({type:1,index:a,name:y[2],strings:f,ctor:y[1]==="."?as:y[1]==="?"?ss:y[1]==="@"?os:er})}else c.push({type:6,index:a})}for(let p of m)n.removeAttribute(p)}if(Do.test(n.tagName)){let m=n.textContent.split(Ft),p=m.length-1;if(p>0){n.textContent=Yi?Yi.emptyScript:"";for(let d=0;d<p;d++)n.append(m[d],Pr()),di.nextNode(),c.push({type:2,index:++a});n.append(m[p],Pr())}}}else if(n.nodeType===8)if(n.data===Ro)c.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(Ft,m+1))!==-1;)c.push({type:7,index:a}),m+=Ft.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function Xi(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let c=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,l=Rr(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(i),c._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=c:t._$Cl=c),c!==void 0&&(e=Xi(i,c._$AS(i,e.values),c,r)),e}var ns=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:pi).importNode(r,!0);di.currentNode=a;let s=di.nextNode(),o=0,c=0,l=n[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new gi(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new cs(s,this,e)),this._$AV.push(u),l=n[++c]}o!==l?.index&&(s=di.nextNode(),o++)}return di.currentNode=pi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},gi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=xe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Rr(e)?e===xe||e==null||e===""?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):yu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==xe&&Rr(this._$AH)?this._$AA.nextSibling.data=e:this.$(pi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=hi.createElement(Mo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ns(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=No.get(e.strings);return t===void 0&&No.set(e.strings,t=new hi(e)),t}T(e){Oo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new gi(this.k(Pr()),this.k(Pr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},er=class{constructor(e,t,r,n,a){this.type=1,this._$AH=xe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=xe}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Xi(this,e,t,0),s=!Rr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Xi(this,o[r+c],t,c),l===fi&&(l=this._$AH[c]),s||(s=!Rr(l)||l!==this._$AH[c]),l===xe?e=xe:e!==xe&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}s&&!n&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},as=class extends er{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}},bu=Yi?Yi.emptyScript:"",ss=class extends er{constructor(){super(...arguments),this.type=4}j(e){e&&e!==xe?this.element.setAttribute(this.name,bu):this.element.removeAttribute(this.name)}},os=class extends er{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Xi(this,e,t,0))!==null&&r!==void 0?r:xe)===fi)return;let n=this._$AH,a=e===xe&&n!==xe||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==xe&&(n===xe||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},cs=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}};var Po=Rn.litHtmlPolyfillSupport;Po?.(hi,gi),((ts=Rn.litHtmlVersions)!==null&&ts!==void 0?ts:Rn.litHtmlVersions=[]).push("2.8.0");var Fo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new gi(e.insertBefore(Pr(),o),o,void 0,t??{})}return s._$AI(i),s};var ls,us;var Pe=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fo(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return fi}};Pe.finalized=!0,Pe._$litElement$=!0,(ls=globalThis.litElementHydrateSupport)===null||ls===void 0||ls.call(globalThis,{LitElement:Pe});var Bo=globalThis.litElementPolyfillSupport;Bo?.({LitElement:Pe});((us=globalThis.litElementVersions)!==null&&us!==void 0?us:globalThis.litElementVersions=[]).push("3.3.3");var mt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var Su=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,i)}},wu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?wu(i,e,t):Su(i,e)}function ue(i){return fe({...i,state:!0})}var ds,Eg=((ds=window.HTMLSlotElement)===null||ds===void 0?void 0:ds.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var _u=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function ps(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of _u(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var jo="0.12.0-rc1-dev";function xu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function On(i,e){xu()&&localStorage.setItem(`${jo}/${i}`,e)}function Dn(i,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function mi(){return P`
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,Lo=/"/g,Do=/^(?:script|style|textarea|title)$/i,Uo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),P=Uo(1),Zh=Uo(2),fi=Symbol.for("lit-noChange"),xe=Symbol.for("lit-nothing"),No=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Mo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(e):e}var vu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Nr;for(let o=0;o<t;o++){let c=i[o],l,u,m=-1,p=0;for(;p<c.length&&(s.lastIndex=p,u=s.exec(c),u!==null);)p=s.lastIndex,s===Nr?u[1]==="!--"?s=ko:u[1]!==void 0?s=To:u[2]!==void 0?(Do.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Nr,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,l=u[1],s=u[3]===void 0?ui:u[3]==='"'?Lo:Co):s===Lo||s===Co?s=ui:s===ko||s===To?s=Nr:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Nr?c+mu:m>=0?(r.push(l),c.slice(0,m)+rs+c.slice(m)+Ft+d):c+Ft+(m===-2?(r.push(void 0),o):d)}return[Mo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},hi=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,c=this.parts,[l,u]=vu(e,t);if(this.el=hi.createElement(l,r),di.currentNode=this.el.content,t===2){let m=this.el.content,p=m.firstChild;p.remove(),m.append(...p.childNodes)}for(;(n=di.nextNode())!==null&&c.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let p of n.getAttributeNames())if(p.endsWith(rs)||p.startsWith(Ft)){let d=u[s++];if(m.push(p),d!==void 0){let f=n.getAttribute(d.toLowerCase()+rs).split(Ft),y=/([.?@])?(.*)/.exec(d);c.push({type:1,index:a,name:y[2],strings:f,ctor:y[1]==="."?as:y[1]==="?"?ss:y[1]==="@"?os:er})}else c.push({type:6,index:a})}for(let p of m)n.removeAttribute(p)}if(Do.test(n.tagName)){let m=n.textContent.split(Ft),p=m.length-1;if(p>0){n.textContent=Yi?Yi.emptyScript:"";for(let d=0;d<p;d++)n.append(m[d],Pr()),di.nextNode(),c.push({type:2,index:++a});n.append(m[p],Pr())}}}else if(n.nodeType===8)if(n.data===Ro)c.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(Ft,m+1))!==-1;)c.push({type:7,index:a}),m+=Ft.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function Xi(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let c=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,l=Rr(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(i),c._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=c:t._$Cl=c),c!==void 0&&(e=Xi(i,c._$AS(i,e.values),c,r)),e}var ns=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:pi).importNode(r,!0);di.currentNode=a;let s=di.nextNode(),o=0,c=0,l=n[0];for(;l!==void 0;){if(o===l.index){let u;l.type===2?u=new gi(s,s.nextSibling,this,e):l.type===1?u=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(u=new cs(s,this,e)),this._$AV.push(u),l=n[++c]}o!==l?.index&&(s=di.nextNode(),o++)}return di.currentNode=pi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},gi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=xe,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Xi(this,e,t),Rr(e)?e===xe||e==null||e===""?(this._$AH!==xe&&this._$AR(),this._$AH=xe):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):yu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==xe&&Rr(this._$AH)?this._$AA.nextSibling.data=e:this.$(pi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=hi.createElement(Mo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ns(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=No.get(e.strings);return t===void 0&&No.set(e.strings,t=new hi(e)),t}T(e){Oo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new gi(this.k(Pr()),this.k(Pr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},er=class{constructor(e,t,r,n,a){this.type=1,this._$AH=xe,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=xe}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Xi(this,e,t,0),s=!Rr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=Xi(this,o[r+c],t,c),l===fi&&(l=this._$AH[c]),s||(s=!Rr(l)||l!==this._$AH[c]),l===xe?e=xe:e!==xe&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}s&&!n&&this.j(e)}j(e){e===xe?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},as=class extends er{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===xe?void 0:e}},bu=Yi?Yi.emptyScript:"",ss=class extends er{constructor(){super(...arguments),this.type=4}j(e){e&&e!==xe?this.element.setAttribute(this.name,bu):this.element.removeAttribute(this.name)}},os=class extends er{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Xi(this,e,t,0))!==null&&r!==void 0?r:xe)===fi)return;let n=this._$AH,a=e===xe&&n!==xe||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==xe&&(n===xe||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},cs=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Xi(this,e)}};var Po=Rn.litHtmlPolyfillSupport;Po?.(hi,gi),((ts=Rn.litHtmlVersions)!==null&&ts!==void 0?ts:Rn.litHtmlVersions=[]).push("2.8.0");var Fo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new gi(e.insertBefore(Pr(),o),o,void 0,t??{})}return s._$AI(i),s};var ls,us;var Pe=class extends Ct{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fo(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return fi}};Pe.finalized=!0,Pe._$litElement$=!0,(ls=globalThis.litElementHydrateSupport)===null||ls===void 0||ls.call(globalThis,{LitElement:Pe});var Bo=globalThis.litElementPolyfillSupport;Bo?.({LitElement:Pe});((us=globalThis.litElementVersions)!==null&&us!==void 0?us:globalThis.litElementVersions=[]).push("3.3.3");var mt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var Su=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,i)}},wu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?wu(i,e,t):Su(i,e)}function ue(i){return fe({...i,state:!0})}var ds,Eg=((ds=window.HTMLSlotElement)===null||ds===void 0?void 0:ds.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var _u=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function ps(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of _u(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var jo="0.12.0-rc1-dev.1";function xu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function On(i,e){xu()&&localStorage.setItem(`${jo}/${i}`,e)}function Dn(i,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function mi(){return P`
4
4
  <svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
5
5
  <path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
6
6
  </svg>
@@ -1942,7 +1942,7 @@ input VoiceActivityParamsInput {
1942
1942
  FROM link
1943
1943
  WHERE in.uri = ${e.formatSurrealValue(Z(this,Oe,"f"))}
1944
1944
  ORDER BY timestamp ASC
1945
- `,a=await Z(this,le,"f").querySurrealDB(n);if(a&&a.length>0){let s=null,o=null,c=null,l=null;for(let[u,m]of Object.entries(t.properties)){if(m.getter)continue;let p=a.filter(d=>d.predicate===m.predicate);if(p.length>0){let d=p[p.length-1],f=d.target;if(d.timestamp&&((!s||d.timestamp<s)&&(s=d.timestamp,l=d.author),(!o||d.timestamp>o)&&(o=d.timestamp,c=d.author)),m.resolveLanguage&&m.resolveLanguage!=="literal")try{let y=await Z(this,le,"f").getExpression(f);if(y)try{f=JSON.parse(y.data)}catch{f=y.data}}catch(y){console.warn(`Failed to resolve expression for ${u}:`,y)}else if(typeof f=="string"&&f.startsWith("literal://"))try{let y=ae.fromUrl(f).get();f=y.data!==void 0?y.data:y}catch{}m.transform&&typeof m.transform=="function"&&(f=m.transform(f)),this[u]=f}}for(let[u,m]of Object.entries(t.collections)){if(m.getter)continue;let d=a.filter(f=>f.predicate===m.predicate).map(f=>f.target);if(m.where?.condition&&d.length>0)try{let f=[];for(let y of d){let $=m.where.condition.replace(/\$perspective/g,`'${Z(this,le,"f").uuid}'`).replace(/\$base/g,`'${Z(this,Oe,"f")}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);$.trim().startsWith("WHERE")&&($=`array::len(SELECT * FROM link ${$}) > 0`);let A=`RETURN ${$}`,T=await Z(this,le,"f").querySurrealDB(A);(T===!0||Array.isArray(T)&&T.length>0&&T[0]===!0)&&f.push(y)}d=f}catch(f){console.warn(`Failed to apply condition filter for ${u}:`,f)}if(m.where?.isInstance&&d.length>0)try{let f=typeof m.where.isInstance=="string"?m.where.isInstance:m.where.isInstance.name,y=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(f);y&&(d=await Z(this,le,"f").batchCheckSubjectInstances(d,y))}catch{}this[u]=d}l&&(this.author=l),s&&(this.createdAt=s),o&&(this.updatedAt=o)}await e.evaluateCustomGettersForInstance(this,Z(this,le,"f"),t);for(let[s,o]of Object.entries(t.collections))if(o.getter&&o.where?.isInstance&&this[s]?.length>0)try{let c=typeof o.where.isInstance=="string"?o.where.isInstance:o.where.isInstance.name,l=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(c);if(l){let u=await Z(this,le,"f").batchCheckSubjectInstances(this[s],l);this[s]=u}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${Z(this,Oe,"f")}:`,e)}return this}static async queryToProlog(e,t,r){let{source:n,properties:a,collections:s,where:o,order:c,offset:l,limit:u,count:m}=t,p=r||await this.getClassName(e),d=[el(),Xc(n),Bh(a),jh(s),tl(o)],f=[il(m),rl(c),nl(l),al(u)];return`
1945
+ `,a=await Z(this,le,"f").querySurrealDB(n);if(a&&a.length>0){let s=null,o=null,c=null,l=null;for(let[u,m]of Object.entries(t.properties)){if(m.getter)continue;let p=a.filter(d=>d.predicate===m.predicate);if(p.length>0){let d=p[p.length-1],f=d.target;if(d.timestamp&&((!s||d.timestamp<s)&&(s=d.timestamp,l=d.author),(!o||d.timestamp>o)&&(o=d.timestamp,c=d.author)),m.resolveLanguage&&m.resolveLanguage!=="literal")try{let y=await Z(this,le,"f").getExpression(f);if(y)try{f=JSON.parse(y.data)}catch{f=y.data}}catch(y){console.warn(`Failed to resolve expression for ${u}:`,y)}else if(m.resolveLanguage==="literal"&&typeof f=="string"&&f.startsWith("literal://"))try{let y=ae.fromUrl(f).get();f=y.data!==void 0?y.data:y}catch{}m.transform&&typeof m.transform=="function"&&(f=m.transform(f)),this[u]=f}}for(let[u,m]of Object.entries(t.collections)){if(m.getter)continue;let d=a.filter(f=>f.predicate===m.predicate).map(f=>f.target);if(m.where?.condition&&d.length>0)try{let f=[];for(let y of d){let $=m.where.condition.replace(/\$perspective/g,`'${Z(this,le,"f").uuid}'`).replace(/\$base/g,`'${Z(this,Oe,"f")}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);$.trim().startsWith("WHERE")&&($=`array::len(SELECT * FROM link ${$}) > 0`);let A=`RETURN ${$}`,T=await Z(this,le,"f").querySurrealDB(A);(T===!0||Array.isArray(T)&&T.length>0&&T[0]===!0)&&f.push(y)}d=f}catch(f){console.warn(`Failed to apply condition filter for ${u}:`,f)}if(m.where?.isInstance&&d.length>0)try{let f=typeof m.where.isInstance=="string"?m.where.isInstance:m.where.isInstance.name,y=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(f);y&&(d=await Z(this,le,"f").batchCheckSubjectInstances(d,y))}catch{}this[u]=d}l&&(this.author=l),s&&(this.createdAt=s),o&&(this.updatedAt=o)}await e.evaluateCustomGettersForInstance(this,Z(this,le,"f"),t);for(let[s,o]of Object.entries(t.collections))if(o.getter&&o.where?.isInstance&&this[s]?.length>0)try{let c=typeof o.where.isInstance=="string"?o.where.isInstance:o.where.isInstance.name,l=await Z(this,le,"f").getSubjectClassMetadataFromSDNA(c);if(l){let u=await Z(this,le,"f").batchCheckSubjectInstances(this[s],l);this[s]=u}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${Z(this,Oe,"f")}:`,e)}return this}static async queryToProlog(e,t,r){let{source:n,properties:a,collections:s,where:o,order:c,offset:l,limit:u,count:m}=t,p=r||await this.getClassName(e),d=[el(),Xc(n),Bh(a),jh(s),tl(o)],f=[il(m),rl(c),nl(l),al(u)];return`
1946
1946
  findall([Base, Properties, Collections, Timestamp, Author], (
1947
1947
  subject_class("${p}", SubjectClass),
1948
1948
  instance(SubjectClass, Base),
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "email": "nicolas@coasys.org"
49
49
  },
50
50
  "devDependencies": {
51
- "@coasys/ad4m": "workspace:0.12.0-rc1-dev",
51
+ "@coasys/ad4m": "workspace:0.12.0-rc1-dev.1",
52
52
  "@apollo/client": "3.7.10",
53
53
  "@types/node": "^16.11.11",
54
54
  "esbuild": "^0.15.5",
@@ -72,5 +72,5 @@
72
72
  "@coasys/ad4m": "*"
73
73
  }
74
74
  },
75
- "version": "0.12.0-rc1-dev"
75
+ "version": "0.12.0-rc1-dev.1"
76
76
  }